Introduction
What is OP-20
The OP-20 standard defines a comprehensive interface for fungible tokens on OP_NET, incorporating lessons learned from years of ERC-20 usage and billions of dollars in lost tokens. This standard introduces mandatory safe transfers with receiver validation, delta-based allowance modifications to prevent exploits, and signature-based approvals using Schnorr signatures.
Creating a New Standard
The ERC20 standard revolutionized blockchain tokens but revealed critical weaknesses through real-world usage:
- Billions in Lost Tokens: Users accidentally sending tokens to contracts that cannot process them.
- Front-Running Vulnerabilities: The approval race condition enabling double-spend attacks.
- Inefficient Data Retrieval: Multiple RPC calls needed for basic token information.
- Missing Features: No native burn, no receiver notifications.
OP-20 addresses these issues while introducing OP_NET specific optimizations:
- Contracts must acknowledge token transfers.
- Schnorr signature integration for cryptographic operations.
- Native support for the OP_NET memory model and storage pointers.
- Built-in domain separation using OP_NET's chain and protocol identifiers.
- Optimized for AssemblyScript/WebAssembly execution environment.
Comparison with ERC20
| Feature | ERC20 | OP-20 |
|---|---|---|
| Basic Transfers | ✓ | ✓ |
| Safe Transfers | ✗ | ✓ |
| Transfer Hooks | ✗ | ✓ |
| Approval Race Fix | ✗ | ✓ |
| Native Burn | ✗ | ✓ |
| Max Supply Enforcement | ✗ | ✓ |
| Unified Metadata | ✗ | ✓ |
| Signature Type | ECDSA | Schnorr | ML-DSA* |
| Replay Protection | External | Built-in |
| Zero Address Protection | External | Built-in |
*ML-DSA is will be used in the future once BIP-360 is implemented into bitcoin core.