<p>If there is a double spend attempt, there is no way for a node to know <em>"which chain (transaction) actually came first and is legitimate"</em>. Some nodes may hear about the 'legit' chain first, some may hear about the double-spend chain first. </p>

<p>So, if the rule states that nodes work to avoid reorgs in case of a double spend, then we would expect the network to split at the occurrence of a double spend. Consider: what happens if there is a double-spend attempt, and the first chain your node hears about is the one that is soon-to-be the shorter chain? You would be stuck on an orphan chain, while the rest of the network marches onward. This is obviously not good, as network consensus and reliability is important. </p>

<blockquote>
  <p>c) For nodes that receive only one chain, accept it if it does not require a reorganization.</p>
</blockquote>

<p>If the node only receives one chain, then it will <em>never</em> require a reorg. Only a node that receives an alternative, longer chain will reorg.</p>

<blockquote>
  <p>..accepting the longest chain blindly? Shouldn't we check the block contents from both chains before deciding which one to accept?</p>
</blockquote>

<p>I would not say chains are accepted <em>blindly</em>, acceptance requires the chain to be valid according to all of the network's rules. Your node <em>will</em> check the contents of new blocks, but as I mentioned above, <strong>there is no way to reliably distinguish a 'legit' transaction from a 'double spend' transaction, at a network-consensus level</strong>. </p>

CC BY-SA 4.0
2018-07-05T20:38:10.967Z
2018-07-05T20:38:10.967Z
chytrik
<blockquote>
  <p>Wouldn't this be better in avoiding double-spending than the current protocol, i.e. accepting the longest chain blindly? Shouldn't we check the block contents from both chains before deciding which one to accept?</p>
</blockquote>

<p>Where do you read that the longest chain is accepted blindly? Of course, no chain with double spending in it is valid - that would completely defeat the purpose.</p>

<p>What does happen (at least in Bitcoin Core) is that the check for double spending and signature validity only happens after a particular chain becomes the most-work chain. But it isn't treated as the accepted best chain until it is fully validated. If a double spend or invalid signature is found in a candidate best chain, that chain is discarded, and the selection algorithm will revert to the second most work chain, and fully verify that.</p>

<p>The reason for delaying the double spending and script checks until a block is in the most work chain is to save resources. These checks are many times more computationally expensive to perform than all other validation rules combined, so we perform them lazily.</p>

CC BY-SA 4.0
2018-07-06T17:20:27.027Z
2018-07-06T17:20:27.027Z
Pieter Wuille
<p>Can we make the following changes to the current POW protocol to better avoid double-spending:</p>

<p>a) For full/mining nodes that receive two chains, check if there are identical addresses that occur on both chains that perform double-spending. If there are any, ignore the chain that would result in the node doing a reorganization (<em>reorg</em>), choose the other chain;</p>

<p>b) If there is none, choose the longer chain;</p>

<p>c) For nodes that receive only one chain, accept it if it does not require a reorganization.</p>

<p>Wouldn't this be better in avoiding double-spending than the current protocol, i.e. accepting the longest chain blindly? Shouldn't we check the block contents from both chains before deciding which one to accept?</p>

CC BY-SA 4.0
2018-07-06T01:11:22.720Z
What do you mean by "that perform double-spending" exactly? Do you mean that the two chains have two different transactions that each spend the same output? If so, are you suggesting every node just stick to the one it saw first?
David Schwartz
<blockchain><client><blockchain-fork>
Why choose the longest chain before checking for double-spending?
Danny
# Why choose the longest chain before checking for double-spending?

(Asked by: username_0 on 2018-07-05)

Can we make the following changes to the current POW protocol to better avoid double-spending:

a) For full/mining nodes that receive two chains, check if there are identical addresses that occur on both chains that perform double-spending. If there are any, ignore the chain that would result in the node doing a reorganization (*reorg*), choose the other chain;

b) If there is none, choose the longer chain;

c) For nodes that receive only one chain, accept it if it does not require a reorganization.

Wouldn't this be better in avoiding double-spending than the current protocol, i.e. accepting the longest chain blindly? Shouldn't we check the block contents from both chains before deciding which one to accept?

**Tags:** blockchain, client, blockchain-fork

> **Comments:**
> **username_1**: What do you mean by "that perform double-spending" exactly? Do you mean that the two chains have two different transactions that each spend the same output? If so, are you suggesting every node just stick to the one it saw first?  

---

## 2 answers

### Answer by username_2 on 2018-07-05. Score: 1

If there is a double spend attempt, there is no way for a node to know *"which chain (transaction) actually came first and is legitimate"*. Some nodes may hear about the 'legit' chain first, some may hear about the double-spend chain first.

So, if the rule states that nodes work to avoid reorgs in case of a double spend, then we would expect the network to split at the occurrence of a double spend. Consider: what happens if there is a double-spend attempt, and the first chain your node hears about is the one that is soon-to-be the shorter chain? You would be stuck on an orphan chain, while the rest of the network marches onward. This is obviously not good, as network consensus and reliability is important.

> c) For nodes that receive only one chain, accept it if it does not require a reorganization.

If the node only receives one chain, then it will *never* require a reorg. Only a node that receives an alternative, longer chain will reorg.

> ..accepting the longest chain blindly? Shouldn't we check the block contents from both chains before deciding which one to accept?

I would not say chains are accepted *blindly*, acceptance requires the chain to be valid according to all of the network's rules. Your node *will* check the contents of new blocks, but as I mentioned above, **there is no way to reliably distinguish a 'legit' transaction from a 'double spend' transaction, at a network-consensus level**.


---

### Answer by username_3 on 2018-07-06. Score: 1

> Wouldn't this be better in avoiding double-spending than the current protocol, i.e. accepting the longest chain blindly? Shouldn't we check the block contents from both chains before deciding which one to accept?

Where do you read that the longest chain is accepted blindly? Of course, no chain with double spending in it is valid - that would completely defeat the purpose.

What does happen (at least in Bitcoin Core) is that the check for double spending and signature validity only happens after a particular chain becomes the most-work chain. But it isn't treated as the accepted best chain until it is fully validated. If a double spend or invalid signature is found in a candidate best chain, that chain is discarded, and the selection algorithm will revert to the second most work chain, and fully verify that.

The reason for delaying the double spending and script checks until a block is in the most work chain is to save resources. These checks are many times more computationally expensive to perform than all other validation rules combined, so we perform them lazily.


---

