- You’ll deploy a Chainstack Base node and install Base’s Foundry build (
base-forge). - You’ll create a B20 Asset token by calling the B20 factory precompile in a single transaction, with admin, minter, and supply cap set atomically.
- You’ll mint the initial supply and verify the balance on-chain through your Chainstack endpoint.
- B20 is an ERC-20 superset, so the result works with any ERC-20 tooling.
Main article
B20 is Base’s native token standard, introduced with the Beryl upgrade. Instead of writing and deploying an ERC-20 contract, you create a token by calling the singleton B20 factory precompile — roles, supply caps, pausing, transfer policies, memos, andpermit are built into the chain.
This tutorial creates an Asset token, mints its initial supply, and verifies the balance, all through a Chainstack Base node. It targets Base Sepolia, where the B20 precompiles are active. The same flow works on Base mainnet after the June 25, 2026 Beryl activation.
Prerequisites
- A Chainstack account and a Base Sepolia node — see deploy a node. Copy the node’s HTTPS endpoint from its access and credentials.
- Base’s Foundry build (
base-forge,base-cast). Standardforgecan’t simulate the B20 precompiles locally and aborts withcall to non-contract address. - Some Base Sepolia ETH — see Base network faucets.
Step 1. Install Base’s Foundry build
base-forge installs alongside standard Foundry without overwriting it. Use base-forge and base-cast for the commands below.Step 2. Set up the project
base = true flag to foundry.toml, under [profile.default]. The base = true flag tells base-forge to run the B20 precompiles inside its local EVM, so the deploy script can simulate the factory call:
Step 3. Configure your Chainstack endpoint
Create a.env file in the project directory with your Chainstack Base Sepolia endpoint:
The command prints a non-zero balance. This account signs the deploy and the mint, and receives the minted supply.
Step 4. Write the create script
The factory’s single entry point iscreateB20(variant, salt, params, initCalls). Use B20FactoryLib to encode params and initCalls in the canonical form the precompile expects. Create script/CreateToken.s.sol:
Asset decimals are fixed at creation and must be in
[6, 18]. The supply cap is optional; the no-cap sentinel is type(uint128).max.Want a stablecoin instead?
Want a stablecoin instead?
Use the Roles, supply cap, minting, and verification work identically.
STABLECOIN variant and its params encoder. A stablecoin fixes decimals at 6 and carries an immutable ISO currency code (uppercase A–Z):Step 5. Deploy through your Chainstack node
0xB200…:
Step 6. Mint and verify
Minting requiresMINT_ROLE, which initCalls granted to your account:
The token holds minted supply on-chain. Search
$TOKEN_ADDRESS on sepolia.basescan.org to view it.Alternative: deploy directly with cast
Because your Chainstack Base node runs the B20 precompiles, you can create a basic token without base-forge — standard Foundry’s cast is enough, since the factory call executes on the node rather than in a local simulation:
The
cast path creates a minimal token (no roles or supply cap). To configure roles, the supply cap, and policies atomically at creation, use the base-forge script above with B20FactoryLib, which also guarantees the canonical encoding the precompile requires.What you built
In this tutorial you:- Created a B20 Asset token with a single
createB20call through your Chainstack Base node - Configured its admin, minter, and supply cap atomically with
initCalls - Minted supply and verified the balance on-chain
Next steps
- Learn the full standard in Base B20 token standard.
- Gate transfers or mints with policy registry allowlists and blocklists, add granular pause, or issue a stablecoin variant. See the B20 specification.