getGenesisHash

The getGenesisHash method returns the genesis hash of the blockchain. The genesis hash is a unique identifier for a specific Solana cluster (mainnet, testnet, or devnet) and is derived from the genesis block created when the network was first initialized.

The genesis hash serves as a cryptographic fingerprint that uniquely identifies a blockchain network. It's crucial for ensuring that your application connects to the intended network and for preventing transaction replay attacks across different clusters. Each Solana cluster (mainnet-beta, testnet, devnet) has its own unique genesis hash that never changes, making it a reliable way to verify network identity.

This method is commonly used during application initialization to verify the connected network, implement safety checks that prevent accidental cross-network operations, and validate that wallet signatures are intended for the specific cluster. The genesis hash is also embedded in transaction signatures to ensure transactions created for one cluster cannot be replayed on another.


Parameters

parameter
type
description
config
object
Optional configuration object (currently no config options are available)
Return Object
field
type
description
result
string
The genesis hash as a base-58 encoded string
Request Example
Request
Response Example
Response

Tip: Solana mainnet-beta genesis hash is 5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d. Use this to verify you're connected to the correct network. This value is constant for the lifetime of the cluster and can be safely cached.


Share on
Share on FacebookShare on XShare on LinkedIn
Did you find this page useful?