TriportRPC

getGenesisHash

Last updated:

getGenesisHash returns the genesis hash of the cluster the request was routed to, encoded as a base-58 string. The genesis hash is a stable, immutable identifier baked into a cluster at creation — it never changes for the life of that cluster.

Because each Solana cluster has a distinct genesis hash, this is the canonical way to confirm which cluster your traffic is actually hitting (for example, distinguishing mainnet from devnet or testnet) before submitting a transaction. A common pattern is to call it once at client start-up and assert the value against the network you expect.

The call takes no parameters and returns a single string, making it one of the cheapest read methods available.

Parameters

This method takes no parameters.

Returns

getGenesisHash return value
FieldType
resultobject

Examples

curl https://triport.io/sol \
  -X POST -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <api-key>' \
  -d '{"id":1,"method":"getGenesisHash","params":[],"jsonrpc":"2.0"}'
const res = await fetch("https://triport.io/sol", {
  method: "POST",
  headers: { "Content-Type": "application/json", Authorization: "Bearer <api-key>" },
  body: JSON.stringify({
  "id": 1,
  "method": "getGenesisHash",
  "params": [],
  "jsonrpc": "2.0"
}),
});
const data = await res.json();
import requests
resp = requests.post(
    "https://triport.io/sol",
    headers={"Authorization": "Bearer <api-key>"},
    json={"id":1,"method":"getGenesisHash","params":[],"jsonrpc":"2.0"},
)
print(resp.json())
{
  "id": 1,
  "result": "5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d",
  "jsonrpc": "2.0"
}

Usage

  1. Transport: HTTP (JSON-RPC).
  2. Networks: mainnet, devnet, testnet.
  3. Credit cost: 1 per call.

FAQ

What does getGenesisHash do?
Returns the genesis hash of the Solana cluster as a base-58 string.
How many credits does getGenesisHash cost?
getGenesisHash costs 1 credit(s) per call on Triport by default.
Is getGenesisHash available over WebSocket?
getGenesisHash is an HTTP JSON-RPC method.