Skip to content

Commit 1b8a6dc

Browse files
authored
Merge pull request #848 from acashmoney/patch-2
Update hardhat.config.js
2 parents a988086 + 8376857 commit 1b8a6dc

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

docs/develop/hardhat.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,14 @@ The sample project will ask you to install hardhat-waffle and hardhat-ethers.You
2929
## **hardhat-config**
3030

3131
- Go to hardhat.config.js
32-
- Update the hardhat-config with matic-network-credentials.
33-
- create .env file in the root to store your private key
32+
- Update the hardhat-config with matic-network-credentials
33+
- Create .env file in the root to store your private key
34+
- Add Polygonscan API key to .env file to verify the contract on Polygonscan. You can generate an API key by [creating an account](https://polygonscan.com/register)
3435

3536
```js
37+
require('dotenv').config();
3638
require("@nomiclabs/hardhat-ethers");
39+
require("@nomiclabs/hardhat-etherscan");
3740
const fs = require('fs');
3841
const privateKey = fs.readFileSync(".secret").toString().trim();
3942
module.exports = {
@@ -46,6 +49,9 @@ module.exports = {
4649
accounts: [privateKey]
4750
}
4851
},
52+
etherscan: {
53+
apiKey: process.env.POLYGONSCAN_API_KEY
54+
},
4955
solidity: {
5056
version: "0.7.0",
5157
settings: {
@@ -83,7 +89,13 @@ Greeter deployed to: 0xfaFfCAD549BAA6110c5Cc03976d9383AcE90bdBE
8389

8490
You can check the deployment status here: https://mumbai.polygonscan.com/
8591

92+
## **Verifying contract on Polygonscan**
8693

94+
Run the following commands to quickly verify your contract on Polygonscan. This makes it easy for anyone to see the source code of your deployed contract.
8795

96+
```bash
97+
$ npm install --save-dev @nomiclabs/hardhat-etherscan
98+
$ npx hardhat verify --network matic 0xfaFfCAD549BAA6110c5Cc03976d9383AcE90bdBE
99+
```
88100

89-
101+
> Remember to update your address to your own deployed contract address. When the command is successful, you will see your contract verified on Polygonscan!

0 commit comments

Comments
 (0)