OP_20 Standard
Introduction
The OP_20 ( OP_NET's equivalent to Ethereum’s ERC-20 ) standard brings the familiar power of fungible tokens to Bitcoin. With OP_20, you can:
- Mint and manage tokens natively in satoshis, without wrapping BTC or relying on sidechains.
- Transfer and approve token operations (e.g.,
transfer,approve,transferFrom) just like in Ethereum. - Build DeFi, stablecoins, and loyalty systems on top of Bitcoin’s security.
Use OP_20 for applications such as:
- Stablecoins pegged to real‑world assets
- Reward and loyalty programs
- Decentralized exchanges, lending platforms, and other DeFi protocols
Why OP_20?
- Fungible & Interchangeable
Every OP_20 token unit is identical. Perfect for currencies, stablecoins, or any use case where you need equal value tokens. - Bitcoin-Native Security
OP_20 lives on Bitcoin’s base layer, so you get all of Bitcoin’s proven security and full compatibility with existing wallets and infrastructure. - Low Fees
All gas fees are paid in satoshis, making transaction costs easy to estimate and generally very low. - Flexible Controls
Built‑in support for minting new tokens, burning supply when needed, and setting allowances for trusted third parties.
How OP_20 Works
1. Contract Deployment
You deploy an OP_20 token contract as a Tapscript (P2OP) output on Bitcoin. That script encodes your token’s core parameters:
- Token Name – A human‑readable string (e.g. “MyToken”).
- Symbol – A short ticker (e.g. “BTC”).
- Total Supply – The maximum number of tokens ever mintable.
Behind the scenes, the contract’s Wasm logic initializes a key/value store in the UTXO, writing these values into contract state.
2. Token Interactions
Once deployed, your contract exposes standard methods exactly like ERC‑20:
-
transfer(to, amount)
Creates a new UTXO under your token’s P2OP address, deductingamountfrom your balance and creditingto. -
approve(spender, amount)
Records in state thatspendermay transfer up toamounttokens on your behalf. -
transferFrom(from, to, amount)
Allowsspender(once approved) to moveamountfromfrom’s balance intoto’s balance. -
mint(to, amount)(if enabled)
IncreasestotalSupplyand assigns new tokens toto. -
burn(amount)(if enabled)
Destroysamounttokens from your balance and reducestotalSupply.
Each method call runs off‑chain in the OP_NET VM, then commits state updates as a set of UTXOs in a normal Bitcoin transaction.
3. Gas Fees & UTXO Model
-
Fees in Satoshis
Every OP_20 call is just a Bitcoin transaction under the hood, so you pay transaction fees in satoshis per byte. -
UTXO Efficiency
Instead of a global ledger, OP_20 stores token balances and allowances inside UTXOs.
When you calltransfer, the VM reads your UTXO state, updates balances, and outputs new UTXOs reflecting the changes—minimizing on‑chain data and benefiting from parallel validation. -
Priority & Congestion
You can add a higher fee-per-byte to your transaction to get faster inclusion during busy periods, just like a regular Bitcoin tx.
Advantages of OP_20
1. Bitcoin’s Security
By building on Bitcoin’s base layer, OP_20 tokens inherit the security and decentralization of Bitcoin.
2. Flexibility
OP_20 tokens can be customized to fit various use cases, from stablecoins to loyalty points.
3. Compatibility
OP_20 is designed to work seamlessly with Bitcoin wallets, dApps, and infrastructure.
Permission System
OP_20’s permission model follows familiar ERC‑20 patterns to balance usability and security:
-
Granting Allowances
- One‑Time Approval: You call
approve(spender, amount)once to authorize a contract (e.g., a DEX) to spend up toamountof your tokens. - Seamless Interaction: After approval, you can execute multiple token transfers (swaps, staking, etc.) without repeating the approval step.
- One‑Time Approval: You call
-
Revoking Allowances
- Full Control: At any point, call
approve(spender, 0)to revoke a spender’s permission. - Security Best Practice: Periodically review and revoke unused approvals to minimize risk.
- Full Control: At any point, call
Future Enhancements
We’re making OP_20 even easier and more powerful:
-
Approve & Transfer in One Step
Soon you’ll be able to give permission and send tokens in a single click—no extra confirmations. -
Simplified Wallet Experience
Wallets will offer one‑button approval and revocation, so you spend less time managing settings. -
Smoother DeFi Interactions
For things like swaps or liquidity pools, you’ll enjoy faster, seamless token moves without juggling multiple transactions.
Unified Account Integration
OP_NET’s unified account system ensures that tokens can be managed using a single public key, simplifying asset management.
For more information, refer to Unified Accounts.