<p>If a block is mined on top of block A (let's call it block C), when Node B hears about block C, it will change its blockchain state to have block C as its tip and block B will become orphaned. This is because block C's chain has more work than block B's chain.</p>

<p>Seeing a double spend in blocks as you describe it does not make a block invalid. If I see a conflicting transaction in block A and block B, that conflict does not make one of those blocks invalid to me.</p>

CC BY-SA 3.0
2017-10-02T14:46:49.820Z
Thanks for the response Andrew. so the whole block will not be declared invalid. only that  transaction will be made invalid. depending on which block  gets accepted. am I correct?
Kid101
CC BY-SA 3.0
2017-10-02T14:58:10.490Z
Yes, that is correct.
Ava Chow
CC BY-SA 3.0
2017-10-02T15:11:55.170Z
another quick question andrew if you can spare a few minutes. Lets bring into picture orphaned blocks. what if the produced block is orphaned.. How does a Node merge with the longest chain in this case when it has a orphaned block at it's tip?
Kid101
CC BY-SA 3.0
2017-10-02T15:14:41.630Z
Nothing is merged. It just switches to using the chain with the most work. It discovers this chain because it will hear about blocks from its peers. Its peers will announce a block which it does not have so it will fetch that block. That block will have a parent it does not have (or it ignored because it conflicted with its current blockchain because its best block and that block have the same parent) so it fetches that block. Since the chain containing this new block has more work than the chain containing the node's best block, it will simply switch to using that other chain.
Ava Chow
CC BY-SA 3.0
2017-10-02T15:27:58.393Z
got it. Thanks Andrew. I'll keep learning Blockchain mean while.
Kid101
CC BY-SA 3.0
2017-10-02T14:35:05.710Z
2017-10-02T14:35:05.710Z
Ava Chow
<p>I'm a newbie to cryto and wanted understand this. 
what happens to the  chain when the isolated block is formed (in case of a double spend) ? Since chains only add blocks that come from the  longest running chain. it could be easily possible that initially 2 nodes proposed 2 blocks at the same time of the double spend attack. so </p>

<p>Node A -Block A(Double Spend) </p>

<p>Node B- Block B (Genuine)  </p>

<p>Both have same length at this time but Node A decides to go rouge.</p>

<p>Lets consider Node C is close to Node A and hears block A. it adds it to it's block Chain. now another Node D hears about both Block B and A and decides to add A since it's coming from the longest blockchain. Now, It's a successful double spend if the customer didn't wait for any validations.
(But the money is only spend once as we can see Block B is not accepted by any other blocks)</p>

<p>In this case Block B is orphaned.. How does not Node B redeem itself?? How does the Node B add new chain to it's orphaned Block. I guess the orphaned one is just left there and the new Node is added from the previous block.</p>

<p>For easier understanding:I was considering one transaction per block. ;)</p>

<blockquote>
  <p>Edit: Anyone Coming to this page may find this Flow helpful:</p>
  
  <p>1) New transactions are broadcast to all nodes. </p>
  
  <p>2) Each node collects new transactions to form block.</p>
  
  <p>3) Each node competes with one another to  solve the  mining puzzle
  (Proof of Work)for its block.</p>
  
  <p>4) When a node cracks the puzzle, it broadcasts the block to all
  nodes.</p>
  
  <p>5) Nodes accept the block only if all transactions in it are valid and
  not already spent.</p>
  
  <p>6) Nodes express their acceptance of the block by working on creating
  the next block in the chain, using the hash of the accepted block as
  the previous hash.</p>
  
  <p>Nodes always consider the longest chain to be the correct one and will
  keep working on extending it. If two nodes broadcast different
  versions of the next block simultaneously, some nodes may receive one
  or the other first. In that case, they work on the first one they
  received, but save the other branch in case it becomes longer. The tie
  will be broken when the next block is found and one branch becomes
  longer; the nodes that were working on the other branch will then
  switch to the longer one branch.
  Also to prevent double spend it creates a DB of Unspent Bitcoin and validates every transaction based on that.<a href="https://bitcoin.stackexchange.com/questions/28225/how-is-a-transaction-output-marked-as-spent#">How is a transaction verified</a> </p>
</blockquote>

<blockchain><bitcoin-core><doublespend><consensus>
do isolated blocks create forks in block chain? (with forks I mean branches that are no longer valid) If yes then how does the node redeem itself?
Kid101
# do isolated blocks create forks in block chain? (with forks I mean branches that are no longer valid) If yes then how does the node redeem itself?

(Asked by: username_0 on 2017-10-02)

I'm a newbie to cryto and wanted understand this.
what happens to the chain when the isolated block is formed (in case of a double spend) ? Since chains only add blocks that come from the longest running chain. it could be easily possible that initially 2 nodes proposed 2 blocks at the same time of the double spend attack. so

Node A -Block A(Double Spend)

Node B- Block B (Genuine)

Both have same length at this time but Node A decides to go rouge.

Lets consider Node C is close to Node A and hears block A. it adds it to it's block Chain. now another Node D hears about both Block B and A and decides to add A since it's coming from the longest blockchain. Now, It's a successful double spend if the customer didn't wait for any validations.
(But the money is only spend once as we can see Block B is not accepted by any other blocks)

In this case Block B is orphaned.. How does not Node B redeem itself?? How does the Node B add new chain to it's orphaned Block. I guess the orphaned one is just left there and the new Node is added from the previous block.

For easier understanding:I was considering one transaction per block. ;)

> Edit: Anyone Coming to this page may find this Flow helpful:
>
> 1) New transactions are broadcast to all nodes.
>
> 2) Each node collects new transactions to form block.
>
> 3) Each node competes with one another to solve the mining puzzle
> (Proof of Work)for its block.
>
> 4) When a node cracks the puzzle, it broadcasts the block to all
> nodes.
>
> 5) Nodes accept the block only if all transactions in it are valid and
> not already spent.
>
> 6) Nodes express their acceptance of the block by working on creating
> the next block in the chain, using the hash of the accepted block as
> the previous hash.
>
> Nodes always consider the longest chain to be the correct one and will
> keep working on extending it. If two nodes broadcast different
> versions of the next block simultaneously, some nodes may receive one
> or the other first. In that case, they work on the first one they
> received, but save the other branch in case it becomes longer. The tie
> will be broken when the next block is found and one branch becomes
> longer; the nodes that were working on the other branch will then
> switch to the longer one branch.
> Also to prevent double spend it creates a DB of Unspent Bitcoin and validates every transaction based on that.[How is a transaction verified](https://bitcoin.stackexchange.com/questions/28225/how-is-a-transaction-output-marked-as-spent#)

**Tags:** blockchain, bitcoin-core, doublespend, consensus


---

## 1 answers

### Answer by username_1 on 2017-10-02. Score: 0

If a block is mined on top of block A (let's call it block C), when Node B hears about block C, it will change its blockchain state to have block C as its tip and block B will become orphaned. This is because block C's chain has more work than block B's chain.

Seeing a double spend in blocks as you describe it does not make a block invalid. If I see a conflicting transaction in block A and block B, that conflict does not make one of those blocks invalid to me.

> **Comments:**
> **username_0**: Thanks for the response Andrew. so the whole block will not be declared invalid. only that  transaction will be made invalid. depending on which block  gets accepted. am I correct?  
> **username_1**: Yes, that is correct.  
> **username_0**: another quick question andrew if you can spare a few minutes. Lets bring into picture orphaned blocks. what if the produced block is orphaned.. How does a Node merge with the longest chain in this case when it has a orphaned block at it's tip?  
> **username_1**: Nothing is merged. It just switches to using the chain with the most work. It discovers this chain because it will hear about blocks from its peers. Its peers will announce a block which it does not have so it will fetch that block. That block will have a parent it does not have (or it ignored because it conflicted with its current blockchain because its best block and that block have the same parent) so it fetches that block. Since the chain containing this new block has more work than the chain containing the node's best block, it will simply switch to using that other chain.  
> **username_0**: got it. Thanks Andrew. I'll keep learning Blockchain mean while.  

---

