<p>Nodes determine which block is "first" based on <strong>whichever block they receive first</strong>.</p>

<p>Or in other words, the timestamp on a block is not used to determine which block a node will add to their blockchain; nodes simply add the first valid block they receive to their blockchain.</p>

<p>As a result, if two blocks are mined at the same time, it's possible that different nodes on the network will have different blocks at the top of their blockchain. To illustrate:</p>

<pre><code>Node1    Node2
-----    -----

 [x]      [y]
 [c]      [c]
 [b]      [b]
 [a]      [a]
</code></pre>

<ul>
<li>block <code>[x]</code> was mined "first"</li>
<li>block <code>[y]</code> was mined just after block <code>[x]</code></li>
<li>Due to network delays, <code>Node2</code> ends up receiving block <code>[y]</code> first</li>
<li>Therefore, Node2 adds <code>[y]</code> to the top of their chain (but they also keep a copy of block <code>|x|</code>)</li>
</ul>

<p>So at this point in time, there is a disagreement about the state of the blockchain on the network. This happens.</p>

<hr>

<p>This situation is resolved when a new block gets mined.</p>

<p>For example, if <code>Node1</code> mines a new block on to their chain:</p>

<pre><code>Node1
-----

 [z]
 [x]
 [c]
 [b]
 [a]
</code></pre>

<p>This new block <code>[z]</code> creates the new longest chain on the network. So when <code>Node2</code> receives block <code>[z]</code>, they will adopt the new longest chain:</p>

<pre><code>Node1    Node2
-----    -----

 [z]      [z]
 [x]      [x][y]
 [c]      [c]
 [b]      [b]
 [a]      [a]
</code></pre>

<p>...and the network is back in agreement about the state of the blockchain.</p>

<p><strong>Summary:</strong></p>

<p>The order of blocks (or which block is "first") is not determined by the timestamp on blocks relative to any network time.</p>

<p>Instead, nodes will add the first block they receive, and are free to disagree on which block is at the top of the chain. The order is resolved when a new block is mined, and all nodes adopt the longest known chain.</p>

CC BY-SA 3.0
2016-11-02T03:24:01.580Z
So, if I want to get a list of nodes ordered by the time when they mine a block, is this possible?
Yangrui
CC BY-SA 3.0
2016-11-02T10:16:11.543Z
No block can be mined until the block before it is mined.
David Schwartz
CC BY-SA 3.0
2016-11-01T16:41:21.317Z
2016-11-01T16:41:21.317Z
inersha
<p>I'm curious about how Bitcoin nodes sync their time. There are delays within data transmission so if a node mines a block, how does the network determine whether it is the first?</p>

<blockchain><bitcoind><mining-theory>
How does Bitcoin coordinate time between nodes
Yangrui
# How does Bitcoin coordinate time between nodes

(Asked by: username_0 on 2016-11-01)

I'm curious about how Bitcoin nodes sync their time. There are delays within data transmission so if a node mines a block, how does the network determine whether it is the first?

**Tags:** blockchain, bitcoind, mining-theory


---

## 1 answers

### Answer by username_1 on 2016-11-01. Score: 2 | Accepted answer

Nodes determine which block is "first" based on **whichever block they receive first**.

Or in other words, the timestamp on a block is not used to determine which block a node will add to their blockchain; nodes simply add the first valid block they receive to their blockchain.

As a result, if two blocks are mined at the same time, it's possible that different nodes on the network will have different blocks at the top of their blockchain. To illustrate:

```
Node1    Node2
-----    -----

 [x]      [y]
 [c]      [c]
 [b]      [b]
 [a]      [a]

```

* block `[x]` was mined "first"
* block `[y]` was mined just after block `[x]`
* Due to network delays, `Node2` ends up receiving block `[y]` first
* Therefore, Node2 adds `[y]` to the top of their chain (but they also keep a copy of block `|x|`)

So at this point in time, there is a disagreement about the state of the blockchain on the network. This happens.

---

This situation is resolved when a new block gets mined.

For example, if `Node1` mines a new block on to their chain:

```
Node1
-----

 [z]
 [x]
 [c]
 [b]
 [a]

```

This new block `[z]` creates the new longest chain on the network. So when `Node2` receives block `[z]`, they will adopt the new longest chain:

```
Node1    Node2
-----    -----

 [z]      [z]
 [x]      [x][y]
 [c]      [c]
 [b]      [b]
 [a]      [a]

```

...and the network is back in agreement about the state of the blockchain.

**Summary:**

The order of blocks (or which block is "first") is not determined by the timestamp on blocks relative to any network time.

Instead, nodes will add the first block they receive, and are free to disagree on which block is at the top of the chain. The order is resolved when a new block is mined, and all nodes adopt the longest known chain.

> **Comments:**
> **username_0**: So, if I want to get a list of nodes ordered by the time when they mine a block, is this possible?  
> **username_2**: No block can be mined until the block before it is mined.  

---

