How tokens work on Solana
ERC20 is an interface. Each token deploys a contract that implements it and stores every holder’s balance in that contract. Solana takes the opposite approach: the Token Program is deployed once, and it stores each token and each balance in separate accounts.On Ethereum, an ERC20 contract holds every balance.
On Solana, the Token Program keeps each balance in its own account.
Three account types replace the contract:- A mint account represents one token. Its address, the mint address, identifies the token the way a contract address does on Ethereum. It stores the supply, the decimals, and the mint and freeze authorities.
- A token account holds one owner’s balance of one mint.
- An associated token account (ATA) is a token account at an address derived from the owner, the mint, and the mint’s token program, so anyone can compute where a wallet holds a given token.
Create a token
You create a token by sending transactions to the Token Program. You write no contract and deploy nothing. With thespl-token CLI, three commands create a
mint, create your token account, and mint 100 tokens:
Terminal
| Step | Ethereum (ERC20) | Solana (Token Program) |
|---|---|---|
| Write the token | Write or import a Solidity contract, often from OpenZeppelin. | Nothing to write. The Token Program is already deployed. |
| Deploy | Compile and deploy the contract. The contract address identifies the token. | Create a mint account. The mint address identifies the token. |
| Mint supply | Call the constructor or a mint function. | The mint authority sends a mint instruction to a token account. |
| Receive | Any address can hold a balance in the contract’s storage. | The recipient needs a token account for the mint. The sender can create it in the same transaction. |
| Change behavior | Upgrade through a proxy or deploy a new contract. | Enable extensions when you create the mint, or write a separate program. |
| Audit | Each token contract needs its own review. | Every token runs one of two audited token programs. A transfer hook program is custom code and needs its own review. |
ERC20 functions on Solana
Each ERC20 function maps to a field you read from an account or an instruction you send to the Token Program.| ERC20 | Solana | How it maps |
|---|---|---|
name(), symbol() | Token metadata | Read the name and symbol from the token’s metadata, stored in a Metaplex metadata account or on the mint with the metadata extension. |
decimals() | Mint account field | Read decimals from the mint account. |
totalSupply() | Mint account field | Read supply from the mint account. |
balanceOf() | Token account amount | Derive the owner’s associated token account for the mint and read its amount. A missing account means a balance of 0. To include other token accounts the owner holds, use getTokenAccountsByOwner. |
transfer() | TransferChecked | Move tokens between two token accounts of the same mint. The owner signs. |
approve() | ApproveChecked | Set one delegate and a delegated amount on a token account. |
transferFrom() | TransferChecked signed by the delegate | The delegate signs the same transfer instruction and spends from its delegated amount. |
allowance() | Token account fields | Read delegate and delegated_amount from the token account. |
Read token data
ERC20 view functions become account reads. Fetch the mint account for the decimals and supply, and fetch the owner’s associated token account for the balance. This example uses@solana/kit and @solana-program/token with a mint
under the original Token Program. For a Token Extensions mint, pass that
program’s address as tokenProgram. The mint account’s owner tells you which
program it uses.
Transfer tokens
A transfer moves tokens from the sender’s token account to the recipient’s token account. Both accounts must exist, so a transfer to a new holder usually carries two instructions in one transaction.1
Derive the token accounts
Compute the sender’s and recipient’s associated token accounts from each owner
and the mint.
2
Create the recipient's account
Add an idempotent create instruction. It does nothing if the account exists. If
it does not, the payer funds the rent deposit, a refundable SOL balance that
pays for the account’s storage.
3
Transfer
Add
TransferChecked, which verifies the mint and decimals before it moves
tokens.4
Send one transaction
Both instructions succeed or fail together.
Amounts are in base unitsInstructions take integer amounts in the token’s smallest unit. For a mint with
6 decimals, 1 token is
1_000_000n. See Transfer
tokens for the code that signs
and sends the transaction.Approvals and delegates
Solana has an approval model, and you need it less often. An ERC20 flow such as a swap takes anapprove transaction followed by a call that runs
transferFrom. On Solana, the user signs the transaction that calls the
program, and that signature lets the program transfer from the user’s token
account in the same transaction, so most flows need no standing allowance.
When another address must spend later, for example a subscription or an escrow,
approve it as a delegate:
ERC20 allowance
- One allowance per owner and spender, with any number of spenders.
- Stored in the token contract.
- Unlimited approvals are common and stay active until revoked.
Solana delegate
- One delegate and one delegated amount per token account.
- Stored on the token account.
- A new approval replaces the previous delegate and amount.
Revoke instruction. If a
program needs custody across several users, hold the tokens in a token account
owned by a program-derived address (PDA), an address that only the program can
sign for, instead of collecting delegations.
Beyond ERC20: Token Extensions
ERC20 projects add features by editing the contract. On Solana, the Token Extensions Program ships common features as options you enable on a mint:Metadata
Store the name, symbol, and URI on the mint itself.
Transfer fees
Withhold a fee on every transfer.
Transfer hook
Call your own program on every transfer to enforce custom rules.
Permanent delegate
Give one authority the right to transfer or burn from any account of the mint.
Pausable
Let an authority pause transfers, minting, and burning for the mint.
Non-transferable
Issue tokens that holders cannot move.
Choose extensions before you create the mintMost extensions cannot be added after an account is initialized. Decide which
ones the token needs up front.
Tradeoffs
ERC20: A contract per token
- Each token can change any behavior in its own code.
- Integrators must check that each contract follows the interface.
- Every new token is a deployment, and custom logic needs an audit.
- Indexing all tokens means tracking many contracts.
Token Program: Shared programs for every token
- Tokens share one instruction set, so a basic integration works with any mint.
- A new token is a transaction, not a deployment.
- Custom behavior is limited to extensions or a separate program. Integrators check which extensions a mint uses, because transfer fees, transfer hooks, and a permanent delegate change how transfers behave.
- Each holder needs a token account per mint, funded with a rent deposit.