truffle-plugin-verifier v0.0.1
truffle-plugin-verifier
This truffle plugin allows you to automatically verify your smart contracts' source code on Etherscan/Blockscout, straight from the Truffle CLI.
It extends truffle-plugin-verify to also support Blockscout.
Installation
- Install the plugin with npm or yarn
npm i -D truffle-plugin-verifier
Add the plugin to your
truffle-config.js
filemodule.exports = { /* ... rest of truffle-config */ plugins: ["truffle-plugin-verifier"], };
Generate an API Key on your Etherscan account (see the Etherscan website)
Add your Etherscan API key to your truffle config (make sure to use something like
dotenv
so you don't commit the api key)module.exports = { /* ... rest of truffle-config */ api_keys: { etherscan: "MY_API_KEY", }, };
Usage
Before running verification, make sure that you have actually deployed your contracts to a public network with Truffle.
To verify your contracts on Etherscan, run:
truffle run etherscan SomeContractName AnotherContractName --network networkName [--debug]
Supported networks: mainnet, kovan, rinkeby, ropsten, goerli.
To verify your contracts on Blockscout, run:
truffle run blockscout SomeContractName AnotherContractName --network networkName --license UNLICENSED [--debug]
Supported networks: mainnet, xdai, sokol.
See truffle-plugin-verify for more information.
3 years ago