For the complete documentation index, see llms.txt. This page is also available as Markdown.

sui_getChainIdentifier{deprecated} - 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 SUI networks and is used for transaction signing and to protect 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"
    }'
import axios from 'axios';

const data = JSON.stringify({
    "jsonrpc": "2.0",
     "method": "sui_getChainIdentifier",
  "params": [],
  "id": "getblock.io"
    });

const config = {
    method: 'post',
    url: 'https://go.getblock.io/<ACCESS-TOKEN>/',
    headers: {
        'Content-Type': 'application/json'
    },
    data: data
};

axios(config)
    .then(response => console.log(JSON.stringify(response.data)))
    .catch(error => console.log(error));

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?