sui_getChainIdentifier - Sui

Example code for the sui_getChainIdentifier JSON-RPC method. Complete guide on how to use sui_getChainIdentifier JSON-RPC in GetBlock Web3 documentation.

This method returns the chain's genesis checkpoint digest (first four bytes as a hex string). This identifier uniquely distinguishes between SUI networks and is used for transaction signing and protection against replay attacks.

Parameters

  • None

Request Example

curl --location --request POST 'https://go.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
     "method": "sui_getChainIdentifier",
  "params": [],
  "id": "getblock.io"
    }'

Response

{
  "jsonrpc": "2.0",
  "id": "getblock.io",
  "result": "4c78adac"
}

Response Parameters

Parameter
Type
Description

result

string

8-character hex string representing the chain identifier

Use Cases

  1. Network Verification: Verify connection to the correct network (Mainnet vs Testnet) before submitting transactions.

  2. Replay Protection: Include in transaction signing to prevent cross-chain replay attacks.

  3. Multi-Network Apps: Support multiple SUI networks with automatic detection.

Error Handling

Error Code
Description

-32602

Invalid params - malformed input

-32603

Internal error - simulation failed

MoveAbort

Move execution aborted

SDK Integration

Last updated

Was this helpful?