> For the complete documentation index, see [llms.txt](https://docs.coinvera.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.coinvera.io/integration/solana/rpc/getgenesishash.md).

# getGenesisHash

The `getGenesisHash` RPC method returns the **genesis hash** of the Solana cluster to which the queried node is connected. This hash uniquely identifies the specific network—such as **Mainnet Beta**, **Devnet**, **Testnet**, or a **custom/private cluster**.

***

#### ✅ Common Use Cases

* **Verify Connected Network**\
  Ensure your application is interacting with the intended cluster (e.g., Devnet vs. Mainnet Beta) by comparing the genesis hash.
* **Client Configuration**\
  Use the genesis hash programmatically to conditionally configure tools, wallets, or front-end applications based on the connected cluster.
* **Prevent Cross-Cluster Caching Errors**\
  Incorporate the genesis hash into cache keys to avoid serving data from one network on another—important when working with multiple environments.

***

#### 🛠 Request Parameters

This method **does not accept any parameters**.

***

#### 📦 Response Structure

The response includes:

```json
{
  "jsonrpc": "2.0",
  "result": "5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
  "id": 1
}
```

**`result`** (*string*):\
The **base-58 encoded genesis hash** of the connected cluster.

***

💡 **Example: Fetch the Genesis Hash**

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getGenesisHash"
}
```

**Code Examples**

{% tabs %}
{% tab title="Nodejs" %}

```javascript
const fetch = require('node-fetch');

async function getGenesisHash(rpcUrl) {
  try {
    const response = await fetch(rpcUrl, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        jsonrpc: '2.0',
        id: 1,
        method: 'getGenesisHash'
      }),
    });

    const data = await response.json();
    
    // Print the exact full response
    console.log('Full RPC Response:');
    console.log(JSON.stringify(data, null, 2));
    
    return data;
  } catch (error) {
    console.error('Error getting health:', error.message);
    return null;
  }
}

// Example usage
const RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key';

getGenesisHash(RPC_URL);
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

def get_genesis_hash(rpc_url):
    try:
        response = requests.post(
            rpc_url,
            headers={
                'Content-Type': 'application/json',
            },
            json={
                'jsonrpc': '2.0',
                'id': 1,
                'method': 'getGenesisHash'
            }
        )
        
        data = response.json()
        
        # Print the exact full response
        print('Full RPC Response:')
        print(json.dumps(data, indent=2))
        
        return data
        
    except Exception as error:
        print(f'Error getting health: {error}')
        return None

# Example usage
RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key'
get_genesis_hash(RPC_URL)
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "jsonrpc": "2.0",
  "result": "5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d",
  "id": 1
}
```

#### 🧠 Developer Tips

* **Unique Per Cluster**\
  Each Solana network has its own unique genesis hash. For example:
  * Mainnet Beta: `5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp`
  * Devnet/Testnet: Different and distinct hashes
  * Private clusters: Will have custom genesis hashes
* **Immutable Identifier**\
  The genesis hash is set once at cluster initialization and never changes.
* **Recommended Safety Check**\
  For sensitive actions (e.g., sending real funds), applications should verify that the returned hash matches the expected cluster hash to avoid misrouting operations.
