> ## Documentation Index
> Fetch the complete documentation index at: https://docs.orbitflare.com/llms.txt
> Use this file to discover all available pages before exploring further.

# getLatestBlockhash

> Returns the latest blockhash

## Parameters

<ParamField query="config" type="object" optional>
  <Expandable title="config fields">
    <ParamField name="commitment" type="string" optional>
      The commitment level to use for the response
    </ParamField>

    <ParamField name="minContextSlot" type="number" optional>
      The minimum slot that the request can be evaluated at
    </ParamField>
  </Expandable>
</ParamField>

## Response

<ResponseField name="result" type="object">
  <Expandable title="result fields">
    <ResponseField name="context" type="object">
      <ResponseField name="slot" type="number">
        The slot this request was processed in
      </ResponseField>
    </ResponseField>

    <ResponseField name="value" type="object">
      <ResponseField name="blockhash" type="string">
        The latest blockhash (base-58 encoded)
      </ResponseField>

      <ResponseField name="lastValidBlockHeight" type="number">
        Last valid block height for the blockhash
      </ResponseField>
    </ResponseField>
  </Expandable>
</ResponseField>

## Code Examples

### Basic Request

```bash theme={null}
curl http://fra.rpc.orbitflare.com?api_key=YOUR-API-KEY -X POST -H "Content-Type: application/json" -d '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getLatestBlockhash",
  "params": [
    {"commitment": "processed"}
  ]
}'
```

### Using web3.js

```typescript theme={null}
import { Connection } from '@solana/web3.js';

const connection = new Connection('http://fra.rpc.orbitflare.com?api_key=YOUR-API-KEY');
const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash();
console.log(blockhash, lastValidBlockHeight);
```

### Using Python

```python theme={null}
from solana.rpc.api import Client

client = Client("http://fra.rpc.orbitflare.com?api_key=YOUR-API-KEY")
response = client.get_latest_blockhash()
print(response)
```

## Notes

1. This method returns the latest blockhash and how long it will be valid for
2. Replaces the deprecated `getRecentBlockhash` method
3. The blockhash is used for transaction processing and deduplication
4. The blockhash is valid until the specified lastValidBlockHeight is reached
5. Different commitment levels can be specified for the response

## Best Practices

1. Use blockhash for transaction submission and signing
2. Monitor lastValidBlockHeight to determine blockhash validity
3. Refresh blockhash if lastValidBlockHeight is reached or exceeded
4. Handle network errors and retry when appropriate
5. Cache the blockhash for multiple transactions within its validity period
