6

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?

  • 1
    In the future, please only ask about one topic per question and rather ask several questions to get all your information. – Murch Sep 8 '16 at 11:33
7

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 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?

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.

  • 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 Sep 8 '16 at 11:44
  • 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 Sep 8 '16 at 11:56
  • 1
    This is a fine answer but it is a bit outdated now due to Compact Blocks (BIP 152) and FIBRE. – G. Maxwell Jul 23 '18 at 12:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.