<p>Only blocks that are part of the longest chain are considered valid. Each longest chain considers competing longest chains to be invalid until proven otherwise.</p>
<p>Example:</p>
<blockquote>
<p>Block A was last.</p>
<p>Block B1 and B2 are discovered at almost the same moment in the network and broadcasted such that each is received by about half the network first. Let's assume</p>
<ul>
<li>B1 verifies transactions T1 and T2.</li>
<li>B2 verifies transactions T2 and T3.</li>
</ul>
<p>Now each half of the network tries to find the next block respectively building from B1 or B2.</p>
<ul>
<li>Building on B1: Trying to find C1 referring to B1 as previous block. In its ancestral chain T3 is not verified and the miners will include it in C1.</li>
<li>Building on B2: Trying to find C2 referring to B2 as previous block. In its ancestral chain T1 is not verified and the miners will include it in C2.</li>
</ul>
<p>For arguments sake, C1 is found first. B2 is not part of the longest chain anymore, and thus any miner that receives notice of C1 will cease to try finding C2, and instead try to find D1 based on C1. The reward of B2 is not valid in the longest chain, any transactions that were <em>only</em> confirmed in B2 will still be unconfirmed pool in the chain of C1.</p>
</blockquote>
<p>The transaction fee ends up going to whatever miner found the block which confirms the transaction <em>in the longest chain</em>. Since each transaction can only be verified once this is unambiguous. Block rewards are unspendable until they are mature, i.e. there are 100 blocks deriving from it. At that point it is practically certain that there won't be a competing longer blockchain at any point in the future.</p>

CC BY-SA 3.0
2014-02-14T12:20:27.413Z
2014-02-14T12:28:02.873Z
2020-06-16T11:10:03.350Z
Murch
<p>The blocks on the chain that loses are essentially forgotten. (It's better to call them losing blocks, than "bad" blocks, because they were legal and offered in good faith. They just lost a network race.) </p>

<p>Thus on the winning chain, there's no record of the losing-block reward, or the transaction fees. If there's no record of it in the common history, you don't have it. It's as if the reward and fees on the losing branch never happened. </p>

<p>Many transactions likely already existed in both blocks. (Most redundant blocks happen by accident, and can already contain most of the same transactions.) Despite these transactions, with their fees, appearing in two places for a time window of uncertainty, since only one set of consistent blocks will eventually win, those fees are only meaningfully spent, and then re-spendable, in the winning chain. </p>

<p>Any transactions missing from the winning chain are still eligible for inclusion, as long as they're still consistent with the cemented-history. Anyone building on the winning chain, who still knows about the unverified transactions, might add them on a subsequent block. Anyone interested in ensuring they're still widely-known may continue to broadcast them to peers. </p>

CC BY-SA 3.0
2014-02-14T06:42:12.620Z
But don't the fees & reward in-fact generate a new transaction which is then propagated into the system for new verification? How does the system know to discard them if the block in the "loosing" chain is discarded?
Gil Moshayof
CC BY-SA 3.0
2014-02-14T10:16:38.973Z
No fees & rewards don't generate new transactions by themselves. Rewards are only spendable after a block has been buried 100 (i think) blocks deep. So there can't be any transactions touching the reward yet. Any other transactions can still go through on the next block as long as there is no conflict (double spend).
Jannes
CC BY-SA 3.0
2014-02-15T00:07:32.843Z
Another way to think about it is: blocks are atomic, and include in them the block-reward, and sweep of transaction-fees, to the miner. The only thing that happens later is the decision to build on it, or not. If it (and its successors) are built on, it wins. If it wins, all those transactions/fees/rewards are spendable by their new owners, without any other steps necessary. They just refer-back to that block to use the funds.

And if it loses, there's nothing extra to undo. Just leaving it out of the winning chain already means it, and all its contents, are irrelevant.
Quizzical
CC BY-SA 3.0
2014-02-14T01:53:58.893Z
2014-02-14T01:53:58.893Z
Quizzical
<p>I'm a bit new to the bitcoin system, so I apologize if this is a "noob" question.</p>

<p>A user attempts to take all the unverified transactions it knows about and aggregate them in a chain block. The same applies to all the users world wide - they all attempt to aggregate all the unverified transactions into a block chain with a 1 success every 10 minutes on a global scale rate</p>

<p>But - I imagine that when all the devices are trying to do this, all the devices have a slightly different list of unverified transactions, since it takes a while for a transaction to propagate to all the devices world-wide</p>

<p>So let's say device A and device B both create a block at the same time, when some 
transactions in A don't appear in B and vise-versa. Then, more block chains are created and  after some time the shorter one is discarded - all the transactions which appeared as verified in the shorter block chain now become unverified again?</p>

<p>If this is the case, what happens to the transaction fees &amp; the 25 bitcoin award given to the guy who created the "bad" block?</p>

<p>I mean, fine - the 25 bitcoin award could theoretically stay with the guy who created the block, since he did do the work, but the transaction fee? It would need to be paid to the next guy who verifies the transaction, shouldn't it?</p>

<p>Or in this case, would the user need to pay 2 transaction fees?</p>

<blockchain><transaction-fees><blockchain-fork><mining-reward><immature-coins>
Transaction fees when a block chain is discarded
Gil Moshayof
# Transaction fees when a block chain is discarded

(Asked by: username_0 on 2014-02-14)

I'm a bit new to the bitcoin system, so I apologize if this is a "noob" question.

A user attempts to take all the unverified transactions it knows about and aggregate them in a chain block. The same applies to all the users world wide - they all attempt to aggregate all the unverified transactions into a block chain with a 1 success every 10 minutes on a global scale rate

But - I imagine that when all the devices are trying to do this, all the devices have a slightly different list of unverified transactions, since it takes a while for a transaction to propagate to all the devices world-wide

So let's say device A and device B both create a block at the same time, when some
transactions in A don't appear in B and vise-versa. Then, more block chains are created and after some time the shorter one is discarded - all the transactions which appeared as verified in the shorter block chain now become unverified again?

If this is the case, what happens to the transaction fees & the 25 bitcoin award given to the guy who created the "bad" block?

I mean, fine - the 25 bitcoin award could theoretically stay with the guy who created the block, since he did do the work, but the transaction fee? It would need to be paid to the next guy who verifies the transaction, shouldn't it?

Or in this case, would the user need to pay 2 transaction fees?

**Tags:** blockchain, transaction-fees, blockchain-fork, mining-reward, immature-coins


---

## 2 answers

### Answer by username_2 on 2014-02-14. Score: 3 | Accepted answer

The blocks on the chain that loses are essentially forgotten. (It's better to call them losing blocks, than "bad" blocks, because they were legal and offered in good faith. They just lost a network race.)

Thus on the winning chain, there's no record of the losing-block reward, or the transaction fees. If there's no record of it in the common history, you don't have it. It's as if the reward and fees on the losing branch never happened.

Many transactions likely already existed in both blocks. (Most redundant blocks happen by accident, and can already contain most of the same transactions.) Despite these transactions, with their fees, appearing in two places for a time window of uncertainty, since only one set of consistent blocks will eventually win, those fees are only meaningfully spent, and then re-spendable, in the winning chain.

Any transactions missing from the winning chain are still eligible for inclusion, as long as they're still consistent with the cemented-history. Anyone building on the winning chain, who still knows about the unverified transactions, might add them on a subsequent block. Anyone interested in ensuring they're still widely-known may continue to broadcast them to peers.

> **Comments:**
> **username_0**: But don't the fees & reward in-fact generate a new transaction which is then propagated into the system for new verification? How does the system know to discard them if the block in the "loosing" chain is discarded?  
> **username_3**: No fees & rewards don't generate new transactions by themselves. Rewards are only spendable after a block has been buried 100 (i think) blocks deep. So there can't be any transactions touching the reward yet. Any other transactions can still go through on the next block as long as there is no conflict (double spend).  
> **username_2**: Another way to think about it is: blocks are atomic, and include in them the block-reward, and sweep of transaction-fees, to the miner. The only thing that happens later is the decision to build on it, or not. If it (and its successors) are built on, it wins. If it wins, all those transactions/fees/rewards are spendable by their new owners, without any other steps necessary. They just refer-back to that block to use the funds.  And if it loses, there's nothing extra to undo. Just leaving it out of the winning chain already means it, and all its contents, are irrelevant.  

---

### Answer by username_1 on 2014-02-14. Score: 1

Only blocks that are part of the longest chain are considered valid. Each longest chain considers competing longest chains to be invalid until proven otherwise.

Example:

> Block A was last.
>
> Block B1 and B2 are discovered at almost the same moment in the network and broadcasted such that each is received by about half the network first. Let's assume
>
> * B1 verifies transactions T1 and T2.
> * B2 verifies transactions T2 and T3.
>
> Now each half of the network tries to find the next block respectively building from B1 or B2.
>
> * Building on B1: Trying to find C1 referring to B1 as previous block. In its ancestral chain T3 is not verified and the miners will include it in C1.
> * Building on B2: Trying to find C2 referring to B2 as previous block. In its ancestral chain T1 is not verified and the miners will include it in C2.
>
> For arguments sake, C1 is found first. B2 is not part of the longest chain anymore, and thus any miner that receives notice of C1 will cease to try finding C2, and instead try to find D1 based on C1. The reward of B2 is not valid in the longest chain, any transactions that were *only* confirmed in B2 will still be unconfirmed pool in the chain of C1.

The transaction fee ends up going to whatever miner found the block which confirms the transaction *in the longest chain*. Since each transaction can only be verified once this is unambiguous. Block rewards are unspendable until they are mature, i.e. there are 100 blocks deriving from it. At that point it is practically certain that there won't be a competing longer blockchain at any point in the future.


---

