Nonce
Número usado uma única vez em uma operação criptográfica; na mineração, é o valor que os mineradores ajustam para encontrar um hash válido para o bloco.
Key points
- Nonce is a single-use number employed in cryptographic operations to ensure that each attempt or transaction is distinct.
- In proof-of-work mining, it is the value miners repeatedly change until they find a hash that meets the network's target.
- In transaction accounts, a sequential nonce also serves to order operations and prevent the same transaction from being replayed.
What is a nonce?
Nonce comes from the English expression "number used once." It is a value included in a cryptographic operation precisely to make it unique, preventing results from being repeated or reused. The concept appears in different contexts within crypto, always with the function of giving uniqueness or order to some operation.
How it works
In proof-of-work mining, the miner assembles a block and calculates its hash. Since the goal is to find a hash below a defined target, and since there is no shortcut, the miner repeatedly changes the nonce and recalculates the hash with each attempt. Each nonce value produces a completely different hash, and the search continues until one of them satisfies the condition. Finding that nonce is the proof that the work was done.
In another context, each account sending transactions usually has a sequential nonce that numbers its operations. This number guarantees the correct order of transactions and prevents the same signed transaction from being processed twice, a problem known as replay. If the expected nonce does not match, the network rejects or delays the transaction.
In both cases, the nonce fulfills the role of providing uniqueness: in mining, to vary the hash; in accounts, to order and protect transactions against replay.
Why it matters
The nonce is a discreet but essential piece of how networks function. In mining, it is what miners are actually searching for. In transactions, understanding the nonce helps diagnose why an operation got stuck: an out-of-order nonce can block subsequent transactions until it is resolved.
Limitations
The concept is technical and rarely appears to the average user, who interacts with wallets that manage the nonce automatically. Even so, nonce issues, such as transactions sent out of order, can block operations and require manual intervention. Reusing a nonce where it should be unique can also open security gaps. In general, though, it is an infrastructure detail that remains invisible to anyone who simply uses a wallet.