Parameters
Configuration object containing the following optional fields:
Response
Current block height
Code Examples
Basic Request
Request with Commitment
Using web3.js
Notes
- Block height increases monotonically with each new block
- Block height may be different from slot number due to skipped slots
- Different nodes may return slightly different heights based on their view of the network
- The response is immediate as it reads from the current state
Best Practices
- Use appropriate commitment level based on your needs:
processedfor latest possible heightconfirmedfor high probability finalityfinalizedfor guaranteed finality
- Consider using
getSlotif you need slot numbers instead of block height - For historical queries, use
getBlockwith 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 |