Etherscan is the Ethereum network blockchain explorer that allows you to search for transactions, blocks, smart contracts, wallet addresses, and other on-chain data. Since Ethereum is a public blockchain, the website is a free blockchain explorer, and it's one of the most popular websites to look through all interactions on the Ethereum blockchain.
According to Ethereum.org, Smart contracts are computer programs stored on the blockchain that allows us to convert traditional contracts into digital parallels. As a computer program, it entails a collection of code—its function— and data—its state. Smart contracts are entirely rational, following an "if/then" pattern. This means they follow the program precisely and cannot be modified.
After the hard work of writing your smart contract, what is next is to share it with the rest of the world by verifying it on Etherscan. Anybody can view your source code and interact with your smart contract aftermath. Below are the steps to submit your smart contract to Etherscan:
The Ehterscan API key is essential to authenticate that you own the smart contract you're about to publish. So, log in to your Etherscan account or create one here if you don't have an account.
Then click on the "API Keys" tab from the bottom left corner of the page. Another tab will pop up.
Click on the blue tab that reads "+ Add" on the top right corner of this tab to add your API key.
Next, input your App name in the field required and click on "Create New API Key."
· Then you have your API Key, as shown below.
npm install –save-dev @nomiclabs/hardhat-etherscan
Next is to verify your smart contract on Etherscan by running the command below in the terminal provided in the hello-world directory. The command is:
npx hardhat verify –network goerli DEPLOYED_CONTRACT_ADDRESS "Hello World!"
Ensure that the
DEPLOYED_CONTRACT_ADDRESS is the same smart contract address you deployed on the goerli test network. In addition, the last argument—"Hello World!"—must have the same string value as the one you used in the initial deployment.
If everything goes smoothly, your terminal should display the following message:
Congrats! Your smart contract code should be on Etherscan!
You should be able to view your smart contract code, and ABI published on Etherscan when you click the link supplied in your terminal.