diff --git a/tron/README.md b/tron/README.md new file mode 100644 index 0000000..a6ef4ef --- /dev/null +++ b/tron/README.md @@ -0,0 +1,31 @@ +--- +namespace-identifier: tron +title: TRON Ecosystem +author: Daniel Rocha (@danroc) +status: Draft +type: Informational +created: 2025-07-15 +requires: + - CAIP-2 +--- + +# Namespace for TRON chains + +This document describes the syntax and structure of the [TRON] namespace. + +## Syntax + +The namespace "tron" refers to the TRON blockchain and its testnets. + +## References + +- [TRON Website][TRON] +- [TRON API documentation][API] + +## Copyright + +Copyright and related rights waived via [CC0]. + +[TRON]: https://tron.network/ +[API]: https://developers.tron.network/reference/ +[CC0]: https://creativecommons.org/publicdomain/zero/1.0/ diff --git a/tron/caip2.md b/tron/caip2.md new file mode 100644 index 0000000..13cf9c3 --- /dev/null +++ b/tron/caip2.md @@ -0,0 +1,95 @@ +--- +namespace-identifier: tron-caip2 +title: TRON Namespace – Chains +author: Daniel Rocha (@danroc) +status: Draft +type: Standard +created: 2025-07-15 +requires: + - CAIP-2 +--- + +# CAIP-2 + +*For context, see the [CAIP-2] specification.* + +## Rationale + +In the TRON ecosystem, chain IDs uniquely identify each network. +They are derived from the genesis block hash, as specified in [TIP-474]. + +## Syntax + +A [CAIP-2] chain ID for a TRON network uses the `tron` namespace, and the reference portion is the decimal representation of the value returned by the [`eth_chainId`] RPC method. + +In TRON, the RPC’s `eth_chainId` response is defined as the last four bytes of the longer native Tron genesis block hash (see [TIP-474]). +As a 32-bit value, this shorter, EVM-compatible form ranges from `0x00000000` through `0xFFFFFFFF`. + +A full TRON CAIP-2 chain ID has the form: + +```text +tron: +``` + +## Resolution Mechanics + +To obtain the chain ID, send an `eth_chainId` JSON-RPC request to a TRON node: + +```json5 +// Request +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_chainId", + "params": [] +} + +// Response +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x2b6653dc" +} +``` + +The `result` field is a hexadecimal string. Convert it to a base-10 integer to obtain the CAIP-2 reference: + +```text +0x2b6653dc → 728126428 +``` + +Thus, the Mainnet CAIP-2 chain ID becomes: + +```text +tron:728126428 +``` + +## Test Cases + +Here are some common TRON networks and their CAIP-2 chain IDs: + +```text +# TRON Mainnet +tron:728126428 + +# TRON Testnet – Shasta +tron:2494104990 + +# TRON Testnet – Nile +tron:3448148188 +``` + +## References + +- [CAIP-2]: CAIP-2 Specification +- [TIP-474]: TRON Improvement Proposal for chain-ID generation +- [`eth_chainId`]: TRON JSON-RPC method documentation + +## Copyright + +All rights waived via [CC0]. + +[CAIP-2]: https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-2.md +[TIP-474]: https://github.com/tronprotocol/tips/blob/master/tip-474.md +[`eth_chainId`]: https://developers.tron.network/reference/eth_chainid +[CC0]: https://creativecommons.org/publicdomain/zero/1.0/