solidity合约验证

solidity合约验证,第1张

相关合约

TokenX.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract TokenX is ERC20{
    constructor(uint256 initialSupply) public ERC20("Web03", "W03") {
        _mint(msg.sender, initialSupply);
    }
    string public constant url = 'web03.cn';
}
部署合约

部署TokenX.sol

地址:0x38451d7BC8c4d69B4d5a760E0fDaf4a0E3EE9305

交易哈希:https://rinkeby.etherscan.io/tx/0x61480174ae0904ae7a84385346048ba90dc207bff1003f0d438945610995d601

合并合约

如果合约代码简单,没有import其他合约,可忽略这一步,这一步的目的是将你当前合约和所有引用的合约都整合到一个文件里面

Home→MORE→PLUGIN MANAGER

搜索flattener并点击Activate

插件激活成功,左侧会出现  Flattener 按钮,选中需要合并的合约

点击Save VerifyTest_flat.sol,d窗选中

结果

区块链浏览器认证合约

在区块链浏览器打开你的合约地址

https://rinkeby.etherscan.io/address/0x38451d7bc8c4d69b4d5a760e0fdaf4a0e3ee9305#code

点击 Verify and Publish

Please enter the Contract Address you would like to verify:需要验证的合约地址【0x38451d7BC8c4d69B4d5a760E0fDaf4a0E3EE9305】

Please select Compiler Type:选择单文件,合约我们已经合并为一个sol文件【Solidity(Single file)】

Please select Compiler Version:选择部署合约的编译器版本【v0.8.14+commit.80d49f37】

Please select Open Source License Type:选择合约的开源许可类型【)3MIT License(MIT)】

填完点击按钮Continue按钮到下一步

将刚刚合并后的合约代码全部拷贝到此处

Enter the Solidity Contract Code below*

Constructor Arguments ABl-encoded (for contracts that were created with constructor parameters)

填写你创建合约的参数,一般在字节码最后一段

最后进行人机身份认证,点击 Verify and Publish

这样就验证好了

验证合约方式2

下载remix插件 ETHERSCAN - CONTRACT VERIFICATION

可视化 *** 作,填写key,填写地址 初始化参数 选择合约

key在区块浏览器申请

*** 作相对简单

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/2992293.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-09-23
下一篇 2022-09-23

发表评论

登录后才能评论

评论列表(0条)

保存