Skip to main content

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 Cases for OP_20 Tokens

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?

Key Features of 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, deducting amount from your balance and crediting to.

  • approve(spender, amount)
    Records in state that spender may transfer up to amount tokens on your behalf.

  • transferFrom(from, to, amount)
    Allows spender (once approved) to move amount from from’s balance into to’s balance.

  • mint(to, amount) (if enabled)
    Increases totalSupply and assigns new tokens to to.

  • burn(amount) (if enabled)
    Destroys amount tokens from your balance and reduces totalSupply.

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 call transfer, 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:

  1. Granting Allowances

    • One‑Time Approval: You call approve(spender, amount) once to authorize a contract (e.g., a DEX) to spend up to amount of your tokens.
    • Seamless Interaction: After approval, you can execute multiple token transfers (swaps, staking, etc.) without repeating the approval step.
  2. 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.

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.