in-solana by Supanode

What Is Blockhash in Solana?

A blockhash is the SHA-256 hash of a recently produced block. Every Solana transaction must include a recent blockhash, which serves as a timestamp and replay protection mechanism.

Why transactions need a blockhash

  1. Replay protection. The blockhash ensures each transaction can only be processed once. The same signed transaction with the same blockhash is deduplicated by the network.
  2. Expiry. A transaction’s blockhash is valid for approximately 60-90 seconds (~150 blocks). After that, the transaction can never be included and must be rebuilt with a fresh blockhash.

Blockhash lifecycle

  1. Fetch a recent blockhash via getLatestBlockhash.
  2. Build and sign the transaction with that blockhash.
  3. Send the transaction. It remains valid until the block height exceeds lastValidBlockHeight.
  4. If the blockhash expires before confirmation, fetch a new one and rebuild the transaction.
  • Slot — the time window in which a block (and its hash) is produced
  • Durable nonce — an alternative to blockhash for transactions that need extended validity

Updated: