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"
}'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
result
string
8-character hex string representing the chain identifier
Use Cases
Network Verification: Verify connection to the correct network (Mainnet vs Testnet) before submitting transactions.
Replay Protection: Include in transaction signing to prevent cross-chain replay attacks.
Multi-Network Apps: Support multiple SUI networks with automatic detection.
Error Handling
-32602
Invalid params - malformed input
-32603
Internal error - simulation failed
MoveAbort
Move execution aborted
SDK Integration
Last updated
Was this helpful?