How Base differs
Base adds native precompiles at fixed addresses that extend the EVM with functionality built into the node itself, such as the B20 token standard, the PolicyRegistry, and the B20 Factory. These addresses hold no contract bytecode, so standard Foundry (forge, cast, anvil) cannot simulate calls to them and aborts with call to non-contract address.
Base publishes base-anvil, a fork of Foundry that registers Base’s precompiles into its EVM. It installs base-forge, base-cast, and base-anvil alongside your existing Foundry toolchain without overwriting it, so contracts behave the same locally as they do on Base.
Set up your environment
- Create a new project directory
- Install Base’s Foundry build
base-forge, base-cast, and base-anvil alongside your existing Foundry toolchain.
- Initialize a new Solidity project
Counter contract in src/Counter.sol, which you can replace with your own contracts.
Configure a node connection and deployer key
- Create a
.envfile in your project root and add the Base RPC URLs
- Load the variables
- Store your deployer private key in Foundry’s secure keystore
~/.foundry/keystores, which is not tracked by git.
Deploy a contract
- (Optional) Dry-run the deployment to confirm your configuration:
- Deploy by adding the
--broadcastflag:
<contract-path>:<contract-name>.
- On success you’ll see the deployed address:
Verify your deployment
- Check the transaction on Sepolia Basescan using the transaction hash.
- Read the contract’s state from the command line:
Counter contract’s number variable, 0.
Next steps
B20 Token Standard
Launch Base’s native token standard, built in at the precompile level.
Connect to Base
Network details, RPC endpoints, and wallet configuration.