🫛 Block Finality (Reorgs)

Blockchain re-organizations, or "reorgs," are events where the network's consensus shifts, causing previously confirmed blocks to be replaced or reordered. Reorgs can disrupt the perceived permanence of transactions, making it required to understand when a transaction is truly final and cannot be altered.

This is where block finality becomes relevant, providing varying levels of confidence that a transaction will remain permanently stored in the blockchain. In Ethereum, different types of blocks—such as safe, finalized, and latest—indicate how secure a transaction is from being affected by a reorg.

Block Tags and Their Meanings

Ethereum categorizes blocks into different tags, each representing the level of confidence you can have in the block’s permanence. Here’s a breakdown:

  1. safe Block
    • Definition: The most recent block considered crypto-economically secure, meaning it is very unlikely to be re-orged (reorganized). Re-orgs are possible only under extreme circumstances, usually involving community coordination or manual intervention.
    • Confidence Level: High. This block is "unlikely" to be re-orged.
  2. finalized Block
    • Definition: The most recent block accepted by more than two-thirds of Ethereum validators, making it crypto-economically secure. Finalization typically occurs after two epochs (~12-13 minutes), making it nearly impossible to re-org without coordinated community action.
    • Confidence Level: Very High. This block is "very unlikely" to be re-orged.
  3. latest Block
    • Definition: The most recent block observed by the client as part of the canonical chain. However, it is still subject to re-orgs, even under normal network conditions.
    • Confidence Level: Low to Medium. This block could still be re-orged.
  4. earliest Block
    • Definition: The first block ever created on the Ethereum blockchain, also known as the genesis block.
    • Confidence Level: Irrelevant for transaction confidence, as it pertains to historical data rather than current transactions.
  5. pending Block
    • Definition: A block that has not yet been mined but is proposed by the client, containing transactions from the local mempool.
    • Confidence Level: Very Low. This block has not been mined yet and may never be.

Practical Implications of Block Finality

  • Pending and Latest Blocks: Transactions included in these blocks should be considered tentative. If your transaction is in a pending or latest block, it may still be reversed or re-ordered if the block is re-orged.
  • Safe Blocks: Once a transaction is included in a safe block, the probability of it being re-orged is very low. Most applications can consider a transaction final when it is in a safe block.
  • Finalized Blocks: Transactions included in a finalized block are virtually guaranteed to be permanent. This is the highest level of confidence you can have that your transaction is immutably recorded on the blockchain.

How to Check Block Finality

Block finality in Ethereum refers to the point at which a block and its transactions are considered permanently recorded on the blockchain, meaning they cannot be altered or re-orged without extreme measures. Finality provides confidence that a transaction is truly secure and irreversible.

You can check the finality of a block using Ethereum’s JSON-RPC interface with a curl command.

Checking the Latest Finalized Block

To find the latest finalized block, you can use the RPC method eth_getBlockByNumber with the "finalized" tag. This tag retrieves the most recent block that has been finalized by more than two-thirds of Ethereum validators.

Once you have this block, verify that the block you are concerned about is older than the one returned by the blockchain.

Example request:

curl --location 'https://ethereum-mainnet.gateway.tatum.io/' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {YOUR_API_KEY}' \
--data '{
    "jsonrpc":"2.0",
    "method":"eth_getBlockByNumber",
    "params":[
        "finalized",
        true
     ],
    "id":1
}'