Transaction lifecycle: send, mempool, confirm

2 min read

Short answer

When you send an EVM transaction, the node returns its hash right away, before anything has run. The transaction then waits with other pending transactions until a block producer includes it in a block. Only the receipt from that block tells you whether it succeeded or reverted, and what it cost.

On this page
The five steps of an EVM transaction from send to final, where hashspan's send and confirm spans begin and end, and the three ways it can go wrong after send.

What are the steps?

  1. Send. The client signs the transaction and sends it to a node. The node returns the hash. Nothing has executed yet.
  2. Pending. The transaction joins a pool of pending transactions and waits (ethereum.org).
  3. Included. A block producer puts it in a block. Now it runs and changes state, or reverts.
  4. Receipt. The block’s receipt records the outcome: status, gas used, effective gas price, logs.
  5. Final. Over time the block becomes harder and harder to undo.

The gap between step 1 and step 4 is where most surprises live.

What can go wrong after send?

  • It reverts. It’s included and pays for its gas, but nothing it tried to change sticks.
  • It’s replaced. Another transaction from the same sender with the same nonce is mined instead, for example a speed-up or a cancel. viem reports this as replaced, repriced or cancelled (viem docs).
  • It never lands. It sits in the pool until whoever is waiting gives up.

Why does this matter for agents?

An agent’s tool usually returns at step 1, with a hash. The trace marks the tool call as fine and moves on. Steps 2 to 4 happen outside the trace. This post walks through a real example where the tool call looks fine and the transaction reverted.

pay_vendor · from make demodurations from the run; positions approximate
execute_tool pay_vendor26.3 ms26.3 ms
send 3133713.4 ms13.4 ms
confirm 3133711.8 ms11.8 ms
Send ends when the hash comes back. Confirm ends when the receipt does.

FAQ

Does getting a transaction hash mean it succeeded?

No. The hash only means the node accepted the transaction. It can still revert, be replaced by another transaction with the same nonce, or never be included.

Does a reverted transaction cost anything?

Yes. It's included in a block and pays for the gas it used, but its state changes are rolled back.

How many confirmations should I wait for?

viem's waitForTransactionReceipt waits for one by default and accepts a confirmations option. More blocks make a reorg less likely to undo it.

Go further

Type to search the docs, Learn topics and the blog.