-
Notifications
You must be signed in to change notification settings - Fork 94
Add Tron namespace with CAIP-2 and CAIP-10 specifications #170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| --- | ||
| namespace-identifier: tron | ||
| title: Tron Ecosystem | ||
| author: WalletConnect Team | ||
| status: Draft | ||
| type: Informational | ||
| created: 2026-01-27 | ||
| --- | ||
|
|
||
| # Namespace for Tron Chains | ||
|
|
||
| This document describes the syntax and structure of the Tron namespace. | ||
| Tron is a decentralized blockchain platform that utilizes Delegated Proof of Stake (DPoS) consensus and features the Tron Virtual Machine (TVM), which is compatible with the Ethereum Virtual Machine (EVM). | ||
|
|
||
| ## Introduction | ||
|
|
||
| Tron is a blockchain-based decentralized platform founded in 2017 that aims to build a free, global digital content entertainment system utilizing blockchain and distributed storage technology. | ||
| The Tron network supports smart contracts through its TVM (Tron Virtual Machine) and provides high throughput with approximately 2,000 transactions per second and 3-second block times. | ||
|
|
||
| The Tron ecosystem includes: | ||
| - **Mainnet**: Production network for live applications | ||
| - **Shasta Testnet**: Testing environment compatible with mainnet parameters | ||
| - **Nile Testnet**: Bleeding-edge testing network for new features | ||
|
|
||
| ## Blockchain Identification | ||
|
|
||
| Tron chains are identified using hexadecimal chain IDs derived from the last 4 bytes of their genesis block hashes, as specified in TIP-474. | ||
| This approach provides: | ||
| - Deterministic chain identification from genesis block | ||
| - Compatibility with EVM tooling through `eth_chainId` method | ||
| - Replay protection across networks | ||
| - Integration with existing blockchain infrastructure | ||
|
|
||
| ## Token Standards | ||
|
|
||
| Tron supports multiple token standards: | ||
| - **TRC-20**: Fungible token standard (similar to ERC-20) | ||
| - **TRC-10**: Native token standard with lower transaction costs | ||
| - **TRC-721**: Non-fungible token (NFT) standard | ||
|
|
||
| ## Address Format | ||
|
|
||
| Tron uses Base58Check encoding for addresses: | ||
| - All addresses start with the letter `T` | ||
| - Addresses are exactly 34 characters long | ||
| - Example: `TNPeeaaFB7K9cmo4uQpcU32zGK8G1NYqeL` | ||
|
|
||
| ## Network Information | ||
|
|
||
| ### Mainnet | ||
| - **RPC Endpoint**: `https://api.trongrid.io` | ||
| - **JSON-RPC Endpoint**: `https://api.trongrid.io/jsonrpc` | ||
| - **Explorer**: `https://tronscan.org` | ||
| - **Native Currency**: TRX (6 decimals, 1 TRX = 1,000,000 SUN) | ||
|
|
||
| ### Shasta Testnet | ||
| - **RPC Endpoint**: `https://api.shasta.trongrid.io` | ||
| - **JSON-RPC Endpoint**: `https://api.shasta.trongrid.io/jsonrpc` | ||
| - **Explorer**: `https://shasta.tronscan.org` | ||
| - **Faucet**: Available at https://www.trongrid.io/shasta | ||
|
|
||
| ### Nile Testnet | ||
| - **RPC Endpoint**: `https://nile.trongrid.io` | ||
| - **JSON-RPC Endpoint**: `https://nile.trongrid.io/jsonrpc` | ||
| - **Explorer**: `https://nile.tronscan.org` | ||
|
|
||
| ## References | ||
|
|
||
| - [Tron Developer Hub][]: Official Tron development documentation | ||
| - [TIP-474][]: Tron Improvement Proposal specifying chain ID derivation | ||
| - [TronGrid][]: Official Tron API service | ||
| - [TronWeb][]: JavaScript SDK for Tron blockchain | ||
| - [Tronscan][]: Tron blockchain explorer | ||
|
|
||
| [Tron Developer Hub]: https://developers.tron.network/ | ||
| [TIP-474]: https://github.com/tronprotocol/tips/blob/master/tip-474.md | ||
| [TronGrid]: https://www.trongrid.io/ | ||
| [TronWeb]: https://tronweb.network/ | ||
| [Tronscan]: https://tronscan.org/ | ||
| [CAIP-2]: https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-2.md | ||
| [CAIP-10]: https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-10.md | ||
|
|
||
| ## Rights | ||
|
|
||
| Copyright and related rights waived via CC0. | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,189 @@ | ||||||
| --- | ||||||
| namespace-identifier: tron-caip10 | ||||||
| title: Tron Namespace - Account ID Specification | ||||||
| author: WalletConnect Team | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are you trying to tell me WC has a no airdrop-farming policy now? Put one or more github handles in here of the specific people who did this fine work! |
||||||
| discussions-to: https://github.com/ChainAgnostic/namespaces/pull/XXX | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| status: Draft | ||||||
| type: Standard | ||||||
| created: 2026-01-27 | ||||||
| requires: ["CAIP-2", "CAIP-10"] | ||||||
| --- | ||||||
|
|
||||||
| # CAIP-10 | ||||||
|
|
||||||
| *For context, see the [CAIP-10][] specification.* | ||||||
|
|
||||||
| ## Rationale | ||||||
|
|
||||||
| Tron addresses use Base58Check encoding and are derived from ECDSA public keys using the secp256k1 curve (same as Ethereum). | ||||||
| All Tron addresses: | ||||||
| - Start with the letter `T` (due to the `0x41` address prefix) | ||||||
| - Are exactly 34 characters in length | ||||||
| - Include a 4-byte checksum for error detection | ||||||
| - Are case-sensitive | ||||||
|
|
||||||
| The address format provides both human readability and built-in validation through the checksum mechanism. | ||||||
|
|
||||||
| ## Syntax | ||||||
|
|
||||||
| The syntax of a Tron address follows Base58Check encoding with the following constraints: | ||||||
|
|
||||||
| **Regular Expression**: `^T[1-9A-HJ-NP-Za-km-z]{33}$` | ||||||
|
|
||||||
| Where: | ||||||
| - First character is always `T` | ||||||
| - Remaining 33 characters use Base58 alphabet (excluding 0, O, I, l) | ||||||
| - Total length is exactly 34 characters | ||||||
|
|
||||||
| ### Address Generation | ||||||
|
|
||||||
| Tron addresses are generated through the following process: | ||||||
| 1. Generate ECDSA key pair using secp256k1 curve | ||||||
| 2. Extract 64-byte public key | ||||||
| 3. Hash with Keccak256 (SHA3) | ||||||
| 4. Take last 20 bytes of hash | ||||||
| 5. Prepend address prefix byte `0x41` | ||||||
| 6. Double SHA256 hash and append first 4 bytes as checksum | ||||||
| 7. Base58 encode the result | ||||||
|
|
||||||
| ## Chain IDs | ||||||
|
|
||||||
| *For context, see the [CAIP-2][] specification.* | ||||||
|
|
||||||
| | Network | Chain ID (Hex) | Chain ID (CAIP-2) | | ||||||
| |----------------|----------------|--------------------| | ||||||
| | Mainnet | `0x2b6653dc` | `tron:0x2b6653dc` | | ||||||
| | Shasta Testnet | `0xcd8690dc` | `tron:0xcd8690dc` | | ||||||
| | Nile Testnet | `0x94a9059e` | `tron:0x94a9059e` | | ||||||
|
|
||||||
| ## Test Cases | ||||||
|
|
||||||
| This is a list of manually composed and validated examples: | ||||||
|
|
||||||
| ```bash | ||||||
| # Tron Mainnet - Standard account address | ||||||
| tron:0x2b6653dc:TNPeeaaFB7K9cmo4uQpcU32zGK8G1NYqeL | ||||||
|
|
||||||
| # Tron Mainnet - USDT TRC-20 contract address | ||||||
| tron:0x2b6653dc:TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t | ||||||
|
|
||||||
| # Tron Shasta Testnet | ||||||
| tron:0xcd8690dc:TQQg4EL8o1BSeKJY4MJ8TB8XK7xufxFBvK | ||||||
|
|
||||||
| # Tron Nile Testnet | ||||||
| tron:0x94a9059e:TLyqzVGLV1srkB7dToTAEqgDSfPtXRJZYH | ||||||
| ``` | ||||||
|
|
||||||
| ## Address Validation | ||||||
|
|
||||||
| ### Valid Address Examples | ||||||
|
|
||||||
| ``` | ||||||
| TNPeeaaFB7K9cmo4uQpcU32zGK8G1NYqeL ✓ Valid mainnet address | ||||||
| TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t ✓ Valid mainnet address (USDT contract) | ||||||
| TLyqzVGLV1srkB7dToTAEqgDSfPtXRJZYH ✓ Valid address | ||||||
| ``` | ||||||
|
|
||||||
| ### Invalid Address Examples | ||||||
|
|
||||||
| ``` | ||||||
| tNPeeaaFB7K9cmo4uQpcU32zGK8G1NYqeL ✗ Lowercase 't' (must be uppercase 'T') | ||||||
| TNPeeaaFB7K9cmo4uQpcU32zGK8G1NYq ✗ Too short (33 characters) | ||||||
| TNPeeaaFB7K9cmo4uQpcU32zGK8G1NYqeLL ✗ Too long (35 characters) | ||||||
| 0x742d35Cc6634C0532925a3b844Bc9e759 ✗ Hex format (not Base58Check) | ||||||
| ``` | ||||||
|
|
||||||
| ## Account Types | ||||||
|
|
||||||
| Tron supports two types of accounts: | ||||||
|
|
||||||
| 1. **Externally Owned Account (EOA)**: | ||||||
| - Controlled by private key | ||||||
| - Can initiate transactions | ||||||
| - Example: `TNPeeaaFB7K9cmo4uQpcU32zGK8G1NYqeL` | ||||||
|
|
||||||
| 2. **Contract Account**: | ||||||
| - Smart contract address | ||||||
| - No private key | ||||||
| - Can only respond to transactions | ||||||
| - Example: `TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t` (USDT TRC-20) | ||||||
|
|
||||||
| Both account types use the same address format and are indistinguishable at the address level. | ||||||
|
|
||||||
| ## Backwards Compatibility | ||||||
|
|
||||||
| Tron's address format has remained consistent since mainnet launch. | ||||||
| All existing addresses are compatible with the CAIP-10 specification. | ||||||
|
|
||||||
| ## Additional Considerations | ||||||
|
|
||||||
| ### Checksum Validation | ||||||
|
|
||||||
| The Base58Check encoding includes a 4-byte checksum that should be validated when accepting addresses. | ||||||
| Invalid checksums indicate: | ||||||
| - Typographical errors in address entry | ||||||
| - Data corruption | ||||||
| - Invalid address generation | ||||||
|
|
||||||
| ### Address Activation | ||||||
|
|
||||||
| Tron addresses must be activated by receiving TRX or TRC-10 tokens before they appear on-chain. | ||||||
| Unactivated addresses: | ||||||
| - Are valid addresses (correct format and checksum) | ||||||
| - Do not appear in blockchain state queries | ||||||
| - Will be created upon receiving first transaction | ||||||
|
|
||||||
| ### Multi-signature Addresses | ||||||
|
|
||||||
| Tron supports multi-signature accounts with the same address format. | ||||||
| Multi-sig addresses cannot be distinguished from regular addresses without querying account permissions on-chain. | ||||||
|
|
||||||
| ## Resolution Method | ||||||
|
|
||||||
| To verify an address exists on-chain, make a JSON-RPC request using Tron's native RPC methods: | ||||||
|
|
||||||
| ```jsonc | ||||||
| // Request - Get account balance | ||||||
| { | ||||||
| "jsonrpc": "2.0", | ||||||
| "method": "tron_getBalance", | ||||||
| "params": { | ||||||
| "address": "TNPeeaaFB7K9cmo4uQpcU32zGK8G1NYqeL" | ||||||
| }, | ||||||
| "id": 1 | ||||||
| } | ||||||
|
|
||||||
| // Response | ||||||
| { | ||||||
| "jsonrpc": "2.0", | ||||||
| "result": { | ||||||
| "balance": "1000000000" | ||||||
| }, | ||||||
| "id": 1 | ||||||
| } | ||||||
| ``` | ||||||
|
|
||||||
| Alternatively, using Tron's native HTTP API: | ||||||
|
|
||||||
| ```bash | ||||||
| curl -X POST https://api.trongrid.io/wallet/getaccount \ | ||||||
| -d '{"address":"TNPeeaaFB7K9cmo4uQpcU32zGK8G1NYqeL","visible":true}' | ||||||
| ``` | ||||||
|
|
||||||
| ## References | ||||||
|
|
||||||
| - [CAIP-10][]: Account ID Specification | ||||||
| - [CAIP-2][]: Chain ID Specification | ||||||
| - [Tron Developer Hub - Accounts][]: Official account documentation | ||||||
| - [Tron Address Format][]: Technical specification for address generation | ||||||
| - [Base58Check Encoding][]: Bitcoin Base58Check encoding specification | ||||||
|
|
||||||
| [CAIP-2]: https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-2.md | ||||||
| [CAIP-10]: https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-10.md | ||||||
| [Tron Developer Hub - Accounts]: https://developers.tron.network/docs/account | ||||||
| [Tron Address Format]: https://tronprotocol.github.io/documentation-en/mechanism-algorithm/account/ | ||||||
| [Base58Check Encoding]: https://en.bitcoin.it/wiki/Base58Check_encoding | ||||||
|
|
||||||
| ## Copyright | ||||||
|
|
||||||
| Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/). | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but doesn't
eth_chainIdtake integers (1), not bytestrings (0x01)?