<p>Each miner will take the first valid block they received and begin working on the next block with this as the previous one. They do not achieve any consensus on whether <code>X</code> or <code>Y</code> are the valid block at this stage, and some miners may be working on <code>X</code>, with others working on <code>Y</code>.</p>

<p>The tie is broken as soon as one of the miners creates block <code>Z</code>. If the previous block of <code>Z</code> is <code>X</code>, then the consensus is reached that <code>X</code> was the correct block and <code>Y</code> is discarded by miners who were working on it. <code>Z</code> now represents the longest chain and so all miners will begin working on this.</p>

<p>There may be several disputes in a row, and each miner will just work on the block they received first. The dispute will eventually be resolved because the probability that blocks will be mined simultaneously for several blocks in a row is very low.</p>

CC BY-SA 4.0
2019-04-26T12:22:03.923Z
2019-04-26T12:30:04.550Z
2019-04-26T12:30:04.550Z
Mark H
<p>Lets say miner A is working on block X, while miner B works on block Y.<br>
Both miner A and B find the hash for their blocks almost at the same time, and as such, they start broadcasting their results to other miners, so a consensus can be reached.</p>

<p>Are <strong>all</strong> the miners on the network needed to reach such consensus? </p>

<p>If such, what happens if a group of miners is working to reach a consensus on a block, and some other group is working on some other block (given that the broadcast to every node takes a little bit of time)?</p>

<p>How do they decide what block gets added first to the blockchain?</p>

<p>Note that I'm pretty new to this, and still trying to learn how the blockchain works.</p>

<blockchain>
How can the blockchain keep only one version of the ledger equal across all nodes
John Keene
# How can the blockchain keep only one version of the ledger equal across all nodes

(Asked by: username_0 on 2019-04-26)

Lets say miner A is working on block X, while miner B works on block Y.  
Both miner A and B find the hash for their blocks almost at the same time, and as such, they start broadcasting their results to other miners, so a consensus can be reached.

Are **all** the miners on the network needed to reach such consensus?

If such, what happens if a group of miners is working to reach a consensus on a block, and some other group is working on some other block (given that the broadcast to every node takes a little bit of time)?

How do they decide what block gets added first to the blockchain?

Note that I'm pretty new to this, and still trying to learn how the blockchain works.

**Tags:** blockchain


---

## 1 answers

### Answer by username_1 on 2019-04-26. Score: 1

Each miner will take the first valid block they received and begin working on the next block with this as the previous one. They do not achieve any consensus on whether `X` or `Y` are the valid block at this stage, and some miners may be working on `X`, with others working on `Y`.

The tie is broken as soon as one of the miners creates block `Z`. If the previous block of `Z` is `X`, then the consensus is reached that `X` was the correct block and `Y` is discarded by miners who were working on it. `Z` now represents the longest chain and so all miners will begin working on this.

There may be several disputes in a row, and each miner will just work on the block they received first. The dispute will eventually be resolved because the probability that blocks will be mined simultaneously for several blocks in a row is very low.


---

