forge, so forge needs no chain config file. It is for developers who use Foundry and work from the command line.
Ready-made template: Foundry in the Whitechain templates repository. The fastest path below clones it and deploys. The companion Hardhat template is Hardhat.
Fastest path
The Foundry template is a finished project for Whitechain Sepolia: the RPC alias is configured,forge-std is vendored so the folder builds with no forge install
step, and the contract, tests, and deploy script are in place. You need Foundry and
a funded key. The walkthrough after this section builds the same project by hand,
if you would rather see every step.
-
Get the
Foundryfolder. -
Copy the environment file, then load it into your shell.
Set
PRIVATE_KEYto a throwaway key funded from the faucet.WHITECHAIN_SEPOLIA_RPC_URLalready points at the public endpoint.forge buildandforge testboth run before you fill anything in. -
Deploy.
forgeprints the deployed address underContract Address. -
Verify, using that address.
Before you deploy
- A funded testnet account. Claim test WBT from the faucet.
- The private key for that account. Use a throwaway key for testing.
1. Install Foundry
Foundryup requires a Unix shell. macOS and Linux work directly. On Windows, run Foundry inside WSL.- macOS / Linux
- Windows
Install Foundry, then run
foundryup to fetch forge, cast, and anvil.Terminal
If
foundryup is not found after the first command, restart your terminal and run it again.2. Create a project
Scaffold a project and move into it.Terminal
foundry.toml so the compiler matches the contract. Verification fails if the compiler version differs.
foundry.toml
3. Add the contract
Createsrc/Storage.sol. You can delete the sample Counter files that forge init created.
src/Storage.sol
4. Set environment variables
Create a.env file with the private key, then load it into the shell.
.env
Terminal
For a safer setup, import the key into an encrypted keystore with
cast wallet import, then pass --account <name> instead of --private-key.5. Add a deploy script
Createscript/DeployStorage.s.sol.
script/DeployStorage.s.sol
6. Deploy the contract
Terminal
forge prints the deployed address under Contract Address. Copy it for verification.
7. Verify the contract
Verify the deployed contract on the Whitechain Blockscout explorer.Terminal
The Blockscout verifier URL ends with
/api/. A missing or wrong suffix makes the request fail. To verify during deployment instead, add --verify --verifier blockscout --verifier-url https://explorer.testnet.whitechain.io/api/ to the forge script command in step 6.Verify the result
Open the contract address on the explorer. A verified contract shows its source code and a verified marker.Troubleshooting
`forge script` deploys nothing
`forge script` deploys nothing
The
--broadcast flag is missing. Add --broadcast to send the transaction.The transaction fails with insufficient funds
The transaction fails with insufficient funds
The account holds no WBT. Claim test WBT from the faucet. Do not send mainnet WBT to the testnet.
Verification reports a compiler mismatch
Verification reports a compiler mismatch
The solc version differs from the pragma. Pin
solc = "0.8.30" in foundry.toml, rebuild, and verify again.The verification request is rejected
The verification request is rejected
The
--verifier-url is missing the /api/ suffix. Use https://explorer.testnet.whitechain.io/api/.Deployment or verification fails with no clear cause
Deployment or verification fails with no clear cause
The explorer or RPC may be experiencing an outage. Check the status page.

