forge, cast, anvil, and chisel, including Base’s hardforks and native precompiles: the B20 token factory, B20 tokens, the PolicyRegistry, and the ActivationRegistry.
Install
Install or upgrade to the latest stable Foundry:Terminal
foundryup --install <version>, for example foundryup --install v1.8.6.
Enable Base
Foundry runs Ethereum by default. How you turn on Base depends on where the code executes:
To enable Base for every command in a project, add the hardfork to
foundry.toml:
foundry.toml
Set the hardfork explicitly.
--network base without --hardfork runs forge on the Azul upgrade, which predates the B20 and PolicyRegistry precompiles, so calls to them revert. As of v1.8.6, Foundry’s built-in Base upgrade schedule ends at Beryl, so a fork of Base Mainnet also runs Beryl rules unless you pass --hardfork base:Cobalt.Pick a Base Upgrade
The hardfork value selects which Base upgrade’s rules and precompiles Foundry runs. Use the upgrade that is live on the network you target; see the network upgrades schedule.base-anvil
base-anvil is Base’s fork of Foundry. It installsbase-forge, base-cast, base-anvil, and base-chisel alongside stock Foundry and enables Base precompiles by default. Pin a release with base-foundryup --install <version>.
The B20 issuance guides’ samples still target base-anvil v1.1.1 and use base-cast. Those commands call a live Base RPC, so they also run unchanged with cast from Foundry v1.8.4 or later.
For new projects, use Foundry v1.8.4 or later.
Next Steps
Smart Contracts
Deploy a contract to Base Sepolia with Foundry, end to end.
B20 Token Standard
Launch Base’s native token standard from the command line.