1

It's said nonce is used to prevent reply/double-spending attack. But an adversary can send two transactions with the same nonce, and the rest of scenario will be the same as in Bitcoin.

Question 1: How does nonce really help to prevent double spending attack?

Question 2: Using nonce would relief us from 6 confirmations?


Edit: By nonce I mean the once included in each transaction in Ethereum.

4

How does nonce really help to prevent double spending attack?

If there are 2 transactions with the same nonce and from same account, the transaction that is first included in the blockchain will be considered as valid and the other one will be rejected.

This is the concept used to override transactions in ethereum. If you have a pending transaction and you want to override it, you can send the same transaction with same nonce and a higher gas price (so that the later transaction gets mined). So if the later transaction is mined, the previous one becomes invalid.

Using nonce would relief us from 6 confirmations?

The 6 confirmations will be needed apart from using nonce. Using nonce you could prevent same transaction being included in blockchain.But there is a chance that the block in which your this transaction is included do not end up in the longest chain and hence you need to wait for some more blocks for confirmation.

2

The nonce allows the Ethereum nodes to put transactions from the same account in time order.

If an initiating account, for example, has 10 ether, and it tries to send two six ether transactions, the first one will be processed (and will change the account's balance to 4), and the second one will fail (because there's not enough to cover). In other words, the account can't spend more than it has.

AFAIK, the nonce has no effect on the suggested wait for multiple confirmations before considering a transaction final.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.