Why Do Pending Transactions Queue?
Treat the transaction pool as a waiting room: see how one nonce can be replaced and why invalid transactions wait to be rejected.
- Separate a pending queue from confirmed state
- Explain the nonce order for one account
- Watch a replacement keep the sequence number while changing the signed payload
- PREVIOUSWho Authorized This Transfer?
- CURRENTWhy Do Pending Transactions Queue?
Treat the transaction pool as a waiting room: see how one nonce can be replaced and why invalid transactions wait to be rejected.
- NEXTWhy Must the Same Transactions Have the Same Order?
Think about these questions first.
Choose an answer before opening the explanation. You can add anything unexpected to your review list.
Q01Two pending transactions share a nonce. Can both pay?+
A single account nonce can execute only once in sequence. Nodes may temporarily see multiple candidates, but once one enters state, the others with that nonce become invalid.
After broadcast, a transaction does not immediately change a balance. It enters a node's transaction pool while a block producer decides whether, when, and in what order to execute it. Treat this pool as a public waiting room.
Pending means signed, not applied
A pending transaction has been signed by a wallet, but it is not yet a state transition that every node accepts. It can still fail because of an insufficient balance, a wrong nonce, an invalid signature, or a competing transaction using the same sequence number.
一笔交易如何变成状态?
交易先被签名和广播,再由节点验证并打包进区块。任何一步不满足规则,余额都不会改变。
- Nonce
- 0
- 公钥
- pk_alice_demo
- Nonce
- 0
- 公钥
- pk_bob_demo
- Nonce
- 0
- 公钥
- pk_you_demo
还没有交易。先用正确 Nonce 广播一笔转账。
先广播一笔交易,再用相同 Nonce 替换它。比较替换前后的签名摘要和 Pending 状态。
先看三张账户余额和 Nonce。签名只授权一组具体字段,节点还要在打包时检查 Nonce、余额和状态规则。
还没有区块。交易先在本地 Pending,等节点打包。
- 01
创世状态:三个账户各有 1,000 积分,Nonce 从 0 开始。
Use the slider to return to an earlier step. Continuing from there replaces the later history with a new sequence.
Watch the queue: after broadcast, balances and nonces stay unchanged. Only mining makes the node execute the transactions.
The same nonce can be replaced, but not applied twice
If a pending transaction is no longer what you want, a wallet can broadcast a new version with the same nonce. The state machine can only make that sequence number succeed once; an older version does not cause a second debit after replacement.
Expand: how this step works
replace(pending, nextAmount):
require pending.status == PENDING
pending.amount = nextAmount
pending.signature = sign(pending.fields)
mine(queue):
for tx in queue:
if tx.nonce == account[tx.from].nonce and verify(tx):
apply(tx)
else:
reject(tx)
Real chains also use a higher fee to make replacement attractive to block producers. The core constraint remains: one nonce is one slot in an account's state machine.