使用 standard-input-json(以BSC测试链为例)

源码

Storage.sol

// SPDX-License-Identifier: MITpragma solidity >=0.7.0 <0.9.0;
import "@openzeppelin/contracts/access/Ownable.sol";contract Storage is Ownable {uint256 number;function setNumber(uint256 num) public onlyOwner {number = num;}function getNumber() public view returns (uint256) {return number;}
}

JSON格式的输入

Storage.json

{"language": "Solidity","sources": {"contracts/Storage.sol": {"content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.7.0 <0.9.0;\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Storage is Ownable {\n    uint256 number;\n\n    function setNumber(uint256 num) public onlyOwner {\n        number = num;\n    }\n\n    function getNumber() public view returns (uint256) {\n        return number;\n    }\n}"},"@openzeppelin/contracts/access/Ownable.sol": {"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n    address private _owner;\n\n    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n    /**\n     * @dev Initializes the contract setting the deployer as the initial owner.\n     */\n    constructor() {\n        _transferOwnership(_msgSender());\n    }\n\n    /**\n     * @dev Returns the address of the current owner.\n     */\n    function owner() public view virtual returns (address) {\n        return _owner;\n    }\n\n    /**\n     * @dev Throws if called by any account other than the owner.\n     */\n    modifier onlyOwner() {\n        require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n        _;\n    }\n\n    /**\n     * @dev Leaves the contract without owner. It will not be possible to call\n     * `onlyOwner` functions anymore. Can only be called by the current owner.\n     *\n     * NOTE: Renouncing ownership will leave the contract without an owner,\n     * thereby removing any functionality that is only available to the owner.\n     */\n    function renounceOwnership() public virtual onlyOwner {\n        _transferOwnership(address(0));\n    }\n\n    /**\n     * @dev Transfers ownership of the contract to a new account (`newOwner`).\n     * Can only be called by the current owner.\n     */\n    function transferOwnership(address newOwner) public virtual onlyOwner {\n        require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n        _transferOwnership(newOwner);\n    }\n\n    /**\n     * @dev Transfers ownership of the contract to a new account (`newOwner`).\n     * Internal function without access restriction.\n     */\n    function _transferOwnership(address newOwner) internal virtual {\n        address oldOwner = _owner;\n        _owner = newOwner;\n        emit OwnershipTransferred(oldOwner, newOwner);\n    }\n}\n"},"@openzeppelin/contracts/utils/Context.sol": {"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n    function _msgSender() internal view virtual returns (address) {\n        return msg.sender;\n    }\n\n    function _msgData() internal view virtual returns (bytes calldata) {\n        return msg.data;\n    }\n}\n"}},"settings": {"optimizer": {"enabled": true,"runs": 200},"outputSelection": {"*": {"*": ["abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers","metadata"],"": ["ast"]}}}
}

content内容:将solidity源码转换为JSON字符串。

Javascript Serializer(推荐方法3、4)

Convert/Escapes an object to a JSON string
将solidity源码转换为JSON字符串

方法1.BSC网址

去掉最后的 ”

方法2.字符串转义

// SPDX-License-Identifier: MIT\n\npragma solidity >=0.7.0 <0.9.0;\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Storage is Ownable {\n    uint256 number;\n\n    function setNumber(uint256 num) public onlyOwner {\n        number = num;\n    }\n\n    function getNumber() public view returns (uint256) {\n        return number;\n    }\n}

方法3. Hardhat项目下

编译合约:

npx hardhat compile

打开artifacts\build-info路径下的json文件
input字段内容

方法4. Remix工具下

编译合约后,打开artifacts\build-info路径下的json文件
input字段内容

BSC浏览器验证合约

https://testnet.bscscan.com/address/0x1b3104004ebda264b88d04afb6ea66d70a2d51ac#code
1.

2.
3.

4.

如何使用standard-input-json验证Solidity源码?相关推荐

  1. 使用Hardhat验证 Solidity 源码 (Ethereum or BSC)

    hardhat-etherscan 这个插件可以帮助你在Etherscan上验证 Solidity 合约的源代码. 只需提供部署地址和构造函数参数,插件将在本地检测要验证的合约. 如果您的合约使用 S ...

  2. Android Input子系统-含实例源码

    Android Input子系统-含实例源码 1 Input子系统作用 Android很多外设都是用到输入输出设备,比如touchscreen,键盘,音量键等,输入 设备对应Android 框架是An ...

  3. php授权验证系统源码-全解开源版

    简介: php授权验证系统源码全解开源版,正版授权查询管理. 安装方法:上传PHP环境,访问域名instll,根据提示自动安装! 网盘下载地址: http://kekewl.org/MBJa7XXNk ...

  4. 易语言json置入_易语言json操作模块源码

    易语言json操作模块源码 系统结构:初始化,解析,到文本,置属性,置属性对象,置属性数值,取属性数值,取属性对象,取通用属性,取属性,成员数,加成员,取成员,取成员文本,置成员,删成员,置类型,赋值 ...

  5. Python|excel表格数据一键转json格式小工具|支持xlsx、xls格式转json|【源码+解析】

    背景    最近在使用JavaScript编写一些浏览器RPA脚本,脚本使用过程中遇到一些问题,脚本使用的数据往往存放在excel表,但运行时只能读取json数据,导致频繁人工excel转json,效 ...

  6. Thinkphp开发App网络授权验证系统源码

    正文: Thinkphp开发App网络授权验证系统源码,没有过多的介绍,大家自己去研究吧,有ZF接口,卡Mi管理,Ying用管理,Yong户管理等功能. 下载方式: lanzou.com/iAYMm0 ...

  7. 全新Thinkphp开发App网络授权验证系统源码

    正文: Thinkphp开发App网络授权验证系统源码,没有过多的介绍,大家自己去研究吧,有支付接口,卡卡密管理,应用用管理,用户管理等功能. 程序: wwuyh.lanzoub.com/iAEmy0 ...

  8. 最新天狼星网络验证完整源码+功能强大/UI也不错

    正文: 最新天狼星网络验证完整源码+功能强大/UI也不错,程序是通过PHP开发的,功能方面真心没得说,程序的搭建很简单,就正常搭建就行了,用过这网络验证程序的都还觉得不错. 天狼星网络验证:一个可以添 ...

  9. harbor登录验证_Harbor 源码浅析

    Harbor 源码浅析​www.qikqiak.com Harbor 是一个CNCF基金会托管的开源的可信的云原生docker registry项目,可以用于存储.签名.扫描镜像内容,Harbor 通 ...

最新文章

  1. 如何学习android高级编程
  2. MIT自然语言处理第三讲:概率语言模型(第四、五、六部分)
  3. 搜索引擎anti-spam系统设计指南
  4. 自然语言处理-nltk学习(二)
  5. Opencv3编程入门学习笔记(二)之显式创建Mat对象
  6. mysql 修改引擎_修改MySQL的数据库引擎为INNODB的方法
  7. 深度学习(六十四)Faster R-CNN物体检测
  8. alpine安装更新
  9. mysql study_MySQL Study之--MySQL体系结构深入解析
  10. 论文笔记_SLAM_综述十几篇_目录
  11. 按照ISO26262标准检验建模规范:基于模型的软件开发质量工具
  12. Python绘制云图
  13. 51单片机|keilc51|模块函数|延时函数、独立键盘函数
  14. 生成PayPal测试账号clientID 和 密钥
  15. Delphi/Pascaldelphi盒子
  16. 基于SPSS的医疗医保费用数据分析预测(C#)
  17. 基于物联网的智慧农业监测系统(前端界面有web端和微信小程序端)
  18. 论文发表-关于深度学习在问答系统和对话系统方面的应用研究-2018到2019年
  19. 误删Windows账户恢复方案
  20. 租用游艇问题 石子合并问题 动态规划实验

热门文章

  1. JavaScript18——触屏事件
  2. 折扣方式销售货物如何征增值税?
  3. 【ShaderLab踩坑记录】【待解决 / 求助】给AlphaTest添加阴影导致的奇奇怪怪的Bug
  4. 【瑕疵检测】瓶盖瑕疵检测【含Matlab源码 730期】
  5. [转载]linux grep 多个关键字用法
  6. 浙大版《C语言程序设计(第3版)》习题2-2 阶梯电价
  7. Notepad++更改UI颜色
  8. Excel的VBA进行百度搜索
  9. 基于JBox2D物理引擎开发的“雷电”小游戏(五)——碰撞
  10. 现在的我也是曾经的我