lastValidBlockHeight so you can build and submit transactions client-side without running your own RPC node. Free, no API key required, cheap to call in a loop.
Why agents use this
- You need it for every tx. Any transaction built more than ~90 seconds after the blockhash was fetched will expire. Refresh often.
lastValidBlockHeightprevents ghost failures. Compare against current slot to know if your tx window is still open.- No RPC infra required. Devs building agents from scratch can construct + submit transactions with just this and a wallet.
- Devnet + mainnet from the same endpoint. Add
?network=devnetfor testing.
Use cases
- Client-side tx builder. Web app or CLI that constructs Solana transactions, fetches blockhash from the gateway, signs locally.
- Blockhash refresh in a sniper bot. Cache blockhash for 30 seconds, then refresh. Never submit an expired tx.
- Tx expiry monitor. Watch
lastValidBlockHeighton your queued transactions and re-sign the ones nearing expiry. - Onboarding health check. Users hit blockhash to verify their gateway integration works before committing to a paid plan.
- Wallet SDK bootstrap. Custom mobile wallet? Point it here for blockhash so you don’t have to bundle an RPC dependency.
Recipe: fresh-blockhash cache
blockhash-cache.ts