<ol>
<li><p>It is not ensured. Miners can run any software they want to determine which transactions to include in a block. The game theory makes censorship hard however: it only takes one miner to include a transaction in a block for it to become valid. If a given transaction is not &quot;selected&quot; for a block, it remains in the <a href="https://river.com/learn/terms/m/mempool/" rel="nofollow noreferrer">mempool</a>, a collection of unconfirmed (not in a block) transactions.</p>
</li>
<li><p>This verification is exactly what nodes do. Whenever nodes receive a new block, they verify the signatures and validity of every single transaction in that block, including whether or not the coins each transaction attempts to spend are spendable. The linear nature of the blockchain ensures that there all transactions are objectively valid or invalid at certain block heights/times.</p>
</li>
<li><p>No one chooses the &quot;first&quot; one to find a valid hash. The valid blockchain is the chain which includes the most work. For simplicity's sake, this is almost always the chain with the greatest number of blocks in it. When a miner finds a valid hash, they publish their block and all other miners accept it (assuming its valid) and mine on top of that block. Only one miner gets the reward for that block, but other miners hope to get rewards by finding subsequent blocks.</p>
</li>
<li><p>See #3. Blocks are not valid/invalid based on the time they were mined. The longest chain is always valid, even if a shorter chain has blocks that were mined before the blocks in the longer chain. Read more here: <a href="https://river.com/learn/what-is-proof-of-work/" rel="nofollow noreferrer">What Is Proof-of-Work?</a></p>
</li>
</ol>

CC BY-SA 4.0
2022-02-01T02:06:39.067Z
2022-02-01T02:06:39.067Z
Sachin Meier
<p>I just started to study blockchain and bitcoin yesterday and came up with some questions.</p>
<ol>
<li><p>If miners can select transactions when creating a block, how is it ensured that all the transactions over every 10 minutes are recorded? For example, if a miner selected only a half of all the transactions over 10 minutes and found a valid hash, how can the other half of the transactions be recorded?</p>
</li>
<li><p>The answer to the first question might render this question unnecessary, but if miners can select transactions when creating a block, how is it ensured that the first one didn't include any invalid transactions over the 10 minutes?</p>
</li>
<li><p>Also, why is only the first one to find a valid hash rewarded while the first one might have left out some transactions during selection (although an answer to Q1 might render this worry unnecessary)? Is there any security reason behind choosing the first one? For example, is the first one considered to be the most trustworthy because it takes time to make invalid modifications on previous/current transactions?</p>
</li>
<li><p>The fourth question came out while I was watching 19:43~ of the following video:
<a href="https://www.youtube.com/watch?v=bBC-nXj3Ng4" rel="nofollow noreferrer">https://www.youtube.com/watch?v=bBC-nXj3Ng4</a>. It is understandable that Alice will fail to cheat because Alice can't create invalid blocks faster than the rest of the miners. However, what if Alice broadcasted the first invalid block to every other miner? In that case, wouldn't all the other miners find next blocks based on the assumption that Alice's first invalid block is valid so that Alice wouldn't have to exceed all the other miners every time?</p>
</li>
</ol>
<p>Thank you.</p>

CC BY-SA 4.0
2022-02-02T08:57:11.077Z
Why would anyone assume an invalid block is valid?
David Schwartz
<blockchain><security><proof-of-work>
How does PoW ensure that all the transactions are recorded and that all the transactions are valid?
Donghwi Min
# How does PoW ensure that all the transactions are recorded and that all the transactions are valid?

(Asked by: username_0 on 2022-02-01)

I just started to study blockchain and bitcoin yesterday and came up with some questions.

1. If miners can select transactions when creating a block, how is it ensured that all the transactions over every 10 minutes are recorded? For example, if a miner selected only a half of all the transactions over 10 minutes and found a valid hash, how can the other half of the transactions be recorded?
2. The answer to the first question might render this question unnecessary, but if miners can select transactions when creating a block, how is it ensured that the first one didn't include any invalid transactions over the 10 minutes?
3. Also, why is only the first one to find a valid hash rewarded while the first one might have left out some transactions during selection (although an answer to Q1 might render this worry unnecessary)? Is there any security reason behind choosing the first one? For example, is the first one considered to be the most trustworthy because it takes time to make invalid modifications on previous/current transactions?
4. The fourth question came out while I was watching 19:43~ of the following video:
   <https://www.youtube.com/watch?v=bBC-nXj3Ng4>. It is understandable that Alice will fail to cheat because Alice can't create invalid blocks faster than the rest of the miners. However, what if Alice broadcasted the first invalid block to every other miner? In that case, wouldn't all the other miners find next blocks based on the assumption that Alice's first invalid block is valid so that Alice wouldn't have to exceed all the other miners every time?

Thank you.

**Tags:** blockchain, security, proof-of-work

> **Comments:**
> **username_1**: Why would anyone assume an invalid block is valid?  

---

## 1 answers

### Answer by username_2 on 2022-02-01. Score: 1

1. It is not ensured. Miners can run any software they want to determine which transactions to include in a block. The game theory makes censorship hard however: it only takes one miner to include a transaction in a block for it to become valid. If a given transaction is not "selected" for a block, it remains in the [mempool](https://river.com/learn/terms/m/mempool/), a collection of unconfirmed (not in a block) transactions.
2. This verification is exactly what nodes do. Whenever nodes receive a new block, they verify the signatures and validity of every single transaction in that block, including whether or not the coins each transaction attempts to spend are spendable. The linear nature of the blockchain ensures that there all transactions are objectively valid or invalid at certain block heights/times.
3. No one chooses the "first" one to find a valid hash. The valid blockchain is the chain which includes the most work. For simplicity's sake, this is almost always the chain with the greatest number of blocks in it. When a miner finds a valid hash, they publish their block and all other miners accept it (assuming its valid) and mine on top of that block. Only one miner gets the reward for that block, but other miners hope to get rewards by finding subsequent blocks.
4. See #3. Blocks are not valid/invalid based on the time they were mined. The longest chain is always valid, even if a shorter chain has blocks that were mined before the blocks in the longer chain. Read more here: [What Is Proof-of-Work?](https://river.com/learn/what-is-proof-of-work/)


---

