Sourcify Plugin for Hardhat
Similar to the hardhat verification plugin, this plugin submits the contract source and other info of all deployed contracts to Sourcify.
1) Tune Hardhat environment. For seamless usage, you should setup your environment following this tutorial (note, it will take an hour or so to run through). In this example we setup to use the Sokol test network. See the Hardhat Verification Tutorial for more information on the config file setup.
2) Deploy contract. More deployment details here. Note that we run from node_modules.bin\hardhat to circumvent package.json warning and use --network sokol to specify the network.
1
D:\test>yarn hardhat --network sokol deploy
2
yarn run v1.22.17
3
warning package.json: No license field
4
$ D:\test\node_modules.bin\hardhat --network sokol deploy
5
Nothing to compile deploying "Greeter" (tx: 0x32d11b11a547c126a4763be963f6acd0bb4f87ee7d7627e36f7d9009c57c6182)...: deployed at 0xBEA47De7132cF44D6b16617154CAA247b6568eaD with 528275 gas
6
Done in 18.81s.
Copied!
3) Verify contract.
1
D:\test>yarn hardhat --network sokol sourcify
2
yarn run v1.22.17
3
warning package.json: No license field
4
$ D:\test\node_modules\.bin\hardhat --network sokol sourcify
5
verifying Greeter (0xBEA47De7132cF44D6b16617154CAA247b6568eaD on chain 77) ...
6
=> contract Greeter is now verified
7
Done in 5.74s.
Copied!
4) Confirm verification in BlockScout. Go to your BlockScout instance and paste the contract address into the search bar. If verified, the code tab will display a green checkmark.
Selecting the Code tab will show additional information about your contract.
​
Export as PDF
Copy link