What is the Transaction nonce?

What is the Transaction nonce?

What is a nonce?

A scalar value adequate to the number of transactions sent from this address or, within the case of the accounts with associated code, the number of contact creations made by this account.


This number represents the number of confirmed transactions sent from the account’s address.

For contract Address:

The nonce is that the number of contracts created by the account.

It’s important to notice that the utilization of nonce is really vital for an account-based protocol, in contrast to the “unspent transaction output” (UTXO) mechanism of the Bitcoin protocol.

What does it matter?

This value prevents double-spending because the nonce will always specify the order of transactions. If a double-spend does occur, it’s typically thanks to the subsequent process.

A transaction is shipped to at least one party.
They await it to register.
Something is collected from this first transaction.
Another transaction is quickly sent with a high gas price.
The second transaction is mined first, therefore invalidating the primary transaction.

In Ethereum, this method of “double spending” isn’t possible because each transaction features a nonce included with it. albeit you plan to do the above, It will not work because the second transaction(nonce of 3) can’t be mined before the primary transaction(nonce of 2).

All deals of Ethereum are grounded on account, which is different from bitcoin grounded on utxo. Thus, each sale needs to be recorded in order. The nonce value is in this order. The nonce is the trait of the original address of the sale. It isn’t stored on the Ethereum blockchain, but calculated by calculating the number of deals transferred from an address.

nonce 1

For each sale initiated, nonce adds one. For the explanation of the inauguration
1. Each sale transferred by external account (EOA);
2. Contract Portmanteau

The transfer in the salecontract call, and other contracts belong to the internal call, so the nonce value remains unchanged.

Part 1 sale order
Suppose you want to shoot two deals with values of 1 and 4 Eth and want them to be packaged successionally. After transferring a sale, you continue to shoot an alternate sale.
Now, without arbitrary figures, it’s unsolvable for miners to know your intention to maintain sale order.
Stillalso the nonce of the 4 eth sale is 1 If the nonce of your first sale (1 ETH) is 0 ( assuming a new account). The miner can pack the sale in the order of nonce.

Function 2: prevent replay attack

If there is no nonce during transfer, the parameters are as follows;

    " value":" 10000000000000000000“, // 10 ETH
    " data"""
    "DSA, some of your signatures"
After the transaction is serialized, for example:
After the sale is packaged, the other party will admit 10 eth, but anyone can see the saledupe and bury it, submit it to Ethereum’s network constantly, and exhaust your balance, which is calledrenewal attack.

Still, the same nonce sale can only be packaged formerly, If a sale contains nonce.

Mansoor Ahmed is Chemical Engineer, web developer, a writer currently living in Pakistan. My interests range from technology to web development. I am also interested in programming, writing, and reading.
Posts created 422

Related Posts

Begin typing your search term above and press enter to search. Press ESC to cancel.

Back To Top