|
| 1 | +--- |
| 2 | +namespace-identifier: aptos-caip2 |
| 3 | +title: Aptos Namespace - Chains |
| 4 | +author: Jon Tang <@jtang17> |
| 5 | +discussions-to: https://github.com/ChainAgnostic/namespaces/pull/169 |
| 6 | +status: Draft |
| 7 | +type: Standard |
| 8 | +created: 2025-12-12 |
| 9 | +updated: 2025-12-12 |
| 10 | +requires: CAIP-2 |
| 11 | +--- |
| 12 | + |
| 13 | +# CAIP-2 |
| 14 | + |
| 15 | +*For context, see the [CAIP-2][] specification.* |
| 16 | + |
| 17 | +## Rationale |
| 18 | + |
| 19 | +In CAIP-2 a general blockchain identification scheme is defined. This is the |
| 20 | +implementation of CAIP-2 for Aptos. Blockchains in the "aptos" namespace are |
| 21 | +identified by their numeric `chain_id`, assigned at genesis. Each network is |
| 22 | +maintained by a set of validators with its own REST API endpoints. These chain |
| 23 | +IDs require no transformations to be used as conformant CAIP-2 references. |
| 24 | + |
| 25 | +## Syntax |
| 26 | + |
| 27 | +The namespace "aptos" refers to the Aptos open-source blockchain platform. |
| 28 | + |
| 29 | +### Reference Definition |
| 30 | + |
| 31 | +The definition for this namespace will use the `chain_id` as an identifier |
| 32 | +for different Aptos chains. The chain ID is a positive integer assigned at |
| 33 | +genesis: |
| 34 | + |
| 35 | +| Network | Chain ID | |
| 36 | +|---------|----------| |
| 37 | +| Mainnet | 1 | |
| 38 | +| Testnet | 2 | |
| 39 | + |
| 40 | +### Resolution Method |
| 41 | + |
| 42 | +To resolve a blockchain reference for the Aptos namespace, make an HTTP GET |
| 43 | +request to the [REST API][] of a fullnode, for example: |
| 44 | + |
| 45 | +```bash |
| 46 | +curl https://fullnode.mainnet.aptoslabs.com/v1 |
| 47 | +``` |
| 48 | + |
| 49 | +```jsonc |
| 50 | +// Response |
| 51 | +{ |
| 52 | + "chain_id": 1, |
| 53 | + "epoch": "5000", |
| 54 | + "ledger_version": "500000000", |
| 55 | + "oldest_ledger_version": "0", |
| 56 | + "ledger_timestamp": "1700000000000000", |
| 57 | + "node_role": "full_node", |
| 58 | + "oldest_block_height": "0", |
| 59 | + "block_height": "100000000", |
| 60 | + "git_hash": "abc123..." |
| 61 | +} |
| 62 | +``` |
| 63 | + |
| 64 | +The response will return `chain_id` as an integer that can be used directly |
| 65 | +as the CAIP-2 reference. |
| 66 | + |
| 67 | +### Backwards Compatibility |
| 68 | + |
| 69 | +Not applicable |
| 70 | + |
| 71 | +## Test Cases |
| 72 | + |
| 73 | +This is a list of manually composed examples |
| 74 | + |
| 75 | +```bash |
| 76 | +# Aptos Mainnet |
| 77 | +aptos:1 |
| 78 | + |
| 79 | +# Aptos Testnet |
| 80 | +aptos:2 |
| 81 | + |
| 82 | +``` |
| 83 | + |
| 84 | +## References |
| 85 | + |
| 86 | +- [REST API][] - REST API reference in Aptos official documentation |
| 87 | +- [Aptos core][] rust crate on crates.io |
| 88 | +- [Networks][] - Aptos network information and endpoints |
| 89 | + |
| 90 | +[CAIP-2]: https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-2.md |
| 91 | +[REST API]: https://aptos.dev/en/network/nodes/aptos-api-spec |
| 92 | +[Aptos core]: https://crates.io/crates/aptos |
| 93 | +[Networks]: https://aptos.dev/en/network/nodes/networks |
| 94 | + |
| 95 | +## Copyright |
| 96 | + |
| 97 | +Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/). |
0 commit comments