Copy-paste verification examples for every major toolchain.
Each example verifies a contract on xdcscan.io. Replace the address, name, and settings with your own.
Hardhat
Add the explorer as a custom chain in hardhat.config.ts:
export default { networks: { xdc: { url: "https://rpc.xdc.org", chainId: 50, }, }, etherscan: { apiKey: { xdc: "no-key-required" }, // OpenScan.AI does not require a key customChains: [ { network: "xdc", chainId: 50, urls: { apiURL: "https://xdcscan.io/api", browserURL: "https://xdcscan.io", }, }, ], },};Verify after deploying:
npx hardhat verify --network xdc \ 0xabcdefabcdefabcdefabcdefabcdefabcdefabcd \ "ConstructorArg1" 1000000The plugin submits standard JSON input automatically — this is the most reliable verification path for Hardhat projects.
Foundry
forge verify-contract \ --chain-id 50 \ --compiler-version v0.8.24+commit.e11b9ed9 \ --verifier blockscout \ --verifier-url "https://xdcscan.io/api" \ 0xabcdefabcdefabcdefabcdefabcdefabcdefabcd \ src/MyToken.sol:MyTokenFor contracts with constructor arguments:
forge verify-contract \ --chain-id 50 \ --verifier blockscout \ --verifier-url "https://xdcscan.io/api" \ --constructor-args $(cast abi-encode "constructor(string,uint256)" "MyToken" 1000000) \ 0xabcdefabcdefabcdefabcdefabcdefabcdefabcd \ src/MyToken.sol:MyTokenCheck status:
forge verify-check --chain-id 50 \ --verifier blockscout --verifier-url "https://xdcscan.io/api" \ <GUID>Remix
- Compile the contract in Remix with the same compiler version and optimizer settings used at deployment.
- Install/enable a Blockscout verification plugin, or copy the standard JSON input from the compilation details pane.
- On the contract’s page at xdcscan.io, open Contract → Verify & publish, choose Via standard JSON input, and paste.
curl — flattened source
curl -X POST \ "https://xdcscan.io/api/v2/smart-contracts/0xabcdefabcdefabcdefabcdefabcdefabcdefabcd/verification/via/flattened-code" \ -H "Content-Type: application/json" \ -d '{ "compiler_version": "v0.8.24+commit.e11b9ed9", "contract_name": "MyToken", "source_code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\ncontract MyToken { ... }", "optimization_enabled": true, "optimization_runs": 200 }'curl — standard JSON input
curl -X POST \ "https://xdcscan.io/api/v2/smart-contracts/0xabcdefabcdefabcdefabcdefabcdefabcdefabcd/verification/via/standard-input" \ -H "Content-Type: application/json" \ -d @verification-payload.jsonverification-payload.json:
{ "compiler_version": "v0.8.24+commit.e11b9ed9", "contract_name": "MyToken", "input": "{\"language\":\"Solidity\",\"sources\":{ ... },\"settings\":{ ... }}"}Generate the input value from your build tool — Hardhat stores it in artifacts/build-info/, Foundry in out/.
Verify in your deploy script
Foundry scripts can verify inline:
forge script script/Deploy.s.sol --broadcast --verify \ --verifier blockscout --verifier-url "https://xdcscan.io/api"With Hardhat, call hre.run("verify:verify", { address, constructorArguments }) right after the deployment transaction confirms.
Next steps
- Verification API Reference — endpoint details
- Best Practices — avoid the common failures
- Advanced Features — proxies and similar-match lookup