Questions tagged [nonce]

A random number that is only used once. It is generated at the beginning of a communication by one communication partner and has to be sent back by the other one in order to prevent replay attacks.

Filter by
Sorted by
Tagged with
36
votes
2answers
22k views

What is nonce in Ethereum? How does it prevent double spending?

recently I got fascinated by blockchain, and started learning Ethereum. I came across the concept of the nonce in Ethereum. After researching I found out that nonce is used for two purposes. a. To ...
32
votes
3answers
4k views

Concurrency patterns for account nonce

The account nonce is the only element in the transaction structure that prevents replay attack (as explained in this very good answer). It essentially forces sequentialisation of an account's ...
35
votes
3answers
12k views

What happens when a transaction nonce is too high?

From Design Rationale: One weakness of the account paradigm is that in order to prevent replay attacks, every transaction must have a "nonce", such that the account keeps track of the nonces used ...
18
votes
3answers
5k views

How does the Ethereum ETH accounting system work and prevent double-spends?

In Bitcoin, the BTC accounting system is based on UTXOs (Unspent Transaction Outputs), which prevents the same BTC from being spent multiple times. I heard that Ethereum has a simpler account balance ...
33
votes
2answers
5k views

Do contracts also have a nonce?

Do contracts also have a nonce and if so how is it calculated? Usual accounts have a nonce that is increased with every transaction. However, contracts can't make transactions, they can only make ...
9
votes
2answers
4k views

Truffle + Infura on Mainnet: Nonce too low error

I have the following code: const Contract = artifacts.require('./Market.sol'); module.exports = async function(callback) { let instance = await Contract.deployed(); for(var i = 0; i <=200; i+...
2
votes
1answer
220 views

Can I use any nonce as long as it is not previously been used?

When creating raw transactions, do I have to increase the nonce always in increments of 1 or can I use any nonce as long as it has not been used before? Are there any specific rules? Could I also go ...
4
votes
1answer
3k views

How to properly set nonce in a web3 contract invocation?

I have this code, which works: MyToken.airdrop(wallets,amounts,{ gas: 1267051, gasPrice: 2000000000, },function(err,tx){ console.log('err is %s',err) console.log('tx is %s',tx) callback(err,...
2
votes
1answer
661 views

Is it possible to get the transaction count for a contract in Solidity?

Is there built-in functionality for getting the transaction count (nonce) for an account in Solidity?
1
vote
2answers
1k views

Transaction stuck because of low gas price

i accidentally put the lowest gas price possible when i am about to send my eth.. is there any way to cancel / re-make my transaction?? i have read some articles telling that i should out-gassed my ...
0
votes
1answer
1k views

How to get current nonce that I need to send along with a transaction?

I wish you send nonce with every transaction so that I can store my nonce in DB and can override a specific transaction if it is pending for a while. I know I can use eth.getTransactionCount("...
5
votes
1answer
3k views

Transaction nonce management

Since transactions require a nonce that is one more than the previously mined transaction for a given address, what happens if someone sent a transaction with a low gas price that was refused by ...
8
votes
1answer
569 views

Testnet First Transaction Nonce

I'm implementing a back end with different Ethereum features. I need to be able to create raw transactions. I've successfully did it using Web3 sendRawTransaction from Node.JS, but I wonder how should ...
3
votes
2answers
352 views

how many transactions could be included in a new block from the same account?

How many transactions could be included in the next new block from the same account? From my understanding, every transaction would have a unique nonce. This nonce of an account would be increased by ...
2
votes
2answers
941 views

Why do contracts start with nonce 1?

This is a follow-up to this question. The accepted answer says: Yes, contracts have nonces. A nonce of a contract is only incremented when that contract creates another contract [...]. When a ...
1
vote
1answer
2k views

Getting and setting the nonce for a transaction

I'm using a javascript library (etheremjs) to sign a transaction. When creating it, it asks for the nonce field. I researched about it and partially understood it. But my main problem is: How do I ...
7
votes
1answer
800 views

Why am i getting “removed tx from pool: low tx nonce or out of funds”?

The account I am using to submit the transaction has 10490 ETH (1.0585e+22 Wei). The transaction cost is 20477 Gas, and gas price is 300000000000. Here is the output from Geth: I0330 22:28:05.762119 ...
4
votes
1answer
296 views

How can empty accounts with a nonce of zero appear on the blockchain?

Recently I have heard about zero balance accounts with a nonce of zero appearing on the blockchain. My understanding is that any account that has been used in a transaction must have a nonce greater ...
3
votes
1answer
103 views

Is it possible to give a contract the same address from morden

I think I just lost a fraction of Ether. I accidentally sent it to the main network, but my contract only existed on Morden. I'm wondering: Can I deploy the contract retroactively? Is the address ...
0
votes
1answer
311 views

the tx doesn't have the correct nonce. account has nonce of: 12 tx has nonce of: 3 - Ganache

I am trying to run my simple contract with different parameters (in the form of encoded signatures) and intends to put multiple transaction into ONE block. If I set Ganache GUI with automine option, ...