-
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?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
|
|
||
| ## Backwards Compatibility | ||
|
|
||
| Prior to TIP-474, Tron did not have a standardized chain ID mechanism for cross-chain identification. |
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.
| Prior to TIP-474, Tron did not have a standardized chain ID mechanism for cross-chain identification. | |
| Prior to [TIP-474], Tron did not have a standardized chain ID mechanism for cross-chain 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 |
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_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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| discussions-to: https://github.com/ChainAgnostic/namespaces/pull/XXX | |
| discussions-to: https://github.com/ChainAgnostic/namespaces/pull/170 |
| --- | ||
| namespace-identifier: tron-caip10 | ||
| title: Tron Namespace - Account ID Specification | ||
| author: WalletConnect Team |
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.
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!
bumblefudge
left a comment
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.
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! |
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.