Skip to main content
Base is an EVM-equivalent Ethereum L2. Smart contracts are written in Solidity or Vyper and deploy exactly as they do on Ethereum — the same bytecode, ABIs, and tooling apply.

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.
Use Base’s Foundry build (base-forge, base-cast, base-anvil) rather than standard Foundry (forge, cast, anvil) for Base development. A contract that reads or writes a Base precompile — for example one that deploys or calls a B20 token — will fail under standard Foundry.

Set up your environment

  1. Create a new project directory
  1. Install Base’s Foundry build
This installs base-forge, base-cast, and base-anvil alongside your existing Foundry toolchain.
  1. Initialize a new Solidity project
Your project is ready. You’ll find an example Counter contract in src/Counter.sol, which you can replace with your own contracts.
Base’s Foundry build provides the same tools as standard Foundry, with Base’s precompiles built in: base-forge (build and test), base-cast (interact with the chain), and base-anvil (run a local Base node). Learn more about base-anvil and the underlying Foundry toolchain.

Configure a node connection and deployer key

  1. Create a .env file in your project root and add the Base RPC URLs
  1. Load the variables
  1. Store your deployer private key in Foundry’s secure keystore
Enter your private key and a password when prompted. The key is stored in ~/.foundry/keystores, which is not tracked by git.
Never share or commit your private key. Always keep it secure and handle it with care.
Base Sepolia is the test network for Base, used for the rest of this guide. Get free Base Sepolia ETH from one of the faucets listed here.

Deploy a contract

  1. (Optional) Dry-run the deployment to confirm your configuration:
This simulates the deployment without broadcasting. You’ll see the transaction details and contract ABI, but nothing is deployed.
  1. Deploy by adding the --broadcast flag:
The contract path format is <contract-path>:<contract-name>.
  1. On success you’ll see the deployed address:

Verify your deployment

  1. Check the transaction on Sepolia Basescan using the transaction hash.
  2. Read the contract’s state from the command line:
This returns the initial value of the 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.
Use wagmi or viem to connect your frontend to your contracts, and see the Foundry scripting guide for command-line interaction.