Transactions & Fees
isBlockhashValid
Returns whether a blockhash is still valid or not
Parameters
The blockhash to validate (base-58 encoded)
Response
Whether the blockhash is still valid (true) or not (false)
Code Examples
Basic Request
Using web3.js
Notes
- Returns whether a blockhash is still valid
- Blockhashes expire after a certain number of slots
- The response is immediate as it reads from the current state
- Invalid blockhashes cannot be used in transactions
- The blockhash must be base-58 encoded
Best Practices
- Use appropriate commitment level based on your needs
- Cache results when appropriate to reduce RPC load
- Check blockhash validity before sending transactions
- Consider using websocket subscription for real-time updates
- Handle network errors and retry when appropriate
Common Errors
Code | Message | Solution |
---|---|---|
-32601 | Method not found | Verify you’re connected to a Solana RPC node |
-32602 | Invalid params | Check the blockhash format |
-32007 | Blockhash not found | The blockhash has expired or is invalid |
Use Cases
-
Blockhash Validation
-
Blockhash Monitoring
-
Transaction Planning