0

If two miners picked from the mempool two different sets of transactions, that were not dependent on each other.

Then could both miners, mine both blocks and not create a fork?

So miner 1 finishes the block and miner two sees that the block had nothing to do with his block, so he continues mining and adds that block onto miner 1s block after about a second?

I am assuming that forks only happen when both blocks mined have transactions that exist in both blocks

  • I am not subject matter expert on this topic. I have a reference from Andreas' book "Mastering Bitcoin" here, which is in Chapter 10, "Mining and Consensus" (page 240ff). <<Blocks might arrive at different nodes at different times, causing the nodes to have different perspectives of the blockchain. To resolve this, each node always selects and attempts to extend the chain of blocks that represents the most Proof-of-Work, also known as the longest chain or greatest cumulative work chain.>> (part 1 of 2) – pebwindkraft Mar 20 '18 at 17:44
  • << By summing the work recorded in each block in a chain, a node can calculate the total amount of work that has been expended to create that chain. As long as all nodes select the greatest-cumulative-work chain, the global bitcoin network eventually converges to a consistent state. Forks occur as temporary inconsistencies between versions of the blockchain, which are resolved by eventual reconvergence as more blocks are added to one of the forks. >> (part 2 of 2). After this intro, there are like 8-9 pages explaining the fork, hope this helps to get you started. – pebwindkraft Mar 20 '18 at 17:45
  • @pebwindkraft I think I understand what would happen now. Thanks for the heads up. I will write an answer based upon that – Kyle Graham Mar 20 '18 at 17:47
2

No, each block must reference it's predecessor block in the header, and the blockchain has only a single block at each height. The second miner must therefore modify the block template that they are mining with to build on top of the just discovered block. They need to update the hash of the predecessor block and the blockchain height in the Coinbase transaction. Otherwise the block they would be finding would be competing with the just published for inclusion instead of writing forth the blockchain.

The rest of the block template could stay the same, if none of the transactions got included in the blockchain already.

However, your question sounds to me like you're thinking that searching for a block has progress. Mining is a progress-less process, each attempt may or may not succeed independently. Thus, it would be a more profitable strategy for each miner to try including the juiciest transactions (by highest fee rate) and to switch to a new block template whenever a block is published with the new juiciest transactions.

1

Oh, the irony... I JUST answered the exact same question on Stackoverflow. I'll copy the answer here:

You can imagine two competing miners creating blocks. If a miner doesn't have block N, he'll keep trying to mine that block. If he receives block number N after having mined it, the miner just ignores it, and we have a temporary fork in the blockchain with two branches, and block N+1 will have two different versions. Now what determines which branch survives is basically the branch that is mined faster. An arbitrary consensus rule is that the longer chain is always the correct chain. When a longer chain exists, all miners agree that this chain is the correct one.

The reason why this works, is because the probability of mining a block is wide enough over 10 minutes in Bitcoin (or block time in general).

The following image can be seen as the probability of mining a block over time (in bitcoin).

Probability of mining a block over some time

This is why it's wrong to create blockchains with very short time. Because if the time is very short (like 10 seconds), there will be tons of forks before the blockchain stabilizes.

  • Thank you for the insight. I do not think this answers my question. I am aware of what happens during a fork and how the network resolves it. My question is regarding whether a fork will happen if miner 1 and 2 are mining two independent blocks. And miner one adds his block, can miner two updates his chain and continue mining is same block as there are no conflicts? – Kyle Graham Mar 20 '18 at 16:02
  • @Kyle Branches are completely independent and don't have any relations. The only requirement is that each branch is consistent. One of them will die. – The Quantum Physicist Mar 20 '18 at 16:15
  • Are branches the same as forks? I am not sure I quite understand what you just said. – Kyle Graham Mar 20 '18 at 16:19
  • @Kyle a fork has multiple branches. – The Quantum Physicist Mar 20 '18 at 16:23
  • How can a fork have multiple branches?If I am not mistaken, when the bitcoin network branches, it creates a fork? I have not heard of the term "branch" before, I am new so still ignorant. Please correct me where I am wrong – Kyle Graham Mar 20 '18 at 16:40
0

After reading pebwindkraft comment, I have come up with an answer.

The particular extract "To resolve this, each node always selects and attempts to extend the chain of blocks that represents the most Proof-of-Work, also known as the longest chain or greatest cumulative work chain"

If the blockchain was currently:

Block1 -> Block2 -> Block3

And two miners pick from the mempool, transactions that do not overlap. Then this will cause a fork in the blockchain, if both broadcast at the same time.

This is because, even though the transaction do not overlap, the blockhash would be different for each miner, and if the blockhash is different then this is two different versions of the blockchain. Even if the transactions do not overlap.

If miner1 broadcasts first, then miner2 will have to start his block again, even though all transactions in miner1's block did not clash with miner2's. This is because as soon as miner1 adds to the blockchain. The chain becomes:

Block1 -> Block2 -> Block3->Block4

Where Block4 is miner1s block.

Miner2 has to start again because in his block, he was using the previous hash of block3, he now has to change it block4's hash.

If I have made a mistake, drop a comment instead of downvoting as I would like to know where I went wrong.

0

Not really.

two sees that the block had nothing to do with his block, so he continues mining and adds that block onto mine

Once a miner sees an arrival of a block at the same height for which he himself is mining, it's end of the competition for that block. There is no point continuing mining.

However in event of miners creating simultaneous blocks, the forks would happen

I am assuming that forks only happen when both blocks mined have transactions that exist in both blocks

Miner should remove the transactions from memory pool which are already present in newly arrived block and start the mining for a fresh block

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.