Skip to content

Commit a2fbe8c

Browse files
isabelleweiisabelledghelm
authored
Update contract verification page for etherscan and mainnet (#123)
* update foundry verification for etherscan and mainnet * update hardhat instructions * fix: nits --------- Co-authored-by: isabelle <[email protected]> Co-authored-by: Daniel Helm <[email protected]>
1 parent e0b08d1 commit a2fbe8c

File tree

1 file changed

+49
-18
lines changed

1 file changed

+49
-18
lines changed

src/content/docs/en/developers/verifying-smart-contracts.mdx

Lines changed: 49 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,34 @@ title: "Verifying Smart Contracts"
55
lang: "en"
66
permalink: "developers/verifying-smart-contracts"
77
whatsnext: { "Scroll Contracts": "/developers/scroll-contracts" }
8-
excerpt: "Easily verify your smart contracts with Scroll-supported developer tooling or the Blockscout Web API"
8+
excerpt: "Easily verify your smart contracts with Scroll-supported developer tooling"
99
---
1010

1111
import Aside from "../../../../components/Aside.astro"
1212
import ClickToZoom from "../../../../components/ClickToZoom.astro"
1313
import verify1 from "./_images/verify1.png"
1414
import CodeSample from "../../../../components/CodeSample/CodeSample.astro"
1515

16-
After deploying your smart contracts, it's important to verify your code on [our block explorer](https://scrollscan.com/) or the [Sepolia block explorer](https://sepolia-blockscout.scroll.io).
16+
After deploying your smart contracts, it's important to verify your code on a block explorer. This can be done in an automated way using your developer tooling or the Web UI.
1717

18-
This can be done in an automated way using your developer tooling or using Blockscout's Web UI.
18+
## Using Developer Tools
1919

20-
<Aside type="tip" title="Blockscout vs Etherscan">
21-
The below instructions for verifying on our Sepolia Blockscout instance will need to be altered to work with Etherscan
22-
deployments. As additional services come online for mainnet, we'll update these instructions.
23-
</Aside>
20+
Most smart contract tooling has plugins for verifying your contracts easily on Etherscan. Blockscout supports Etherscan's contract verification APIs, so it's straightforward to use these tools using the APIs of either of these block explorers.
2421

25-
## Using Developer Tools
22+
| Network | Scroll | Scroll Sepolia |
23+
| ---------- | -------------------------------- | ---------------------------------------- |
24+
| Scrollscan | https://api.scrollscan.com/api | https://api-sepolia.scrollscan.com/api |
25+
| Blockscout | https://blockscout.scroll.io/api | https://sepolia-blockscout.scroll.io/api |
2626

27-
Most smart contract tooling has plugins for verifying your contracts easily on Etherscan. Blockscout supports Etherscan's contract verification APIs, and it's straightforward to use these tools with the Scroll Sepolia Testnet.
27+
<Aside type="tip" title="Using the Scrollscan API">
28+
When using Scrollscan, you will need to [register an account](https://scrollscan.com/register) and create an API key. The same key can be used for both Scroll Sepolia and mainnet. After creating your API key, please wait a few minutes before it comes into effect.
29+
</Aside>
2830

2931
### Hardhat
3032

31-
First, modify `hardhat.config.ts` to point to Scroll's RPC and `sepolia-blockscout.scroll.io/api`. A dummy `apiKey` value is required, but anything works for its value.
33+
Modify `hardhat.config.ts` to point to Scroll's RPC and block explorer API. For Blockscout, a dummy `apiKey` value is required, but anything works for its value. For Scrollscan, use your own API key.
3234

35+
For example, if you are using Scroll Sepolia on Blockscout, your config will look like this:
3336
```javascript
3437
...
3538

@@ -82,18 +85,46 @@ npx hardhat verify --network scrollSepolia 0xD9880690bd717189cC3Fbe7B9020F27fae7
8285

8386
### Foundry
8487

85-
<Aside type="danger" title="Warning">
86-
Our Blockscout instance currently has inconsistent behavior in verifying contracts with Foundry. We're working on a
87-
fix, along with other stability improvements. Don't hesitate to come ask for help [on
88-
Discord](https://discord.com/channels/853955156100907018/1028102371894624337) though.
88+
When using Foundry, the `verify-contract` command helps automate the process of verifying contracts. If your contract has constructor arguments, you can specify these in ABI-encoded form with the `--constructor-args` option. For example, if your constructor takes two `uint256` variables:
89+
```bash
90+
--constructor-args $(cast abi-encode "constructor(uint256,uint256)" 0 7)
91+
```
92+
93+
Refer to the [Foundry documentation](https://book.getfoundry.sh/reference/forge/forge-verify-contract) for further options you can specify.
94+
95+
96+
#### Scrollscan
97+
98+
```bash
99+
forge verify-contract <contract address> <contract name> \
100+
--verifier-url https://api-sepolia.scrollscan.com/api \
101+
--etherscan-api-key <your Scrollscan API key> \
102+
--constructor-args <your constructor arguments>
103+
```
104+
<Aside type="caution" title="Caution">
105+
Do not specify the chain ID.
89106
</Aside>
90107

91-
When using Foundry, the `verify-contract` helps automate the process of verifying contracts.
108+
#### Blockscout
109+
110+
Specify the verification provider as `blockscout`.
92111

112+
##### Scroll
93113
```bash
94-
forge verify-contract <Contract Address> <Space separated params> <Solidity file>:<Contract name> --chain-id 534351 --verifier-url https://sepolia-blockscout.scroll.io/api\? --verifier blockscout
114+
forge verify-contract <contract address> <contract name> \
115+
--verifier-url https://blockscout.scroll.io/api\? \
116+
--verifier blockscout \
117+
--constructor-args <your constructor arguments>
118+
```
119+
120+
##### Scroll Sepolia
121+
```bash
122+
forge verify-contract <contract address> <contract name> \
123+
--verifier-url https://sepolia-blockscout.scroll.io/api\? \
124+
--verifier blockscout \
125+
--constructor-args <your constructor arguments>
95126
```
96127

97128
<Aside type="danger" title="Warning">
98-
Notice we add `\?` at the end of the verifier URL or otherwise verification would fail. (Last tested on forge v0.2.0).
99-
</Aside>
129+
Notice we add `\?` at the end of the verifier URL otherwise verification would fail. (Last tested on forge v0.2.0).
130+
</Aside>

0 commit comments

Comments
 (0)