0

It comes to my curiousity about how exactly the node A will mine block N+1 when he & node B generated block N (not in same time but) in a fairly close timeframe.

In many articles, it says that when 2 nodes (A&B) are generating the same height block at same time, it will cause a fork. This means some nodes will mine after A's new block and others mine B's. This is understood. However, it will take time when A's new block sync to B. Let's assume it takes 10 seconds to pass to B. In the middle of the sync (saying 5th or 6th second of total 10), B just generates the new block (with same height), and propagate it out before receiving A's block. What will happen when B receives A's block then?

I have 2 possible answers but not sure which one is correct, or neither. (assuming all TX/UTXO in the block has no issue)

ANSWER-1: B will discard B's block, and accept A's, because B block's timestamp is older than A's (make sense?)

ANSWER-2: when B broadcasts his new block, B by default accepts its own generated block (N+1) and immediately start to mine block N+2 upon that (at the time when B has not received A's block yet.) Then B receives A's block (N+1), in this case, B should keep A's chain but still continue to mine at his N+2 block height.

Any advice?

| improve this question | | | | |
0

Two miners may find a block at pretty much the same time, and so the network may split, with some miners working on top of each of the two blocks.

It is possible, but quite rare, for a miner on each side of the split to then find a block at pretty much the same time again, thus repeating the situation, and the split goes another block deep.

The situation eventually resolves when one side of the split mines a new block before the other side. The network then converges onto the longer (most work) chain, and the other chain is 'orphaned'.

i have 2 possible answers but not sure which one is correct, or neither. (assuming all TX/UTXO in the block has no issue)

ANSWER-1: B will discard B's block, and accept A's, because B block's timestamp is older than A's (make sense?)

No, timestamps are not used to decide which block is kept.

ANSWER-2: when B broadcasts his new block, B by default accepts its own generated block (N+1) and immediately start to mine block N+2 upon that (at the time when B has not received A's block yet.) Then B receives A's block (N+1), in this case, B should keep A's chain but still continue to mine at his N+2 block height.

B will not necessarily keep the chain, but B will continue to mine on B's N+1 block.

| improve this answer | | | | |
0

ANSWER-2: when B broadcasts his new block, B by default accepts its own generated block (N+1) and immediately start to mine block N+2 upon that (at the time when B has not received A's block yet.) Then B receives A's block (N+1), in this case, B should keep A's chain but still continue to mine at his N+2 block height.

This is basically correct. B will receive A's block, validate it, and if it is valid, he will store the block. However he will not change his view of the blockchain to include A's block. He merely holds onto A's block just in case more blocks are found on top of it which would then require B to change his view of the blockchain.

B's view of the blockchain will remain with his N + 1 block and continue to mine his N + 2.

In general, when two blocks are found at the same height around the same time, nodes will update their view of the blockchain to include the block which they saw first. The view of the blockchain only changes if there exists a blockchain that has more cumulative work than the one that the node currently sees as the correct blockchain. If the two blockchains have the same cumulative work (i.e. orphan race as described in this question), then the node uses the one it saw first.

| improve this answer | | | | |
  • FWIW, Bitcoin Core won't fetch (much less validate) a block unless it would become the best block if validation passed. – G. Maxwell Nov 15 '18 at 23:30
  • 1
    Or is at least part of a chain whose tip would become the best block if validation passed. – Pieter Wuille Nov 16 '18 at 1:02

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.