> ## 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.

# getBlockHeight

> Returns the current block height of the node

## Parameters

<ParamField query="config" type="object" optional>
  Configuration object containing the following optional fields:

  <Expandable title="config fields">
    <ParamField query="commitment" type="string" optional>
      The level of commitment to use:

      * `processed`: Latest block (unconfirmed)
      * `confirmed`: Confirmed by supermajority
      * `finalized`: Finalized by supermajority
    </ParamField>

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

## Response

<ResponseField name="result" type="number">
  Current block height
</ResponseField>

## Code Examples

### Basic Request

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

### Request with Commitment

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

### Using web3.js

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

const connection = new Connection('https://fra.rpc.orbitflare.com?api_key=YOUR-API-KEY');

const blockHeight = await connection.getBlockHeight('finalized');
console.log(`Current block height: ${blockHeight}`);
```

## Notes

1. Block height increases monotonically with each new block
2. Block height may be different from slot number due to skipped slots
3. Different nodes may return slightly different heights based on their view of the network
4. The response is immediate as it reads from the current state

## Best Practices

1. Use appropriate commitment level based on your needs:
   * `processed` for latest possible height
   * `confirmed` for high probability finality
   * `finalized` for guaranteed finality
2. Consider using `getSlot` if you need slot numbers instead of block height
3. For historical queries, use `getBlock` with specific slots

## Common Errors

| Code   | Message                    | Solution                                     |
| ------ | -------------------------- | -------------------------------------------- |
| -32601 | Method not found           | Verify you're connected to a Solana RPC node |
| -32007 | Block height not available | Node may be bootstrapping or syncing         |
