Verify using Foundry
Learn how to verify smart contracts on the Filecoin network using Foundry with various verification services including Blockscout, Sourcify, and Filfox.
Last updated
forge verify-contract \
--rpc-url "$CALIBRATION_RPC_URL" \
--chain 314159 \
--verifier blockscout \
--verifier-url "https://filecoin-testnet.blockscout.com/api/" \
0xYourContractAddress \
src/MyContract.sol:MyContractforge verify-contract \
--rpc-url "$FILECOIN_RPC_URL" \
--chain 314 \
--verifier blockscout \
--verifier-url "https://filecoin.blockscout.com/api/" \
0xYourContractAddress \
src/MyContract.sol:MyContractCONSTRUCTOR_ARGS=$(cast abi-encode "constructor(string,string)" "MyToken" "MYT")
forge verify-contract \
--rpc-url "$CALIBRATION_RPC_URL" \
--chain 314159 \
--verifier blockscout \
--verifier-url "https://filecoin-testnet.blockscout.com/api/" \
--constructor-args "$CONSTRUCTOR_ARGS" \
0xYourContractAddress \
src/MyToken.sol:MyTokenforge verify-contract \
--rpc-url "$FILECOIN_RPC_URL" \
--chain 314 \
--verifier sourcify \
--verifier-url https://sourcify.dev/server/ \
--guess-constructor-args \
0xYourContractAddress \
src/MyToken.sol:MyTokenforge verify-contract \
--rpc-url "$CALIBRATION_RPC_URL" \
--chain 314159 \
--verifier sourcify \
--verifier-url https://sourcify.dev/server/ \
--guess-constructor-args \
0xYourContractAddress \
src/MyToken.sol:MyTokennpm install --save-dev @fil-b/filfox-verifiernpx filfox-verifier forge <address> <contract-path> --chain <chainId># Verify on Filecoin mainnet
npx filfox-verifier forge 0xYourContractAddress src/MyContract.sol:MyContract --chain 314
# Verify on Calibration testnet
npx filfox-verifier forge 0xYourContractAddress src/MyContract.sol:MyContract --chain 314159