Skip to main content

Type a word from a question or an article title.

2 · Practice

Anatomy of a transaction: nonce, gas, mempool and confirmations

What happens from pressing "Sign" to confirmation in a block - transaction fields, nonce, mempool, inclusion in a block, finality and why transactions get stuck.

4 min readUpdated:
In this article

You press "Confirm" in an app, the wallet offers to sign - and a few seconds later the interface reports it went through. A whole chain of events happens in between. Understanding it helps you not to panic when "something hangs" and to read data in a block explorer.

What a transaction consists of

A transaction is a data structure. The main fields:

  • from - the sender (determined by the signature).
  • to - the recipient: another address or a contract address. For creating a new contract the field is empty.
  • value - how much of the main coin is transferred (may be zero).
  • data - for a contract call: which function to call and with what arguments. Empty for a plain transfer. The format is described in the article on ABI.
  • nonce - the sender's sequential transaction number.
  • gas limit - the maximum gas you are willing to spend.
  • maxFeePerGas and maxPriorityFeePerGas - upper limits on gas prices (see the article on fees).
  • chainId - the network identifier. It protects against replay: a transaction signed for Base will not be accepted on Ethereum.
  • signature - proof that the key's owner sent the transaction.

A transaction's journey

1. Creation and signing. The interface builds the transaction, the wallet shows it to you, you sign with the private key. Signing happens locally, the key is sent nowhere.

2. Sending to a node. The wallet sends the signed transaction to the network's RPC node - a computer that accepts requests. The node checks the signature, nonce and balance.

3. Mempool. The node broadcasts the transaction to its neighbours, and it lands in the mempool - a shared "waiting room". Everyone waits here for inclusion in a block. At this time the transaction is visible to all but not yet executed.

4. Inclusion in a block. The validator building the next block picks transactions from the mempool - mostly those with the highest tips. The transaction executes: the contract changes its state, the result is recorded.

5. Confirmations. Each subsequent block on top of yours adds confidence that the record will not be rolled back. On Ethereum finality - the guarantee a block will not be rewritten - arrives in about 13 minutes (two epochs). For practical purposes a few blocks are usually enough.

What a nonce is

The nonce is your address's transaction counter: 0, 1, 2… The network accepts them strictly in order. This protects against duplication: the same signed transaction cannot be executed twice because its nonce is already used.

A consequence that helps with problems: a transaction with nonce 5 will not execute until the one with nonce 4 has. If one is "stuck", all the following ones queue behind it.

Why a transaction "hangs"

The most common reason is too low a gas price. You sent the transaction when the network was quiet, the price rose, and it became unprofitable for validators to take yours. The transaction sits in the mempool.

What you can do:

  • Wait. Often load drops and the transaction passes by itself.
  • Speed up. Wallets let you send the same transaction (same nonce) with a higher gas price, and it replaces the old one.
  • Cancel. Send, with the same nonce, a zero-value transaction to yourself with a higher gas price.

Statuses in an explorer

  • Pending - in the mempool, not yet included.
  • Success - executed, the result recorded.
  • Failed (Reverted) - execution stopped by an error. The contract's state did not change, but gas is spent.

A contract error usually comes with a reason - for example "WrongStatus" or "NotAuthorized". Good interfaces translate these technical messages into plain language.

"The transaction was sent but the status does not update"

The interface learns the result by polling the network: it waits for a receipt to appear for the transaction hash. Sometimes a public node answers with a delay while the interface already shows "sent". It is not an error: wait a minute and refresh the page. The final truth is shown by a block explorer - see the article how to read Etherscan.

One of the most frequent transactions for tokens is the approval. It raises the most questions and risks: ERC-20 and approve. And to read what is happening on your own - the block explorer guide.

Mentioned in

Ready to try it?

Create your first deal in a couple of minutes. The money is locked in a smart contract and paid out by rules you can see in advance.