Token-2022
Token-2022¶
Token-2022 (also known as Token Extensions or SPL Token-2022) is an upgraded version of SPL Token, adding many new features and extension capabilities to provide more powerful and flexible functionality for Solana tokens.
Core Improvements¶
Backward Compatible Token-2022 is fully compatible with the original SPL Token: - Existing programs can seamlessly support it - Same base interface - Optional extension features
Modular Design Features are added as Extensions: - Enable features on demand - Reduced complexity - Flexible combinations
Key Extensions¶
1. Transfer Fees Automatically collect fees on token transfers: - Set fee percentage - Fees go to the token creator - Suitable for revenue-sharing scenarios
2. Transfer Hooks Execute custom logic before/after transfers: - Call external programs - Implement complex transfer rules - Compliance checks
Use cases: - KYC/AML verification - Blacklist/whitelist - Automatic tax processing
3. Confidential Transfers Hide transfer amounts: - Uses zero-knowledge proofs - Protects financial privacy - Validity still verifiable
4. Permanent Delegate Designate a permanent delegate: - Can transfer tokens under any circumstances - Used for regulatory compliance - Emergency recovery mechanism
5. Interest-Bearing Tokens Token balances automatically grow over time: - On-chain interest calculation - No manual distribution needed - Suitable for deposit certificates, bonds, etc.
6. Metadata Extension Store metadata directly in the Mint account: - Name, symbol, URI - No additional accounts needed - Reduced cost
7. Default Account State Default state for new Token accounts: - Can be set to frozen state - Requires KYC before unfreezing - Compliance tool
8. Non-Transferable Tokens Tokens that cannot be transferred after creation: - Soulbound tokens - Membership credentials - Achievement badges
9. Memo Required Transfers must include a memo: - Compliance requirement - Additional transfer information - Audit trail
10. CPI Guard Prevents cross-program invocations from stealing tokens: - Enhanced security - Prevents certain attack vectors
Usage Examples¶
Creating a Token with Transfer Fees
spl-token create-token --program-id TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb --enable-transfer-fee --transfer-fee-basis-points 100 --max-transfer-fee 10000000
Enabling Metadata Extension
Program ID¶
Token-2022 uses a different program ID:
Original SPL Token:
Adoption Status¶
Advantages - Rich feature set - Official support - Continuous updates
Challenges - Ecosystem adoption takes time - Wallets and DApps need updates - Some features still in testing
Comparison with SPL Token¶
| Feature | SPL Token | Token-2022 |
|---|---|---|
| Basic Features | Yes | Yes |
| Transfer Fees | No | Yes |
| Transfer Hooks | No | Yes |
| Confidential Transfers | No | Yes |
| Metadata | External | Built-in |
| Interest | No | Yes |
Future Development¶
More Extensions The Solana team continues to add new extension features.
Ecosystem Integration Mainstream wallets, DEXes, and DeFi protocols are gradually integrating.
Standardization Becoming the new standard for Solana tokens.
Related Concepts¶
- SPL Token: The original Solana token standard
- Extensions: Modular feature enhancements
- Zero-Knowledge Proofs: Technical foundation for confidential transfers
- Compliance: Some extensions are designed specifically for compliance