Add Tron namespace with CAIP-2 and CAIP-10 specifications#170
Add Tron namespace with CAIP-2 and CAIP-10 specifications#170riveign wants to merge 10 commits intoChainAgnostic:mainfrom
Conversation
- Add tron/ namespace directory with comprehensive documentation - Implement CAIP-2 blockchain ID specification using hexadecimal chain IDs - Implement CAIP-10 account ID specification for Base58Check addresses - Include test cases for Mainnet (0x2b6653dc), Shasta (0xcd8690dc), and Nile (0x94a9059e) - Document resolution methods using eth_chainId JSON-RPC - Follow TIP-474 standard for chain ID derivation from genesis block Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
85d5f7a to
a058588
Compare
|
Whoops, sorry, did you notice #162 ? |
|
|
||
| - **Mainnet**: `https://api.trongrid.io/jsonrpc` | ||
| - **Shasta**: `https://api.shasta.trongrid.io/jsonrpc` | ||
| - **Nile**: `https://nile.trongrid.io/jsonrpc` |
There was a problem hiding this comment.
It might be good to link here to some canonical, authoritative, and/or Foundation-funded source for RPC and chainId information, as these examples will probably be out of date in a year or three?
| 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 |
There was a problem hiding this comment.
but doesn't eth_chainId take integers (1), not bytestrings (0x01)?
|
|
||
| ### Reference Definition | ||
|
|
||
| The reference format for Tron chains uses the hexadecimal representation of the chain ID, prefixed with `0x`. |
There was a problem hiding this comment.
I'm not understanding the 0x prefix: even though it's derived from a bytestring (the genesis hash), it still seems to me like the basic type is integer, not bytestring? Note also that #162 , which was approved but not merged before this PR was opened, went the integer root, which seems more ergonomic to me (if nothing else because it's shorter and easier to validate)
| namespace-identifier: tron-caip10 | ||
| title: Tron Namespace - Account ID Specification | ||
| author: WalletConnect Team | ||
| discussions-to: https://github.com/ChainAgnostic/namespaces/pull/XXX |
There was a problem hiding this comment.
| discussions-to: https://github.com/ChainAgnostic/namespaces/pull/XXX | |
| discussions-to: https://github.com/ChainAgnostic/namespaces/pull/170 |
bumblefudge
left a comment
There was a problem hiding this comment.
Hey! Despite all the nitpicky comments above, I am super grateful for this very thorough and explicit PR, I wish all the namespaces were this detailed.
The little things are little things, but there is one thing really blocking me from closing #162 as redundant (for being less detailed), adding its author (@danroc ) to the author list here, and merging this: the CAIP-2 0x prefix. Between the weakly-held argument made inline and CASA's first-over-the-pole policy when contributors disagree about aesthetics, I tend to prefer the terser expression, but happy to hear arguments in favor of the 0x?
|
Hey @bumblefudge, thanks for the ping. I left CAIP-10 out of the PR because I wasn’t sure whether I should cover We used the integer format since it seems to be the most common and matches what we do in other namespaces (like On the level of detail, I tried to keep the spec pretty minimal. Happy to add more if needed, and I’ll keep that in mind next time! |
obstropolos
left a comment
There was a problem hiding this comment.
A few changes + @bumblefudge 's requests still outstanding. Thanks for submitting this so far!
|
@bumblefudge, if we’re favoring this PR over #162, can we use integer representations for the chain IDs? |
basically waiting on OP ( @riveign ) to consent to this proposal before merging :D |
|
Taking @riveign 's silence as consent, but happy to PR post-facto! |
It seems the integer format is now standard in TRONland and the genesis hash is deprecated actually: https://github.com/tronprotocol/tips/blob/master/tip-474.md The MetaMask PR from July matches the new integer convention-- seems like MM and WC should be aligned on this! |
|
Hey @bumblefudge @danroc apologies for the delay here,picking this up now. To give some context on the hex format: we had discussed this directly with the Tron team when scoping the namespace spec, and they aligned on using hex chain IDs at the time. That's why the PR was submitted this way. That said, we can see the ecosystem is clearly converging on integer format. We've reached out to the Tron team to get their final confirmation on switching to decimals. Once we hear back, we'll either update this PR to use integer chain IDs or keep the current format based on their input. Will follow up here as soon as we have their response. Thanks for your patience! |
|
Thanks @riveign! Hopefully, they are okay with the decimals. We couldn't wait until my PR got merged to release, and we already have a big number of TRON accounts using the decimal chain IDs internally. |
|
Hey @bumblefudge @danroc — update on the chain ID format discussion. We checked with the Tron team and they've come back recommending we keep the hex format. Their main concern is that changing to integer would be a breaking change — there are existing integrations that already use hex chain IDs based on their documentation, and a format switch could introduce compatibility risks. So the path forward as we see it:
Let us know if there are concerns with this approach or if you see other alternatives, happy to address any remaining review comments and get this over the line once we agree on the path forward. |
Summary
This PR adds the Tron namespace to the Chain Agnostic Namespaces repository, implementing CAIP-2 (Blockchain ID) and CAIP-10 (Account ID) specifications.
Networks Supported
tron:0x2b6653dc)tron:0xcd8690dc)tron:0x94a9059e)Files Added
tron/README.md- Namespace overview and introductiontron/caip2.md- CAIP-2 blockchain ID specificationtron/caip10.md- CAIP-10 account ID specificationKey Features
eth_chainIdJSON-RPCReferences
Testing
All test cases have been included in the specification documents with valid and invalid examples.