Verifying Smart Contracts
After deploying your smart contracts, it's important to verify your code on our block explorer or the Sepolia block explorer.
This can be done in an automated way using your developer tooling or using Blockscout's Web UI.
Using Developer Tools
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.
Hardhat
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.
...
const config: HardhatUserConfig = {
...
networks: {
scrollSepolia: {
url: 'https://sepolia-rpc.scroll.io' || '',
accounts:
process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [],
},
},
etherscan: {
apiKey: {
scrollSepolia: 'abc',
},
customChains: [
{
network: 'scrollSepolia',
chainId: 534351,
urls: {
apiURL: 'https://sepolia-blockscout.scroll.io/api',
browserURL: 'https://sepolia-blockscout.scroll.io/',
},
},
],
},
}
...
Now you can verify the smart contract by running the following command.
npx hardhat verify --network scrollSepolia <contract address> <space separated constructor parameters>
For example, this is how a smart contract that receives two uint parameters in the constructor should look:
npx hardhat verify --network scrollSepolia 0xD9880690bd717189cC3Fbe7B9020F27fae7Ac76F 123 456
Foundry
When using Foundry, the verify-contract
helps automate the process of verifying contracts.
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