Skip to main content
Every Solana transaction needs a recent blockhash. This endpoint returns the latest finalized hash plus its 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.
  • lastValidBlockHeight prevents 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=devnet for 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 lastValidBlockHeight on 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
Free endpoint. Pair with Optimal Fee to build fully-configured transactions with two gateway calls and no RPC of your own.