getGenesisHash — Solana RPC Method
getGenesisHash returns the genesis hash of the cluster. Each Solana cluster (mainnet-beta, testnet, devnet) has a unique genesis hash that identifies it. This is useful for verifying which network an RPC endpoint is connected to.
Parameters
This method takes no parameters.
Request
curl -X POST https://api.mainnet-beta.solana.com \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "getGenesisHash",
"params": []
}'
TypeScript (@solana/kit)
import { createSolanaRpc } from "@solana/kit";
const rpc = createSolanaRpc("https://api.mainnet-beta.solana.com");
const genesisHash = await rpc.getGenesisHash().send();
console.log(`Genesis hash: ${genesisHash}`);
Response
{
"jsonrpc": "2.0",
"result": "5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d",
"id": 1
}
| Field | Type | Description |
|---|---|---|
result | string | Base-58 encoded hash of the genesis block. Unique per cluster. |
Known genesis hashes
| Cluster | Genesis Hash |
|---|---|
| Mainnet-beta | 5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d |
| Testnet | 4uhcVJyU9pJkvQyS88uRDiswHXSCkY3zQawwpjk2NsNY |
| Devnet | EtWTRABZaYq6iMfeYKouRu166VU2xqa1wcaWoxPkrZBG |
Common errors
This method has no parameters and reliably returns a result. Errors are limited to connectivity issues.
Performance
getGenesisHash returns a static value that never changes for a given cluster. Cache the result permanently — it is safe to call once at application startup and reuse the value.
FAQ
What is the genesis hash used for? The genesis hash uniquely identifies a Solana cluster. Applications use it to verify they are connected to the expected network (mainnet vs. testnet vs. devnet) before signing or sending transactions.
Does the genesis hash ever change? No. The genesis hash is derived from the cluster’s genesis configuration and is immutable. It has remained the same since the cluster was created.
How is the genesis hash different from a blockhash? The genesis hash is a permanent identifier for the cluster. A blockhash is a recent hash used for transaction lifetime management and changes every slot. They serve completely different purposes.
Can two clusters have the same genesis hash? In practice, no. Each cluster’s genesis configuration is unique, producing a unique hash. Local test validators generate their own unique genesis hash on each restart.
Updated: