|
| 1 | +--- |
| 2 | +namespace-identifier: sui-caip2 |
| 3 | +title: Sui Namespace - Chains |
| 4 | +author: William Robertson (@williamrobertson13) |
| 5 | +discussions-to: https://github.com/ChainAgnostic/namespaces/pull/146 |
| 6 | +status: Draft |
| 7 | +type: Informational |
| 8 | +created: 2025-06-18 |
| 9 | +updated: 2025-06-18 |
| 10 | +--- |
| 11 | + |
| 12 | +# CAIP-2 |
| 13 | + |
| 14 | +_For context, see the [CAIP-2][] specification._ |
| 15 | + |
| 16 | +## Introduction |
| 17 | + |
| 18 | +The Sui namespace in CAIP-2 uses human-readable chain identifiers — such as `mainnet`, `testnet`, and `devnet` — to identify specific Sui networks. These identifiers are **stable**, **concise**, and **easy to communicate**, and can be resolved to a unique genesis checkpoint digest through a supported Sui RPC interface. |
| 19 | + |
| 20 | +This design provides both developer ergonomics and cryptographic assurance, allowing developers to work with simple names while still supporting verifiable chain identification. |
| 21 | + |
| 22 | +## Specification |
| 23 | + |
| 24 | +### Semantics |
| 25 | + |
| 26 | +A valid CAIP-2 identifier in the Sui namespace takes the form: |
| 27 | + |
| 28 | +`sui:<network>` |
| 29 | + |
| 30 | +Where `<network>` is one of the following reserved, stable identifiers: |
| 31 | + |
| 32 | +- `mainnet` |
| 33 | +- `testnet` |
| 34 | +- `devnet` |
| 35 | + |
| 36 | +### Syntax |
| 37 | + |
| 38 | +#### Regular Expression |
| 39 | + |
| 40 | +`^sui:(mainnet|testnet|devnet)$` |
| 41 | + |
| 42 | +Only these exact network identifiers are currently supported. |
| 43 | + |
| 44 | +#### Example |
| 45 | + |
| 46 | +`sui:mainnet` |
| 47 | + |
| 48 | +### Resolution Mechanics |
| 49 | + |
| 50 | +To resolve a CAIP-2 `sui:<network>` identifier into a unique chain identitier, clients typically query a trusted full node associated with the specified network. While the `suix_getChainIdentifier` JSON-RPC method is commonly used for this purpose, resolution is not limited to JSON-RPC. Other node interfaces, such as GraphQL, may also support retrieving identifiers pertinent to locating records, such as a genesis checkpoint digest unique to each chain. |
| 51 | + |
| 52 | +**Sample request** |
| 53 | + |
| 54 | +```json |
| 55 | +{ |
| 56 | + "jsonrpc": "2.0", |
| 57 | + "id": 1, |
| 58 | + "method": "suix_getChainIdentifier", |
| 59 | + "params": [] |
| 60 | +} |
| 61 | +``` |
| 62 | + |
| 63 | +**Sample response (for mainnet):** |
| 64 | + |
| 65 | +```json |
| 66 | +{ |
| 67 | + "jsonrpc": "2.0", |
| 68 | + "id": 1, |
| 69 | + "result": "35834a8a" |
| 70 | +} |
| 71 | +``` |
| 72 | + |
| 73 | +The response returns the first four bytes of the genesis checkpoint digest for the network. |
| 74 | + |
| 75 | +## Rationale |
| 76 | + |
| 77 | +This approach allows developers to use intuitive, readable CAIP-2 identifiers (e.g., `sui:mainnet`) while still achieving unambiguous and verifiable identification of the underlying chain through the genesis checkpoint digest. |
| 78 | + |
| 79 | +The separation of **stable identifiers** (e.g., `sui:testnet`) from the **unambiguous chain identifier** (e.g., the identifier returned by `suix_getChainIdentifier`) is particularly important because: |
| 80 | + |
| 81 | +- **`testnet` and `devnet` may be reset** by Sui maintainers, resulting in a new genesis state. |
| 82 | +- When this happens, the **genesis checkpoint digest changes**, meaning the underlying chain identifier is no longer the same. |
| 83 | +- If clients depended directly on the digest as the CAIP-2 identifier, each reset would break compatibility or require external coordination. |
| 84 | +- By resolving the digest dynamically via RPC, clients can ensure they’re talking to the correct chain, without needing to change the CAIP-2 identifier they rely on. |
| 85 | + |
| 86 | +This pattern balances human readability, forward compatibility, and security. |
| 87 | + |
| 88 | +### Backwards Compatibility |
| 89 | + |
| 90 | +There are no legacy identifiers or alternate forms for Sui chains. |
| 91 | + |
| 92 | +## Test Cases |
| 93 | + |
| 94 | +Below are manually composed examples: |
| 95 | + |
| 96 | +#### Sui Mainnet |
| 97 | + |
| 98 | +- **CAIP-2 Chain ID:** `sui:mainnet` |
| 99 | +- **Resolved Chain Identifier:** `35834a8a` |
| 100 | + |
| 101 | +#### Sui Testnet |
| 102 | + |
| 103 | +- **CAIP-2 Chain ID:** `sui:testnet` |
| 104 | +- **Resolved Chain Identifier:** `4c78adac` _(value depends on the current testnet)_ |
| 105 | + |
| 106 | +#### Sui Devnet |
| 107 | + |
| 108 | +- **CAIP-2 Chain ID:** `sui:devnet` |
| 109 | +- **Resolved Chain Identifier:** `aba3e445` _(value depends on the current devnet)_ |
| 110 | + |
| 111 | +## References |
| 112 | + |
| 113 | +- [Sui Docs] - Developer documentation and concept overviews for building on Sui. |
| 114 | +- [Sui RPC] - Reference documentation for interacting with Sui networks via RPC. |
| 115 | +- [Sui GitHub] - Official GitHub repository for the Sui smart contract platform. |
| 116 | +- [Sui Network Info] - Information regarding Sui networks and their release schedules. |
| 117 | +- [CAIP-2] - Chain ID Specification. |
| 118 | + |
| 119 | +[Sui Docs]: https://docs.sui.io/ |
| 120 | +[Sui RPC]: https://docs.sui.io/references/sui-api |
| 121 | +[Sui GitHub]: https://github.com/MystenLabs/sui |
| 122 | +[Sui Network Info]: https://sui.io/networkinfo |
| 123 | +[CAIP-2]: https://chainagnostic.org/CAIPs/caip-2 |
| 124 | + |
| 125 | +## Copyright |
| 126 | + |
| 127 | +Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/). |
0 commit comments