Skip to Content
On this page

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.

Using Developer Tools#

Hardhat#

Modify hardhat.config.ts to point to DogeOS’s RPC and block explorer API.

For example, the config for DogeOS Chikyū Testnet will look like this:

... const config: HardhatUserConfig = { ... networks: { dogeosTestnet: { url: 'https://rpc.testnet.dogeos.com' || '', accounts: process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [], }, }, etherscan: { customChains: [ { network: 'dogeosTestnet', chainId: 6281971, urls: { apiURL: 'https://dogeos-testnet.l2scan.co/api', browserURL: 'https://dogeos-testnet.l2scan.co/', }, }, ], }, } ...

Now you can verify the smart contract by running the following command.

npx hardhat verify --network dogeosTestnet <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 dogeosTestnet 0xD9880690bd717189cC3Fbe7B9020F27fae7Ac76F 123 456

Foundry#

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:

--constructor-args $(cast abi-encode "constructor(uint256,uint256)" 0 7)

Refer to the Foundry documentation  for further options you can specify.

forge verify-contract <contract address> <contract name> --rpc-url https://rpc.testnet.dogeos.com --chain-id 6281971 --watch --skip-is-verified-check --verifier-url https://dogeos-testnet.l2scan.co/api/ --verifier blockscout