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
- 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.
- 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
- Fetch a recent blockhash via getLatestBlockhash.
- Build and sign the transaction with that blockhash.
- Send the transaction. It remains valid until the block height exceeds
lastValidBlockHeight. - If the blockhash expires before confirmation, fetch a new one and rebuild the transaction.
Related terms
- 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: