getGenesisHash
Returns the genesis hash
Common use cases
| Cluster identity verification | Verify which Solana cluster an RPC endpoint serves (mainnet, devnet, testnet) by comparing genesis hash against known values. Applications prevent accidental cross-network operations like deploying programs to wrong environment or sending transactions with incorrect addresses. |
| Multi-network application routing | Applications supporting multiple clusters call getGenesisHash during connection to determine runtime configuration. Based on identified cluster, application loads appropriate program IDs, account addresses, and environment-specific parameters without manual configuration. |
Parameters
No parameters required.
Request
- cURL
- JavaScript
- Python
curl https://solana-mainnet.api.syndica.io/api-key/YOUR_API_KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "getGenesisHash"
}'
// Using fetch
const response = await fetch('https://solana-mainnet.api.syndica.io/api-key/YOUR_API_KEY', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
"jsonrpc": "2.0",
"id": 1,
"method": "getGenesisHash"
})
});
const data = await response.json();
console.log(data);
import requests
import json
url = 'https://solana-mainnet.api.syndica.io/api-key/YOUR_API_KEY'
headers = {'Content-Type': 'application/json'}
data = {
"jsonrpc": "2.0",
"id": 1,
"method": "getGenesisHash"
}
response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.json())
Replace mainnet with devnet in the URL to query devnet instead.
Response
{
"jsonrpc": "2.0",
"result": "GH7ome3EiwEr7tu9JuTh2dpYWBJK3z69Xm1ZE3MEE6JC",
"id": 1
}
Response Fields
Return value: string
A Hash as base-58 encoded string
FAQ and Troubleshooting
What are the genesis hashes for each Solana cluster?
Mainnet: 5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d, Devnet: EtWTRABZaYq6iMfeYKouRu166VU2xqa1wcaWoxPkrZBG, Testnet: 4uhcVJyU9pJkvQyS88uRDiswHXSCkY3zQawwpjk2NsNY. These hashes are immutable and uniquely identify each cluster.
Can I use shredVersion from getClusterNodes instead of genesis hash for cluster identification?
No, shredVersion changes after cluster restarts. Genesis hash is immutable for the cluster's lifetime. Use getGenesisHash for reliable cluster identification.
Do I need to call this method frequently or can I cache the result?
Cache indefinitely for the RPC connection lifecycle. Genesis hash never changes for a cluster. Call once during connection initialization and reuse the value.
Related Methods
getClusterNodes
Returns contact info for all cluster validators including shredVersion. Combine with getGenesisHash for comprehensive cluster identification where shredVersion changes but genesis hash remains constant.
getEpochInfo
Returns current epoch information for the cluster. Pair with getGenesisHash when establishing cluster context to understand both network identity and temporal position.
getHealth
Returns node health status indicating if connected and syncing. Use with getGenesisHash to verify both cluster identity and node availability before operations.