<p>Time in bitcoin isn't precise nor reliable, every peer can have their own idea of time and every peer has a view of other peers time that lead a single peer to have knowledge about time drift (<code>adjusted time</code>).
Any miner can mine using past or even future timestamps but there are rules that enforce blocks to be generated not too much in the past (using the median time of previous blocks) and not too much in the future (using the <code>adjusted time</code> from your known peers)</p>
<p>Having said that, mining is a race, if many mine at the same time the network will have temporary different views based on peers and their neighborhood (e.g. if you are connected directly to a miner, you'll likely get first the block from it while if you have not direct connection to a miner but one of your peers does, you'll likely get the block from that miner too, basically it's about latency between nodes)</p>
<p>At that point your node have a view that will put one of these mined blocks as your TIP, if you are a miner and you succeed to find the next block before others add a block on other forks, you'll likely have a chance that your view will become the valid one for the rest of the network (if other big miners don't decide to ignore your block and try to mine on their own vision, in case they found the previous block and have incentives to do so)</p>
<p>Well, I understand my explaination isn't probably easy to follow because there are lot of nuances behind, in any case the short ELI5 answer is: when multiple miners mine a block at the same time, the network will sort it out waiting for the longer chain to emerge from forks.</p>
<p>EDIT
P.S.
note that when all of them mine, all of them get the reward in their own view, because all of them think to be on the tip of the chain.
But only one of these blocks will survive because the longest chain based on these forks will become the valid one and so other miners will have to rollback their own view up to the fork point (so losing the reward they thought they won) and moving to the now-valid chain</p>

CC BY-SA 4.0
2020-07-28T14:04:56.733Z
2020-07-28T22:31:03.620Z
2020-07-28T22:31:03.620Z
Not Important
<p>It's all about <strong>probability</strong>. In about 10 minutes, a miner among those 100 will finally achieve to solve the <em>proof of work</em> for the given block before others will. So, he then will write that block on the blockchain, using it's address in the receiving address field of the <strong>coinbase transaction</strong>, thus obtaining it's reward.</p>
<p><em>what happen if they all mine the block at the same time</em></p>
<p>In that case, the blockchain would be <strong>temporary</strong> forked on the block at <em>height</em> X, given X the number of the block been mined at the same time by more than one miner. This won't last forever. Remember the golden rule of bitcoin: <code>the longest chain win</code>. Among those forks, one will definitely be resolved (again, it's all about probability at the end of the day), meaning more hashrate will be brought to it, so it will grow faster (speaking about blockheight) than the other. That one will become the current blockchain.</p>
<p><em>What happens to the other forks?</em> Well, they're simply not valid blockchains. They contain outdated data. If forking miner continue to mine on those blockchain, they'll do at a lost, because they will get rewards on a blockchain which is not the main one</p>
<p><em>Is there some priority protocol?</em> No, absolutely. Just probability. The more hashrate you have, the more probably you can mine the next block</p>
<p><em>how the precise time of completion is calculated (is it using the miner's computer clock as timestamp?</em> From the <a href="https://en.bitcoin.it/wiki/Block_timestamp#:%7E:text=A%20timestamp%20is%20accepted%20as,%2Dadjusted%20time%20%2B%202%20hours.&amp;text=Bitcoin%20uses%20an%20unsigned%20integer,delayed%20for%20another%2068%20years." rel="nofollow noreferrer">bitcoin wiki</a></p>
<blockquote>
<p>A timestamp is accepted as valid if it is greater than the median
timestamp of previous 11 blocks, and less than the network-adjusted
time + 2 hours. &quot;Network-adjusted time&quot; is the median of the
timestamps returned by all nodes connected to you. As a result block
timestamps are not exactly accurate, and they do not need to be. Block
times are accurate only to within an hour or two.Whenever a node connects to another node, it gets a UTC timestamp from it, and stores its offset from node-local UTC. The network-adjusted time is then the node-local UTC plus the median offset from all connected nodes.</p>
</blockquote>

CC BY-SA 4.0
2020-07-28T02:28:02.387Z
I edited my question to ask more precisely about wht happen if they all mine the block at the same time. Is there some priorioty protocol? I also wonder how the precise time of completion is calculated (is it using the miner's computer clock as timestamp?).
Strob
CC BY-SA 4.0
2020-07-27T20:22:23.617Z
2020-07-28T07:00:24.880Z
2020-07-28T07:00:24.880Z
dcfg
<p>Let's say 100 miners with similar hashrate all try at the same time to mine the same block and finish at the same time, how will Bitcoin choose to which miner the reward will go? Is there some prority protocol?</p>

<mining-reward>
How does Bitcoin choose to which miner the reward will go?
Strob
# How does Bitcoin choose to which miner the reward will go?

(Asked by: username_0 on 2020-07-27)

Let's say 100 miners with similar hashrate all try at the same time to mine the same block and finish at the same time, how will Bitcoin choose to which miner the reward will go? Is there some prority protocol?

**Tags:** mining-reward


---

## 2 answers

### Answer by username_1 on 2020-07-28. Score: 1

Time in bitcoin isn't precise nor reliable, every peer can have their own idea of time and every peer has a view of other peers time that lead a single peer to have knowledge about time drift (`adjusted time`).
Any miner can mine using past or even future timestamps but there are rules that enforce blocks to be generated not too much in the past (using the median time of previous blocks) and not too much in the future (using the `adjusted time` from your known peers)

Having said that, mining is a race, if many mine at the same time the network will have temporary different views based on peers and their neighborhood (e.g. if you are connected directly to a miner, you'll likely get first the block from it while if you have not direct connection to a miner but one of your peers does, you'll likely get the block from that miner too, basically it's about latency between nodes)

At that point your node have a view that will put one of these mined blocks as your TIP, if you are a miner and you succeed to find the next block before others add a block on other forks, you'll likely have a chance that your view will become the valid one for the rest of the network (if other big miners don't decide to ignore your block and try to mine on their own vision, in case they found the previous block and have incentives to do so)

Well, I understand my explaination isn't probably easy to follow because there are lot of nuances behind, in any case the short ELI5 answer is: when multiple miners mine a block at the same time, the network will sort it out waiting for the longer chain to emerge from forks.

EDIT
P.S.
note that when all of them mine, all of them get the reward in their own view, because all of them think to be on the tip of the chain.
But only one of these blocks will survive because the longest chain based on these forks will become the valid one and so other miners will have to rollback their own view up to the fork point (so losing the reward they thought they won) and moving to the now-valid chain


---

### Answer by username_2 on 2020-07-27. Score: 1

It's all about **probability**. In about 10 minutes, a miner among those 100 will finally achieve to solve the *proof of work* for the given block before others will. So, he then will write that block on the blockchain, using it's address in the receiving address field of the **coinbase transaction**, thus obtaining it's reward.

*what happen if they all mine the block at the same time*

In that case, the blockchain would be **temporary** forked on the block at *height* X, given X the number of the block been mined at the same time by more than one miner. This won't last forever. Remember the golden rule of bitcoin: `the longest chain win`. Among those forks, one will definitely be resolved (again, it's all about probability at the end of the day), meaning more hashrate will be brought to it, so it will grow faster (speaking about blockheight) than the other. That one will become the current blockchain.

*What happens to the other forks?* Well, they're simply not valid blockchains. They contain outdated data. If forking miner continue to mine on those blockchain, they'll do at a lost, because they will get rewards on a blockchain which is not the main one

*Is there some priority protocol?* No, absolutely. Just probability. The more hashrate you have, the more probably you can mine the next block

*how the precise time of completion is calculated (is it using the miner's computer clock as timestamp?* From the [bitcoin wiki](https://en.bitcoin.it/wiki/Block_timestamp#:%7E:text=A%20timestamp%20is%20accepted%20as,%2Dadjusted%20time%20%2B%202%20hours.&text=Bitcoin%20uses%20an%20unsigned%20integer,delayed%20for%20another%2068%20years.)

> A timestamp is accepted as valid if it is greater than the median
> timestamp of previous 11 blocks, and less than the network-adjusted
> time + 2 hours. "Network-adjusted time" is the median of the
> timestamps returned by all nodes connected to you. As a result block
> timestamps are not exactly accurate, and they do not need to be. Block
> times are accurate only to within an hour or two.Whenever a node connects to another node, it gets a UTC timestamp from it, and stores its offset from node-local UTC. The network-adjusted time is then the node-local UTC plus the median offset from all connected nodes.

> **Comments:**
> **username_0**: I edited my question to ask more precisely about wht happen if they all mine the block at the same time. Is there some priorioty protocol? I also wonder how the precise time of completion is calculated (is it using the miner's computer clock as timestamp?).  

---

