<p>An attack that attempts to outpace the mining power of the whole network by itself is called a <a href="/questions/tagged/majority-attack" class="post-tag" title="show questions tagged &#39;majority-attack&#39;" rel="tag">majority-attack</a> or &quot;51%-attack&quot;. Concretely, your example is a <a href="/questions/tagged/doublespend" class="post-tag" title="show questions tagged &#39;doublespend&#39;" rel="tag">doublespend</a> attack by means of a majority attack. When the attacker publishes their chain-tip, each node performs a <a href="/questions/tagged/chain-reorganization" class="post-tag" title="show questions tagged &#39;chain-reorganization&#39;" rel="tag">chain-reorganization</a> to switch to the best chain.</p>
<p>Concretely, the blocks <code>B4</code> and <code>O1</code> both share the hash of <code>B3</code> as their <code>prevHash</code>. Once the attacker announces the blocks <code>O1-&gt;O2-&gt;O3-&gt;O4</code>, other nodes will notice that this chain-tip has more total work, find the last shared ancestor in the blockchain (<code>B3</code>), revert all blocks up to the shared ancestor, and then apply the new blocks to converge on the best chain-tip.</p>
<p>A <a href="/questions/tagged/blockchain-fork" class="post-tag" title="show questions tagged &#39;blockchain-fork&#39;" rel="tag">blockchain-fork</a> and chain reorganization can also happen benignly when two miners happen to find a block at the same moment. At that point the network's nodes are split in opinion what the best chain is, since each node considers the block it first saw to be the correct one. Once another block extends one of the two chain-tips, the network converges on the best chain as the nodes hear about the new block.</p>

CC BY-SA 4.0
2020-09-21T20:10:36.157Z
2020-09-21T20:10:36.157Z
Murch
<p>Let's say the valid blockchain that Node A has is: <code>B1-&gt;B2-&gt;B3</code></p>
<p>Now, I am gonna cheat since I have lots of  computing power. What I do is I download the above blockchain that Node A has and start cheating. Before I do that, I make a transaction to buy a motorbike. so,
valid blockchain now looks like this (<code>B1-&gt;B2-&gt;B3-&gt;B4</code>). <code>B4</code> has my bike transactions. In my local copy, I didn't put that transaction . Now, because I want to have a longest chain, I work so fast and let's say after a while Node A's chain and mine looks like this:</p>
<p>Node A - <code>B1-&gt;B2-&gt;B3-&gt;B4-&gt;B5</code></p>
<p>Mine - <code>B1-&gt;B2-&gt;B3-&gt;O1-&gt;O2-&gt;O3-&gt;O4</code></p>
<p>Now, I want to broadcast my chain.</p>
<p>What do I broadcast? The whole chain (<code>B1-&gt;B2-&gt;B3-&gt;O1-&gt;O2-&gt;O3-&gt;O4</code>) or only <code>O1-&gt;O2-&gt;O3-&gt;O4</code>?</p>
<p>A) If I broadcast only <code>O1-&gt;O2-&gt;O3-&gt;O4</code>, how does node A figure out that it has to remove <code>B4-&gt;B5</code> only from its chain and append <code>O1-&gt;O2-&gt;O3-&gt;O4</code> to <code>B3</code>? Does it first get <code>O1</code>'s prev hash and then in its local blockchain, it searches the block with that hash and if it finds that hash, it removes every block after it and appends the newly copied <code>O1-&gt;O2-&gt;O3-&gt;O4</code> from my chain? If so, it would also account for if the new one is the longest one (so the count of the removals of the blocks should be less than the count of new copied blocks). Am I right ?</p>
<p>B) of course, broadcasting the whole chain is out of question since it's so huge.</p>

<doublespend><majority-attack><chain-reorganization><best-chain>
How does longest chain propagation take place in bitcoin?
Nika Kurashvili
# How does longest chain propagation take place in bitcoin?

(Asked by: username_0 on 2020-09-21)

Let's say the valid blockchain that Node A has is: `B1->B2->B3`

Now, I am gonna cheat since I have lots of computing power. What I do is I download the above blockchain that Node A has and start cheating. Before I do that, I make a transaction to buy a motorbike. so,
valid blockchain now looks like this (`B1->B2->B3->B4`). `B4` has my bike transactions. In my local copy, I didn't put that transaction . Now, because I want to have a longest chain, I work so fast and let's say after a while Node A's chain and mine looks like this:

Node A - `B1->B2->B3->B4->B5`

Mine - `B1->B2->B3->O1->O2->O3->O4`

Now, I want to broadcast my chain.

What do I broadcast? The whole chain (`B1->B2->B3->O1->O2->O3->O4`) or only `O1->O2->O3->O4`?

A) If I broadcast only `O1->O2->O3->O4`, how does node A figure out that it has to remove `B4->B5` only from its chain and append `O1->O2->O3->O4` to `B3`? Does it first get `O1`'s prev hash and then in its local blockchain, it searches the block with that hash and if it finds that hash, it removes every block after it and appends the newly copied `O1->O2->O3->O4` from my chain? If so, it would also account for if the new one is the longest one (so the count of the removals of the blocks should be less than the count of new copied blocks). Am I right ?

B) of course, broadcasting the whole chain is out of question since it's so huge.

**Tags:** doublespend, majority-attack, chain-reorganization, best-chain


---

## 1 answers

### Answer by username_1 on 2020-09-21. Score: 1 | Accepted answer

An attack that attempts to outpace the mining power of the whole network by itself is called a [majority-attack](/questions/tagged/majority-attack "show questions tagged 'majority-attack'") or "51%-attack". Concretely, your example is a [doublespend](/questions/tagged/doublespend "show questions tagged 'doublespend'") attack by means of a majority attack. When the attacker publishes their chain-tip, each node performs a [chain-reorganization](/questions/tagged/chain-reorganization "show questions tagged 'chain-reorganization'") to switch to the best chain.

Concretely, the blocks `B4` and `O1` both share the hash of `B3` as their `prevHash`. Once the attacker announces the blocks `O1->O2->O3->O4`, other nodes will notice that this chain-tip has more total work, find the last shared ancestor in the blockchain (`B3`), revert all blocks up to the shared ancestor, and then apply the new blocks to converge on the best chain-tip.

A [blockchain-fork](/questions/tagged/blockchain-fork "show questions tagged 'blockchain-fork'") and chain reorganization can also happen benignly when two miners happen to find a block at the same moment. At that point the network's nodes are split in opinion what the best chain is, since each node considers the block it first saw to be the correct one. Once another block extends one of the two chain-tips, the network converges on the best chain as the nodes hear about the new block.


---

