How to Deploy an ERC-20 Token on Base Chain
Base is Coinbase's L2 chain — fast, cheap, and growing. Deploying a token costs less than $0.10 in gas. This guide walks you through every step.
What You'll Need
- A wallet with ETH on Base (even $1 is enough for deployment)
- Node.js 18+ installed
- Basic command line knowledge
Step 1: Write the Token Contract
Here's a minimal, production-ready ERC-20 token in Solidity:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
contract MyToken {
string public name;
string public symbol;
uint8 public constant decimals = 18;
uint256 public totalSupply;
mapping(address => uint256) public balanceOf;
mapping(address => mapping(address => uint256)) public allowance;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
constructor(uint256 _supply) {
name = "MyToken"; // Change this
symbol = "MTK"; // Change this
totalSupply = _supply;
balanceOf[msg.sender] = _supply;
emit Transfer(address(0), msg.sender, _supply);
}
function transfer(address to, uint256 amount) public returns (bool) {
require(balanceOf[msg.sender] >= amount, "Insufficient");
balanceOf[msg.sender] -= amount;
balanceOf[to] += amount;
emit Transfer(msg.sender, to, amount);
return true;
}
function approve(address spender, uint256 amount) public returns (bool) {
allowance[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
function transferFrom(address from, address to, uint256 amount) public returns (bool) {
require(balanceOf[from] >= amount, "Insufficient");
require(allowance[from][msg.sender] >= amount, "Not approved");
allowance[from][msg.sender] -= amount;
balanceOf[from] -= amount;
balanceOf[to] += amount;
emit Transfer(from, to, amount);
return true;
}
}
Customize
name and symbol in the constructor. Keep the supply reasonable — 1 billion (with 18 decimals) is standard for meme tokens.Step 2: Compile
npm install solc
npx solcjs --abi --bin MyToken.sol
This generates MyToken_sol_MyToken.abi and MyToken_sol_MyToken.bin.
Step 3: Deploy to Base
npm install ethers
// deploy.mjs
import { ethers } from 'ethers';
import fs from 'fs';
const provider = new ethers.JsonRpcProvider('https://mainnet.base.org');
const wallet = new ethers.Wallet('YOUR_PRIVATE_KEY', provider);
const abi = JSON.parse(fs.readFileSync('MyToken_sol_MyToken.abi', 'utf8'));
const bytecode = '0x' + fs.readFileSync('MyToken_sol_MyToken.bin', 'utf8');
const factory = new ethers.ContractFactory(abi, bytecode, wallet);
const supply = ethers.parseEther('1000000000'); // 1B tokens
const contract = await factory.deploy(supply, { gasLimit: 1000000n });
await contract.waitForDeployment();
console.log('Deployed:', await contract.getAddress());
Never commit your private key to git. Use environment variables or a .env file.
Step 4: Add Uniswap Liquidity
Your token needs a trading pair to be buyable. The Uniswap V2 Router on Base is at 0x4752ba5dbc23f44d87826276bf6fd6b1c372ad24.
// 1. Approve router to spend your tokens
await token.approve(ROUTER_ADDRESS, tokenAmount);
// 2. Add liquidity
await router.addLiquidityETH(
tokenAddress,
tokenAmount, // tokens to pair
0, // min tokens (set 0 for first add)
0, // min ETH (set 0 for first add)
yourAddress, // LP tokens go here
deadline,
{ value: ethAmount } // ETH to pair
);
The ratio of tokens-to-ETH determines the starting price. For example: 500M tokens + 0.002 ETH = each token starts at ~$0.000000007.
Step 5: Verify and Share
- View on BaseScan
- Trade link:
https://app.uniswap.org/swap?chain=base&outputCurrency=YOUR_ADDRESS - Share with your community!
Total Cost Breakdown
- Token deployment: ~$0.05-0.10
- Uniswap approval: ~$0.01
- Add liquidity: ~$0.05-0.10
- Total: ~$0.15-0.25
Don't Want to Code?
I'll deploy your custom token on Base in 5 minutes. From 0.005 ETH (~$9).
Get Your Token →Live Examples
Tokens I deployed using this exact process: