<blockquote>
  <p>If someone is sending bitcoin with low transaction fees and then sends the same bitcoin with higher transaction fees before the previous one is confirmed, so it is obvious that miners will pick the second one</p>
</blockquote>

<p>By default, the miner won't pick the second one, except the previous one had Opt-in RBF enabled.</p>

<p>However, technically or theoritically speaking, a miner always has the ability to pick any transaction he likes into his block template, so that he could mine such transaction(s) into his block. It's just the matter of whether his block would be widely accepted by the network (including other miners, non-mining full nodes which the wallet relied on, etc).</p>

<blockquote>
  <p>ethereum has nonce value of each transaction which avoids this, but how does bitcoin avoid it?</p>
</blockquote>

<p>I don't know much about Ethereum. As far as I know, the UTXO model itself is the equivalent of the nonce value, since each UTXO (uniquely identified with TXID and output index) could be spent only once, otherwise it would be an invalid transaction or block.</p>

<hr>

<p>Note that <em>the nonce value/UTXO model</em> and <em>double spending by forking the chain</em> are two distinct problems.</p>

<p>Without the nonce value/UTXO model, even an individual chain itself cannot rule out double spending or replayed transactions, which is actually inflation in bitcoin, or replay attack in ethereum (the replayed transaction would make the victim make another unexpected repeated payment, so he would lose money).</p>

<p>However, even with nonce value/UTXO model, the attacker can still produce forked chain to "rewrite the history" (in such case, the previous transaction would be actually discarded, which generally means the previous legitimate payment would be maliciously withdrawn), which is the reason why we need a consensus mechanism like proof-of-work.</p>

CC BY-SA 4.0
2020-05-11T05:38:42.580Z
2020-05-11T05:59:39.563Z
2020-05-11T05:59:39.563Z
Chris Chen
<blockquote>
<p>it is obvious that miners will pick the second one, so ethereum has nonce value of each transaction which avoids this, but how does bitcoin avoid it?</p>
</blockquote>
<p>Replace-by-fee is essentially Bitcoin creating a feature &quot;RBF&quot; on top of some behavior &quot;A&quot; (miners preferring the <em>second</em> transaction, or actually whichever transaction is economically preferable for the miner) refusing to consider the behavior &quot;A&quot; as a drawback, therefore consolidating &quot;A&quot; as a feature.</p>
<p>Double spending is still prevented by Bitcoin's high hashpower and by users waiting the number of recommended confirmations, both before and after replace-by-fee was invented.</p>
<p>A scenario requiring the possibility of accepting unconfirmed transactions as final without losing funds requires, as you know, a different crypto asset. Use different crypto tokens and networks for different needs. Bitcoin is a network for settlements ledger, not a network for fast payments.</p>

CC BY-SA 4.0
2021-10-03T09:24:02.663Z
2021-10-03T09:45:30.177Z
2021-10-03T09:45:30.177Z
Mercedes
<p>If someone is sending bitcoin with low transaction fees and then sends the same bitcoin with higher transaction fees before the previous one is confirmed, so it is obvious that miners will pick the second one, so ethereum has nonce value of each transaction which avoids this, but how does bitcoin avoid it?</p>

CC BY-SA 4.0
2023-03-28T13:12:45.757Z
Nonce doesn't prevent the scenario you mentioned in Ethereum. You can still create two transactions with the same nonce and the one with the higher fee will be taken by miners. Though wallets generally don't presume bad intent, so they just increment the nonce. Nothing prevents you from creating two transactions with the same nonce twice, manually by hand. In that case, only one will be mined/added to a block. The one with the higher fee.
The Quantum Physicist
<blockchain><doublespend><error><replace-by-fee>
How Bitcoin avoids double spending?
uzair kath
# How Bitcoin avoids double spending?

(Asked by: username_0 on 2020-05-10)

If someone is sending bitcoin with low transaction fees and then sends the same bitcoin with higher transaction fees before the previous one is confirmed, so it is obvious that miners will pick the second one, so ethereum has nonce value of each transaction which avoids this, but how does bitcoin avoid it?

**Tags:** blockchain, doublespend, error, replace-by-fee

> **Comments:**
> **username_1**: Nonce doesn't prevent the scenario you mentioned in Ethereum. You can still create two transactions with the same nonce and the one with the higher fee will be taken by miners. Though wallets generally don't presume bad intent, so they just increment the nonce. Nothing prevents you from creating two transactions with the same nonce twice, manually by hand. In that case, only one will be mined/added to a block. The one with the higher fee.  

---

## 2 answers

### Answer by username_2 on 2020-05-11. Score: 1

> If someone is sending bitcoin with low transaction fees and then sends the same bitcoin with higher transaction fees before the previous one is confirmed, so it is obvious that miners will pick the second one

By default, the miner won't pick the second one, except the previous one had Opt-in RBF enabled.

However, technically or theoritically speaking, a miner always has the ability to pick any transaction he likes into his block template, so that he could mine such transaction(s) into his block. It's just the matter of whether his block would be widely accepted by the network (including other miners, non-mining full nodes which the wallet relied on, etc).

> ethereum has nonce value of each transaction which avoids this, but how does bitcoin avoid it?

I don't know much about Ethereum. As far as I know, the UTXO model itself is the equivalent of the nonce value, since each UTXO (uniquely identified with TXID and output index) could be spent only once, otherwise it would be an invalid transaction or block.

---

Note that *the nonce value/UTXO model* and *double spending by forking the chain* are two distinct problems.

Without the nonce value/UTXO model, even an individual chain itself cannot rule out double spending or replayed transactions, which is actually inflation in bitcoin, or replay attack in ethereum (the replayed transaction would make the victim make another unexpected repeated payment, so he would lose money).

However, even with nonce value/UTXO model, the attacker can still produce forked chain to "rewrite the history" (in such case, the previous transaction would be actually discarded, which generally means the previous legitimate payment would be maliciously withdrawn), which is the reason why we need a consensus mechanism like proof-of-work.


---

### Answer by username_3 on 2021-10-03. Score: 0

> it is obvious that miners will pick the second one, so ethereum has nonce value of each transaction which avoids this, but how does bitcoin avoid it?

Replace-by-fee is essentially Bitcoin creating a feature "RBF" on top of some behavior "A" (miners preferring the *second* transaction, or actually whichever transaction is economically preferable for the miner) refusing to consider the behavior "A" as a drawback, therefore consolidating "A" as a feature.

Double spending is still prevented by Bitcoin's high hashpower and by users waiting the number of recommended confirmations, both before and after replace-by-fee was invented.

A scenario requiring the possibility of accepting unconfirmed transactions as final without losing funds requires, as you know, a different crypto asset. Use different crypto tokens and networks for different needs. Bitcoin is a network for settlements ledger, not a network for fast payments.


---

