Sub topic 11
Confirmations and Finality
This chapter assumes you understand wallets, addresses, transactions, and the difference between a blockchain’s native coin and a token. You should also know how to find a transaction hash in a wallet or block explorer.
From broadcast to confirmation
A transaction first enters a node’s pending pool. A block producer may then include it in a block. Inclusion means the transaction appears in the chain, but it may still be possible for that block to be replaced by another valid chain.
A confirmation is a block containing the transaction, plus the blocks added after it. If a transaction is in block 1,000 and the current chain is at block 1,004, many explorers show five confirmations:
- The transaction’s own block counts as one.
- Blocks 1,001 through 1,004 add four more.
More confirmations usually make a reorganization less likely. A reorganization, or reorg, happens when nodes switch to a competing chain. The transaction might remain in the new chain, return to the pending pool, or fail if its inputs or account state have changed.
Finality is stronger than confirmation
Finality is the point at which a protocol treats a block or state as settled. The meaning depends on the network.
- Some chains provide probabilistic finality. Each additional block reduces, but may not mathematically eliminate, the chance of reversal.
- Some proof-of-stake chains provide protocol finality after validators confirm a checkpoint. Reversing finalized history would require a serious protocol violation and may cause penalties.
- A wallet, exchange, or merchant can impose its own required confirmation count before crediting a deposit.
Do not assume that one confirmation has the same meaning on every chain. Check the network’s rules and the recipient’s policy. A small personal payment may be accepted after inclusion. A large exchange deposit may require many confirmations or a finalized block.
Verify the payment
Use the transaction hash and the correct network’s block explorer. Check all of these fields:
- Status is successful, not failed or reverted.
- The recipient address exactly matches the intended address.
- The asset and amount are correct.
- The transaction is on the intended network.
- The block number is present.
- The confirmation count is sufficient for the recipient.
For an account-based network, a successful token transfer is an event recorded by a smart contract. The native balance may not change, so inspect the token transfer details rather than only the account’s native-coin balance.
With ethers, you can calculate confirmations after inclusion:
import { JsonRpcProvider } from "ethers";
const provider = new JsonRpcProvider(process.env.RPC_URL);
const tx = await provider.getTransaction(process.env.TX_HASH);
if (!tx || tx.blockNumber === null) {
console.log("The transaction is not included yet");
} else {
const currentBlock = await provider.getBlockNumber();
const confirmations = currentBlock - tx.blockNumber + 1;
console.log(`Confirmations: ${confirmations}`);
}This count is useful, but it does not replace checking the receipt status or the network’s finality rules.
Exercise
A payment appears in a block, but its receipt status is failed. Should the recipient treat it as paid?
Show answer
No. Inclusion alone is insufficient. A failed transaction did not complete its intended state change, so the recipient should verify the balance and transfer details before accepting payment.