Verify using Foundry
Learn how to verify smart contracts on the Filecoin network using Foundry with various verification services including Blockscout, Sourcify, and Filfox.
This guide shows you how to verify your smart contracts using Foundry on the Filecoin network.
Prerequisites
A Foundry project set up for Filecoin development. If you don't have one, start with the FEVM Foundry Kit.
Foundry installed with
forgeandcastavailable in yourPATH.A deployed contract address on Filecoin mainnet or Calibration testnet.
The same source tree, compiler version, optimizer settings, and
foundry.tomlsettings that were used for deployment.Contract constructor arguments, if the contract was deployed with any.
A Filecoin RPC URL for the target network. Filecoin mainnet uses chain ID
314; Calibration testnet uses chain ID314159.
Verification Methods
Set RPC URLs in your shell before running the examples:
export FILECOIN_RPC_URL=https://api.node.glif.io/rpc/v1
export CALIBRATION_RPC_URL=https://api.calibration.node.glif.io/rpc/v1Blockscout Verification
Blockscout is a popular blockchain explorer that supports contract verification.
Verify on Calibration testnet:
Verify on Filecoin mainnet:
For constructors, pass ABI-encoded constructor arguments. The constructor signature and values must match the deployment:
If Blockscout reports that the contract is already verified while you are retrying the same address, add --force --skip-is-verified-check.
Sourcify Verification
Sourcify provides decentralized contract verification.
Verify on Filecoin mainnet:
Verify on Calibration testnet:
For more information, see the Sourcify documentation.
Filfox Verification
Filfox is the native Filecoin explorer with dedicated verification support.
Installation:
Usage:
Examples:
The Filfox verifier requires Node.js 20 or later and a Foundry project with foundry.toml. It runs forge build and extracts the metadata needed for the Filfox verification request.
For detailed information, see the @fil-b/filfox-verifier documentation.
Last updated