Chapter 6 · What Happens in an On-chain Transaction?
What happens in the seconds after you press confirm?
- Capabilities practiced
- Onchain LiteracyProtocol Literacy
- Hands on
- Send a testnet transfer, capture its pending, included, and confirmed states, and record how long each took.
- AI Lab
- Give AI a transaction hash to explain every field, then verify each field yourself in a block explorer.
A Real-World Problem
You press confirm.
The interface spins for three seconds, then ten. It changes to “submitted,” with small text beneath: awaiting confirmation 1/12.
You send the transaction identifier to the recipient. They say it has not arrived.
Later it shows 3/12. The recipient sees it, but their platform says they must still wait.
Has the money arrived or not?
The question is more complicated than it looks. Even on one chain, rules differ:
- One platform requires one confirmation; another requires thirty.
- The same platform may require different counts for 100 yuan and a large deposit.
- Some chains display only “completed,” with no count.
- Sometimes the interface says “successful” but the money never arrives, and the fee is still charged.
That last point confuses beginners most: why pay for a failed transaction?
Chapter 1 distinguished receipt displays from settlement. This chapter unpacks the entire gap: every step between confirmation and irreversible receipt, how each can fail, and where confidence is justified.
It also brings the first five chapters together: ledgers (chapter 2), consensus (3), ordering and work (4), and signatures and keys (5).
Thought Experiment
Return to chapter 5's wall and add chapter 4's sequence of appended pages.
You want to pay five shells to the shop. Here is the complete process:
Step one: write a note. It says, “Transfer five from my row to the shop's.” Besides amount and recipient, it needs two things:
- A sequence number, saying this is your eighth note. Without it, someone could submit the same note again and charge you twice.
- A delivery fee for whoever copies it onto the wall.
Step two: stamp it. Everyone can verify your private seal produced the imprint. Changing any character invalidates it.
Step three: put it in the basket. A large basket in the village center holds all pending notes.
Crucially, the basket is public. Anyone can inspect every note, including yours. They know what you intend before it takes effect.
Step four: wait for a page writer. Periodically, someone selects a batch and copies a new page.
Why select yours? The delivery fee. Higher bids go first; lower bids may wait a long time. A full basket drives fees high, while a nearly empty one allows a small fee to work quickly.
Step five: your note appears on page 100. Does it count now?
Step six: the next morning, someone brings a longer book.
It diverges from page 99 onward and exceeds the current sequence. Under chapter 4's rules, the village accepts it instead.
Your note is absent. If lucky, it returns to the basket. If unlucky, the replacement history contains a payment from you to the attacker, with your genuine imprint. Can the attacker construct that conflict merely by seeing your note? No: they lack your private seal. But the payer can create it themselves.
Step seven: the village adopts a habit. Every additional page after yours raises the work required to overturn it. After six or seven, the cost becomes too high to bother.
But the cost is never infinite. It is merely uneconomical.
Step eight: a neighboring village changes the rule. Instead of choosing the longest sequence, a group of staked bookkeepers periodically signs together: “Locked through page 100. Changing it forfeits the stake.”
After signing, page 100 cannot change unless enough members are willing to lose their entire deposits together.
Pause: does “counts” mean the same thing in steps seven and eight?
One means reversal is too expensive to attempt. The other means reversal violates the rules and incurs penalties.
These are different assurances, though both interfaces display “completed.”
Your Decision
You run the shop. Someone pays with a note.
When do you hand over the goods?
What Happens
The choices are four settings of one question:
How much protection against reversal do you want to buy?
You pay through waiting. Longer waits lower reversal probability and raise its cost.
| Wait until | What reversal requires | Suitable setting |
|---|---|---|
| Public basket entry | Payer submits a higher-fee replacement | Tiny amounts or trusted counterparties |
| Block inclusion | Redo that block | Small everyday transactions |
| Further blocks follow | Redo all relevant blocks and overtake progress | Large amounts, with waiting adjusted to size |
| Explicit final confirmation | Enough bookkeepers are penalized together | Large amounts on supporting chains |
Three increasingly important conclusions follow.
First, finality is a curve, not a switch.
No chain is perfectly certain at second zero. Some curves become almost vertical at explicit final confirmation; others approach certainty without reaching it. Every curve begins the same way: a newly submitted transaction has no assurance.
Second, “successful” appears at three stages with different meanings.
The same green checkmark often represents three separate things:
| Interface says | Actual meaning | What has happened to the money |
|---|---|---|
| Submitted | Wallet sent the transaction to a node | Not effective; may be replaced or dropped |
| Included | Recorded in a block | May succeed or be marked failed |
| N confirmations | N subsequent blocks have followed | Reversal probability falls as N increases |
Third, a failed transaction still pays fees.
Chapter 4 explains why. Fees buy processing work, not success. The writer reads your note, executes it, finds insufficient balance or unmet conditions, and records failure. The work actually happened.
You pay for computation, not the outcome. Chapter 7 develops this distinction.
Build a Model
Seven boxes separate intent from irreversibility. This is stage 1's most useful diagram to memorize.
- Construct
- Sign
- Broadcast
- Enter the mempool
- Included in a block
- Gain confirmations
- Reach finality
Unpack each box:
| Stage | What happens | Typical failure | What you can still do |
|---|---|---|---|
| Construct | Enter recipient, amount, number, and fee | Wrong address, extra digit, nonce conflict | Edit before signing |
| Sign | Authorize contents with a private key | Authorize something you do not understand | Refuse before signing; afterward is too late |
| Broadcast | Send and propagate across nodes | Rejection, invalid format, disconnection | Resend, usually without loss |
| Mempool | Wait in a public candidate pool | Low fees leave it pending | Replace with a higher fee or an empty transaction using the same number |
| Inclusion | Record and execute in a block | Execution fails but fees remain | Investigate and resend; no reversal |
| Confirmation | More blocks follow | Reorganization returns it to the pool | Wait, or require more confirmations |
| Finality | It can no longer be overturned | — | End of process |
Three boxes deserve special attention because losses concentrate there.
Signing. It is the only point where you can still refuse. Afterward, the chain follows the signature, not your changing wishes. A signature may authorize future movement of a whole asset class, not just one transfer. Reject anything you cannot understand: this is the cheapest protection.
The mempool. Many people overlook that it is public. Before execution, the world can see amounts, recipients, swaps, and acceptable slippage.
Specialists watch it. Before a large price-moving order, they buy first, let your purchase raise the price, and sell afterward. Your worse price is their profit, earned entirely within the rules. Chapters 18 and 24 unpack this.
Inclusion. Included and successful differ. Failed and successful transactions sit side by side in the same block with different status labels. Common failure causes include insufficient resource budgets, contract rejection conditions, and prices moving beyond your tolerance.
Use this practical scale for future transfers:
The larger the amount, the less familiar the counterparty, and the less recourse available, the farther right you should wait.
Conversely, do not wait for full finality on every tiny payment. That spends protection costs in the wrong place.
What It Is Called
Now name the steps.
Generating authorization for particular transaction contents with a private key.
Remember: it binds strictly to the contents, becoming invalid if a byte changes, and it expresses authorization that cannot be withdrawn merely by changing your mind.
This is the only box you decide directly. The network determines subsequent stages.
An address's transaction sequence number, increasing from zero.
It prevents repeated execution and requires an address's transactions to take effect in order.
A useful consequence: if transaction eight is stuck, transaction nine cannot proceed even with a high fee. Increase eight's fee or replace it with a higher-fee empty transaction using the same number.
That answers how to handle a stuck transaction.
Sending a signed transaction to a node for propagation to other nodes.
Your wallet is not sending assets directly. It hands a signed file to the network. Assets move during execution after inclusion.
Each node's candidate pool of transactions not yet included: the basket.
Remember three properties: public contents, different pools at different nodes, and no effect yet. Transactions can be replaced, dropped, or never included.
The first is among the most underestimated features of on-chain trading.
A batch of transactions in a defined order, appended to the previous block.
Blocks are the basic unit of ordering. Transaction order within a block is also fixed by its producer, with major economic consequences.
A participant responsible for including transactions and producing blocks.
Proof-of-work chains award this role through computation—the miners of chapter 4. Other designs use staked assets.
Either way, producers can select transactions and their order, an authority not always explicitly constrained by the rules. Chapter 18 asks what it is worth.
How many blocks follow the block containing your transaction.
This is a measure of risk, not merely a status. More confirmations increase reversal cost.
No count is universally correct. Ask how much someone would spend to overturn this amount.
The network accepts a longer or higher-weight sequence, returning some transactions from the old branch to the mempool.
It is part of normal operation, not necessarily an attack. Near-simultaneous blocks can cause it, usually affecting one or two blocks.
Deep reorganizations usually suggest an active attack, as chapter 4's small-chain examples illustrate.
The state where a transaction cannot be overturned.
It has two very different forms:
Probabilistic finality: more blocks lower reversal probability, but never strictly to zero. Chapter 4's chain uses it.
Deterministic finality: transactions lock at a definite point, and reversal requires enough participants losing their staked deposits together.
Both interfaces display “completed,” but the assurances differ. This distinction tells you what a chain guarantees.
Bring it together:
Finality is progressively strengthening assurance rather than simply an instant.
Ask how settled the payment is, and whether that assurance matches its amount, not just whether it arrived.
Hands-on
Do this entirely on a testnet, using chapter 5's wallet and no real assets. Testnets differ from mainnets, but the seven-box structure remains the observation's purpose.
Prepare a stopwatch or phone timer.
Prepare two addresses. Create a second account in the same wallet and transfer from the first to it.
Search the first address in a block explorer and keep that page open for repeated refreshing.
Start a transfer but do not confirm yet.
Enter the amount and reach the final confirmation screen. Stop and read the whole screen.
Record recipient address, amount, fee, and estimated time. Check the first and last four address characters carefully.
This screen is the signing box, your last opportunity to reconsider. Practice pausing here for three seconds; it will save you at least once.
Confirm and start the stopwatch together.
Refresh the explorer every ten seconds for the next few minutes and record three times:
T1: The interface says submitted T2: The explorer finds the transaction as pending T3: It becomes included and shows a block height
Between T1 and T3, the payment has not taken effect on either side. It is in the basket.
Open transaction details and record each field.
Include transaction hash, status, block height, sender, recipient, amount, fee, nonce, and timestamp.
It is fine not to understand every field yet. Record them first; the AI lab uses them.
Watch confirmations for five minutes.
Refresh and watch the count rise from one. Record approximate time per increase.
You will find uneven intervals, the same stable-average, random-instance property seen in chapter 4.
Even “wait about N minutes” is a probabilistic statement.
Compare by sending another transaction with the minimum fee.
If the wallet allows custom fees, lower them to the minimum, perhaps under advanced settings, and send again.
Observe mempool waiting time. If stuck, try a higher-fee transaction using the same nonce and see whether it replaces the first.
This is the standard remedy for a stuck transaction. Practice on a testnet rather than learning under mainnet pressure.
Complete this table as your stage artifact.
| Stage | Time | Time since previous step | What failure would look like |
|---|---|---|---|
| Signing | |||
| Broadcast | |||
| Mempool entry | |||
| Inclusion | |||
| One confirmation | |||
| Five confirmations |
Finish with three sentences: when did I feel confident, why then, and how far would I wait for a large amount?
AI Lab
Use the previous lab's testnet transaction.
First, ask for a field-by-field explanation:
These transaction details come from a testnet. Explain each field:
(Paste the fields you recorded here.)
For each, state:
1. What it records
2. Who determines it: sender, network, or block producer
3. What symptoms an incorrect value would produce
Finally, state the transaction’s current status and whether it can still be overturned.Second, ask four questions it may answer incorrectly:
Based on this transaction:
1. Are inclusion and successful execution the same? If included execution fails,
is a fee still charged, and why?
2. Can I reverse it now? What if it remains in the mempool?
What if it has already been included?
3. How many confirmations should I wait for a large incoming transfer?
Do not give a number first. Explain which variables determine it.
4. Is this chain’s finality probabilistic or deterministic, and what supports that answer?Third and most importantly, return to the explorer and verify every field.
Use the checklist. For every mismatch, record what it claimed, what is true, and why it might have made that claim.
Two reminders:
First, the correct response to question three asks you for more information. A model saying twelve confirmations are safe is using a template. The answer must include what reversing this amount would justify spending, the chain's current security budget, and your ability to bear the worst case.
Second, privacy matters even here. Hashes and addresses are public, but do not paste all your addresses at once. That hands a third-party service your complete asset distribution. Chapter 23 explains what linking addresses reveals.
Testnet addresses can be shared freely. Treat mainnet addresses as described above.
Verify these points yourself after using AI
- Check that it separates inclusion from successful execution; the explorer has distinct indicators
- Check actual fees against the explorer and whether it distinguishes budget from consumed resources
- Check nonce ordering for an address and its remedy for a stuck transaction
- Check whether timestamps mean block time or your initiation time; these can differ substantially
- Reject universal confirmation counts without a basis tied to amount and chain conditions
- Check whether it identifies probabilistic or deterministic finality; an unsupported answer is a template
- Compare every claimed block time, fee rate, and confirmation duration with the explorer and mark mismatches
Real-World Case
A small proof-of-work chain suffered repeated deep reorganizations over several months. Attackers acquired enough computation to overturn dozens of confirmed blocks and double-spend.
The lesson is direct: the explorer had displayed those transactions as confirmed, with substantial counts.
Trading platforms then raised deposit confirmation requirements sharply. Confirmation counts are dynamically adjusted risk parameters based on security budgets, not technical constants.
Chapter 4 supplied the economics: attack cost versus proceeds. Their difference determines how many confirmations to require.
Popular events—large asset launches, clustered liquidations, or suddenly popular applications—can fill mempools within minutes.
Fees rise to dozens of times normal levels, and insufficient bids wait hours or days. Some operations are time-sensitive, such as adding collateral before a price threshold. Liquidation does not wait for a pending transaction.
The conclusion is that the mempool is a real-time auction, not an ordinary waiting room. You buy priority for a scarce resource.
Chapter 7 examines the market; chapter 16 explains why liquidation does not wait.
Public mempools have created an industry.
Someone spots your price-moving order, buys before it, waits for your order to raise the price, and sells immediately. Your execution is worse than expected, and the difference goes to them.
No step violates the rules. They obtain no private key, forge no signature, and compromise no system. They know your intention early and influence ordering.
This revisits chapter 2 in another form: authority over page order is monetizable power. Chapters 18 and 24 develop it. For now, remember your transaction is public before execution.
Change One Variable
Front-running and sandwiching lose their information advantage, improving ordinary users' execution.
Three new problems appear. How do nodes synchronize? Transactions must propagate for inclusion. Full secrecy conflicts with propagation, requiring encryption and staged disclosure.
Who ensures the submitted content is valid? If encrypted transactions are decrypted only after inclusion and prove invalid, blockspace has already been wasted.
Who gains privileged visibility? A specialist sequencer able to read plaintext merely changes public visibility into one person's visibility, returning to Wang.
This is an active engineering field seeking balance among those problems. Chapter 18 introduces the approaches.
Confirmations become much faster and feel closer to traditional payments, a reasonable direction many chains pursue.
As chapter 4 explained, each confirmation carries less assurance. When intervals approach propagation time, brief forks become common and dozens of confirmations may equal a few old ones.
Also, node requirements rise. Faster blocks demand more processing and bandwidth and make synchronization harder. Fewer independent verifiers move your position left on chapter 3's scale: some trust returns to accepting others' claims.
Speed's cost often appears in who can still verify independently. Chapter 8 completes the calculation.
Costs become predictable and fee spikes disappear.
But fixed prices do not remove congestion; they change allocation. Demand exceeding supply still requires a priority mechanism: arrival time rewards fast networks, randomness rewards spamming, or a decision-maker restores Wang.
Fixed prices also remove market signals. Chapter 7 explains how fluctuating fees reveal demand and inform capacity decisions.
Congestion reflects demand, not a bug. Capping price moves congestion elsewhere rather than eliminating it.
Reversibility enables mistaken-transfer recovery, fraud appeals, and court enforcement in traditional finance. Adding it improves experience.
But reversal requires someone authorized to reverse, whether an institution or a vote, filling chapter 2's authority column again.
Allowing confirmed results to change destabilizes on-chain composition. If an application already consumed one transaction's result, reversing it requires reversing every dependent operation. That removes a foundation rather than merely adding a feature.
Chapter 3's 2016 case was a manual reversal. This explains its controversy and eventual split.
Irreversibility is not necessarily better in every setting. But it underpins on-chain composability, purchased at the cost of no support after a wrong-address transfer. Chapter 9 explains what it enables.
Takeaway Questions
Choose three of the Eighteen Questions for this chapter.
The answer here is clear: transaction initiators pay block producers.
Ask what they buy. Failed execution still costs money, so they buy processing resources and priority, not success.
This distinction recurs throughout the course. For free or zero-fee products, find where the cost moved: spreads, subsidies, or hidden ordering power.
Fees encourage validators to include transactions. Why choose a particular order?
Rules do not necessarily require fee order; validators maximize revenue. If inserting trades around your large order earns more, they may do so within the rules.
Whenever a role has unconstrained discretion, calculate its value. This is a powerful protocol-analysis technique used extensively in chapter 18.
In the seven boxes, signing naturally belongs to the person.
It is the only refusal point and the point requiring judgment of intent rather than rule execution. Other stages can be automated, but surrendering this one gives away control of the assets, as chapter 5 explained.
For every tool, script, or agent, ask whether it can sign independently. If yes, you hand it the private seal. If not, risk falls by an order of magnitude.
This boundary continues through chapter 34. Many sophisticated designs appear, all trying to retain automation without fully surrendering signing authority.
Chapter Check
Submitted: The wallet handed a signed transaction to a node. It remains pending, replaceable or droppable, with no effect yet.
Included: It was recorded in a block, but need not have succeeded. Failed execution still occupies a row and pays fees.
N confirmations: N blocks followed its block. This is a risk measure: larger N raises reversal cost.
One green checkmark often represents all three, though settlement differs. This develops chapter 1's distinction between receipt displays and settlement.
Fees buy processing resources, not results.
The network reads, executes, detects failure, and records status. Those calculations consume blockspace and computation.
Also, free failures would let anyone flood the network with transactions designed to fail. Charging forms part of the defense.
The right model is paying for computation, not a promise. Chapter 7 develops it.
Probabilistic: More blocks lower reversal probability but never to zero. Reversal becomes uneconomical.
Deterministic: A definite point locks transactions, with reversal requiring enough participants to lose deposits. Rules forbid it and penalties enforce them.
Two practical differences follow.
First, waiting decisions differ. Probabilistic finality requires judging attack cost relative to amount; deterministic finality waits for the explicit point.
Second, the trust basis differs. One relies on computation cost; the other on insufficient collusion and working penalties.
Both look like a green checkmark. Knowing which you use is a practical outcome of this chapter.
Because everyone learns your intent before it takes effect: amounts, recipients, swaps, and tolerated price movement.
An attacker need not obtain keys, forge signatures, or compromise systems. Early knowledge and ordering authority suffice.
A safe wallet does not guarantee a safe transaction. Chapter 5 addresses the former; the latter needs other measures such as slippage limits, splitting large orders, and submission channels bypassing public pools. Chapters 18 and 24 explain them.
There is no answer key. Check four things.
One, what expenditure would this amount justify to overturn? Attack proceeds should remain below attack cost.
Two, what is the chain's current security budget? Computation or total stake determines reorganization cost. The same confirmation count on small and large chains can differ by orders of magnitude.
Three, which finality model applies? For deterministic finality, wait for its explicit point rather than counting blocks.
Four, can I bear the worst case? Would reversal put you out of the game?
A fixed number without any reference to amount is a template. Transfers differing a thousandfold should not necessarily wait equally. That explains platforms' differing and changing requirements.
Key idea
Finality is not a single moment; it is a probability that strengthens over time.