Skip to content

Commit fe43cc1

Browse files
committed
docs: verify changes
The following changes have been applied: * small textual changes * reordered the guides - verifying a contract after deploying a contract makes sense, but I think verifying a deployment makes more sense as the last thing you do with Ignition (after visualizing and tests) * remove infura as a mentioned option due to NomicFoundation/hardhat-ignition#633 * renamed to `Verifying your deployment`
1 parent 4d2cc10 commit fe43cc1

File tree

2 files changed

+29
-25
lines changed

2 files changed

+29
-25
lines changed

docs/src/content/ignition/docs/guides/_dirinfo.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ section-title: Guides
33
order:
44
- /creating-modules
55
- /deploy
6-
- /verify
76
- /visualize
87
- /error-handling
98
- /modifications
109
- /tests
10+
- /verify

docs/src/content/ignition/docs/guides/verify.md

+28-24
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
# Verifying your contracts
1+
# Verifying your deployment
22

3-
Once your module has been deployed to a live network, the next step is to verify its source code.
3+
Once your Ignition module is tested and ready, the next step is to deploy it to a live network and verify the source code of each of its contracts.
44

55
Verifying a contract means making its source code public, along with the compiler settings you used, which allows anyone to compile it and compare the generated bytecode with the one that is deployed on-chain. Doing this is extremely important in an open platform like Ethereum.
66

7-
In this guide we'll explain how to do this with Hardhat Ignition in the [Etherscan](https://etherscan.io/) explorer.
7+
In this guide we'll explain how to do this with the [Etherscan](https://etherscan.io/) explorer.
88

99
## Getting an API key from Etherscan
1010

11-
The first thing you need is an API key from Etherscan. To get one, go to [their site](https://etherscan.io/login), sign in (or create an account if you don't have one) and open the "API Keys" tab. Then click the "Add" button and give a name (like "Hardhat") to the API key you are creating. After that you'll see the newly created key in the list.
11+
The first thing you need is an API key from Etherscan. To get one, go to [their site](https://etherscan.io/login), sign in (or create an account if you don't have one) and open the "API Keys" tab. Then click the "Add" button and give a name to the API key you are creating (e.g. "Hardhat"). After that you'll see the newly created key in the list.
1212

1313
Open your Hardhat config and add the API key you just created:
1414

@@ -42,28 +42,29 @@ module.exports = {
4242

4343
::::
4444

45-
## Deploying and verifying a contract in the Sepolia testnet
45+
## Deploying and verifying on the Sepolia testnet
4646

47-
We are going to use the [Sepolia testnet](https://ethereum.org/en/developers/docs/networks/#sepolia) to deploy and verify our contract, so you need to add this network in your Hardhat config. Here we are using [Alchemy](https://alchemy.com/) to connect to the network, but you can use an alternative JSON-RPC URL like [Infura](https://infura.io/) if you want.
47+
We are going to use the [Sepolia testnet](https://ethereum.org/en/developers/docs/networks/#sepolia) to deploy and verify our Ignition module, so you need to add this network in your Hardhat config. Here we are using [Alchemy](https://alchemy.com/) to connect to the network.
4848

49-
::::tabsgroup{options=Alchemy,Infura}
49+
::::tabsgroup{options=TypeScript,JavaScript}
5050

51-
:::tab{value=Alchemy}
51+
:::tab{value=TypeScript}
5252

53-
```js
53+
```ts
5454
// Go to https://alchemy.com, sign up, create a new App in
55-
// its dashboard, and replace "KEY" with its key
56-
const ALCHEMY_API_KEY = "KEY";
55+
// its dashboard, and set the Hardhat configuration variable
56+
// ALCHEMY_API_KEY to the key
57+
const ALCHEMY_API_KEY = vars.get("ALCHEMY_API_KEY");
5758

58-
// Replace this private key with your Sepolia account private key
59+
// Replace this private key with your Sepolia test account private key
5960
// To export your private key from Coinbase Wallet, go to
6061
// Settings > Developer Settings > Show private key
6162
// To export your private key from Metamask, open Metamask and
6263
// go to Account Details > Export Private Key
6364
// Beware: NEVER put real Ether into testing accounts
64-
const SEPOLIA_PRIVATE_KEY = "YOUR SEPOLIA PRIVATE KEY";
65+
const SEPOLIA_PRIVATE_KEY = vars.get("SEPOLIA_PRIVATE_KEY");
6566

66-
module.exports = {
67+
export default {
6768
// ...rest of your config...
6869
networks: {
6970
sepolia: {
@@ -76,26 +77,27 @@ module.exports = {
7677

7778
:::
7879

79-
:::tab{value=Infura}
80+
:::tab{value=JavaScript}
8081

8182
```js
82-
// Go to https://infura.io, sign up, create a new API key
83-
// in its dashboard, and replace "KEY" with it
84-
const INFURA_API_KEY = "KEY";
83+
// Go to https://alchemy.com, sign up, create a new App in
84+
// its dashboard, and set the Hardhat configuration variable
85+
// ALCHEMY_API_KEY to the key
86+
const ALCHEMY_API_KEY = vars.get("ALCHEMY_API_KEY");
8587

86-
// Replace this private key with your Sepolia account private key
88+
// Replace this private key with your Sepolia test account private key
8789
// To export your private key from Coinbase Wallet, go to
8890
// Settings > Developer Settings > Show private key
8991
// To export your private key from Metamask, open Metamask and
9092
// go to Account Details > Export Private Key
9193
// Beware: NEVER put real Ether into testing accounts
92-
const SEPOLIA_PRIVATE_KEY = "YOUR SEPOLIA PRIVATE KEY";
94+
const SEPOLIA_PRIVATE_KEY = vars.get("SEPOLIA_PRIVATE_KEY");
9395

9496
module.exports = {
9597
// ...rest of your config...
9698
networks: {
9799
sepolia: {
98-
url: `https://sepolia.infura.io/v3/${INFURA_API_KEY}`,
100+
url: `https://eth-sepolia.g.alchemy.com/v2/${ALCHEMY_API_KEY}`,
99101
accounts: [SEPOLIA_PRIVATE_KEY],
100102
},
101103
},
@@ -112,7 +114,7 @@ To deploy on Sepolia you need to send some Sepolia ether to the address that's g
112114

113115
:::tip
114116

115-
This guide assumes you are using the contracts and deployment module from the [quick start guide](/ignition/docs/getting-started#quick-start), but the steps are the same for any contract.
117+
This guide assumes you are using the contracts and Ignition module from the [quick start guide](/ignition/docs/getting-started#quick-start), but the steps are the same for any deployment.
116118

117119
:::
118120

@@ -147,7 +149,9 @@ npx hardhat ignition deploy ignition/modules/Apollo.js --network sepolia --verif
147149

148150
::::
149151

150-
The `--verify` flag is optional, but it tells Hardhat Ignition to verify the contracts immediately after finishing the deployment. If you have an existing deployment and want to verify it, you can also run the `verify` task directly using the deployment ID:
152+
The `--verify` flag is optional, but it tells Hardhat Ignition to verify the contracts after a successful deployment.
153+
154+
If you have an existing deployment and want to verify it, you can also run the `verify` task directly by passing the deployment ID:
151155

152156
```sh
153157
npx hardhat ignition verify chain-11155111
@@ -159,6 +163,6 @@ If you get an error saying that the address does not have bytecode, it probably
159163

160164
:::
161165

162-
After the task is successfully executed, you'll see a link to the publicly verified code of your contract.
166+
After the task has successfully executed, for each deployed contract you'll see a link to its publicly verified code.
163167

164168
To learn more about verifying, read the [hardhat-verify](/hardhat-runner/plugins/nomicfoundation-hardhat-verify) documentation.

0 commit comments

Comments
 (0)