<p>When a node discovers a new block, it will send an (unsolicited) <code>inv</code> (inventory message) to announce the new block to its peers. The peers should then respond by sending a <code>getdata</code> message requesting either the header, or the complete block.<br>
The <a href="https://bitcoin.org/en/developer-reference#data-messages" rel="nofollow noreferrer">Developer Reference</a> describes the exchanged messages in more detail.</p>

<p>The nodes will then check the header, and each included transaction for adherence to the consensus rules. Most likely they will immediately start mining new empty blocks on basis of the header (as they don't know which transactions are still unconfirmed), then switch to mining a non-empty block once the received block was validated.</p>

<p>Each block includes a transaction that sends the mining reward to its miner. Other nodes cannot change this transaction as the block wouldn't be valid anymore. See <a href="https://bitcoin.stackexchange.com/q/4571/5406">What is the coinbase?</a></p>

<p>When two blocks <code>1A</code> and <code>1B</code> are found at the same time, each chain-tip will be considered valid by a portion of the network. Once a new block <code>2</code> is found, it can only extend one of the two chain-tips (here <code>1A→2A</code>), thus distinguishing one of the two chain-tips as part of the chain with the most work. As nodes hear about this new block <code>2A</code>, they will discard their stale chain-tip <code>1B</code> and reorganize to "longest chain" <code>1A→2A</code>.<br>
As it is unlikely that any chain building on <code>1B</code> will ever be able to overtake the <code>1A→2A</code> chain, miners would be wasting their power to continue to work on the obsoleted chain. Thus, the network is strongly incentivized to converge on the one chain with the most work.</p>

CC BY-SA 3.0
2016-09-08T11:44:46.193Z
Won't the new non-empty block generate a different hash, since the merkle-tree is different? Why would a miner start mining an empty block?
BlockChange
CC BY-SA 3.0
2016-09-08T11:56:19.987Z
Of course it'll have a different hash. But that's what mining is about: to try as many different hashes as possible until one fits the required difficulty. They'll start with an empty block (only coinbase) because they don't know which transactions they can include as they haven't validated the previous block yet.
Murch
CC BY-SA 4.0
2018-07-23T12:49:13.650Z
This is a fine answer but it is a bit outdated now due to Compact Blocks (BIP 152) and FIBRE.
G. Maxwell
CC BY-SA 3.0
2016-09-08T11:33:05.247Z
2017-12-08T22:28:16.050Z
2017-12-08T22:28:16.050Z
Murch
<p>I understand how a new block gets created, and verified by the miner that created it.</p>

<p>But then, does it advertise this new block to near nodes? And how do these nodes go about verifying this? Do they stop mining their own blocks? </p>

<p>How do you prevent from other nodes stealing the new block and pretending its their own? (I guess the transfer included with their own address prevents this?)</p>

<p>I understand there can be multiple branches at the same time, and eventually one survives, but how is it prevented that multiple branches keep living for an extended period?</p>

CC BY-SA 3.0
2016-09-08T11:33:40.877Z
In the future, please only ask about one topic per question and rather ask several questions to get all your information.
Murch
<blockchain><block><consensus><relay>
How does a new block get distributed
BlockChange
# How does a new block get distributed

(Asked by: username_0 on 2016-09-08)

I understand how a new block gets created, and verified by the miner that created it.

But then, does it advertise this new block to near nodes? And how do these nodes go about verifying this? Do they stop mining their own blocks?

How do you prevent from other nodes stealing the new block and pretending its their own? (I guess the transfer included with their own address prevents this?)

I understand there can be multiple branches at the same time, and eventually one survives, but how is it prevented that multiple branches keep living for an extended period?

**Tags:** blockchain, block, consensus, relay

> **Comments:**
> **username_1**: In the future, please only ask about one topic per question and rather ask several questions to get all your information.  

---

## 1 answers

### Answer by username_1 on 2016-09-08. Score: 7 | Accepted answer

When a node discovers a new block, it will send an (unsolicited) `inv` (inventory message) to announce the new block to its peers. The peers should then respond by sending a `getdata` message requesting either the header, or the complete block.  
The [Developer Reference](https://bitcoin.org/en/developer-reference#data-messages) describes the exchanged messages in more detail.

The nodes will then check the header, and each included transaction for adherence to the consensus rules. Most likely they will immediately start mining new empty blocks on basis of the header (as they don't know which transactions are still unconfirmed), then switch to mining a non-empty block once the received block was validated.

Each block includes a transaction that sends the mining reward to its miner. Other nodes cannot change this transaction as the block wouldn't be valid anymore. See [What is the coinbase?](https://bitcoin.stackexchange.com/q/4571/5406)

When two blocks `1A` and `1B` are found at the same time, each chain-tip will be considered valid by a portion of the network. Once a new block `2` is found, it can only extend one of the two chain-tips (here `1A→2A`), thus distinguishing one of the two chain-tips as part of the chain with the most work. As nodes hear about this new block `2A`, they will discard their stale chain-tip `1B` and reorganize to "longest chain" `1A→2A`.  
As it is unlikely that any chain building on `1B` will ever be able to overtake the `1A→2A` chain, miners would be wasting their power to continue to work on the obsoleted chain. Thus, the network is strongly incentivized to converge on the one chain with the most work.

> **Comments:**
> **username_0**: Won't the new non-empty block generate a different hash, since the merkle-tree is different? Why would a miner start mining an empty block?  
> **username_1**: Of course it'll have a different hash. But that's what mining is about: to try as many different hashes as possible until one fits the required difficulty. They'll start with an empty block (only coinbase) because they don't know which transactions they can include as they haven't validated the previous block yet.  
> **username_2**: This is a fine answer but it is a bit outdated now due to Compact Blocks (BIP 152) and FIBRE.  

---

