getGenesisHash
https://api.triport.io/v1/solReturns the genesis hash of the Solana cluster as a base-58 string.
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. JSON-RPC params must be an empty array []
(or omitted).
——optionalResponse
The value above (5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d) is the genesis
hash of Solana mainnet; devnet and testnet return different hashes.
resultstring (base-58)Errors
Errors are returned in the standard JSON-RPC error envelope. See the shared errors reference for the full envelope shape and shared codes.
| Code | Meaning | When it happens |
|---|---|---|
401 | Unauthorized | Missing or invalid Authorization: Bearer key. |
429 | Rate limited | More than your tier's RPS for sol_read_rpc (20 / 60 / 200 / 600). |
Examples
JavaScript (fetch)
const res = await fetch("https://api.triport.io/v1/sol", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.TRIPORT_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
jsonrpc: "2.0",
id: 1,
method: "getGenesisHash",
params: [],
}),
});
const { result } = await res.json();
const MAINNET_GENESIS = "5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d";
if (result !== MAINNET_GENESIS) {
throw new Error(`Unexpected cluster: genesis hash ${result}`);
}
console.log(`Genesis hash: ${result}`);TypeScript SDK (@triport/sdk)
import { TriportClient } from "@triport/sdk";
const client = new TriportClient({ apiKey: process.env.TRIPORT_API_KEY });
const genesisHash = await client.solana.getGenesisHash();
console.log(`Genesis hash: ${genesisHash}`);Python (triport-sdk)
import os
from triport import TriportClient
client = TriportClient(api_key=os.environ["TRIPORT_API_KEY"])
genesis_hash = client.solana.get_genesis_hash()
print(f"Genesis hash: {genesis_hash}")Notes
- Cluster fingerprint: the genesis hash is constant per cluster, so it is safe to cache for the lifetime of your client. There is no need to poll it.
- Network sanity check: compare the returned value against the genesis hash of the network you intend to use to catch misconfigured endpoints before sending funds or transactions.
- Related methods: use
getEpochScheduleandgetSlotto inspect the cluster's current progression once you have confirmed the cluster identity.