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
| Field | Type |
|---|---|
| result | object |
Examples
curl https://<your-endpoint>/ \
-X POST -H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"getGenesisHash","params":[]}'const res = await fetch("https://<your-endpoint>/", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"id": 1,
"method": "getGenesisHash",
"params": [],
"jsonrpc": "2.0"
}),
});
const data = await res.json();import requests
resp = requests.post("https://<your-endpoint>/", json={"id":1,"method":"getGenesisHash","params":[],"jsonrpc":"2.0"})
print(resp.json()){
"id": 1,
"result": "5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d",
"jsonrpc": "2.0"
}Usage
- Transport: HTTP (JSON-RPC).
- Networks: mainnet, devnet, testnet.
- 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.