<p>The process of a transaction being created and included in the blockchain is as follows:</p>

<ol>
<li>The sender creates, signs, and broadcasts the transaction</li>
<li>All Bitcoin full nodes, including miners and regular users, receive the transaction and validate it by making sure it follows the Bitcoin protocol rules</li>
<li>Nodes temporarily store the unconfirmed/yet-to-be-mined transaction in a database called the "mempool" (each node has its own copy of the mempool)</li>
<li>Miners combine many transactions from their mempool into a single block. They will put as many transactions as they can fit into a single block (based on the Bitcoin protocol rules)</li>
<li>Miners begin hashing the block until they come up with an acceptable hash (this is proof-of-work mining)</li>
<li>Once they have successfully "mined" the block by getting an acceptable hash, they broadcast the block to the network</li>
<li>All full nodes receive the block and check to make sure the block and the transactions within it are all valid with regard to the Bitcoin protocol</li>
<li>If the block is valid, nodes add it to their copy of the blockchain. They also remove the transactions within the block from their version of the mempool</li>
<li>Non-mining nodes sit and wait for more transactions/blocks to come in for them to validate. Mining nodes go back to step 4, bundle more transactions into a new block, and repeat the mining process</li>
</ol>

CC BY-SA 4.0
2020-02-09T05:38:39.620Z
After step 8 when the block is determined valid, will all transaction fees be awarded to the miner? So if there are 100 transactions, each with a transaction fee, they are all awarded to the miner?
W. Churchill
CC BY-SA 4.0
2020-02-09T08:30:24.247Z
Good answer, but note that this order of steps is not absolutely true. For example, a miner can create a tx broadcast it to nobody, but then include it in a block in the future. If it is valid, the block will be accepted (assuming it is otherwise still valid, of course).
chytrik
CC BY-SA 4.0
2020-02-09T08:40:32.560Z
@W. Churchill: Yes, but miner must wait 100 blocks (most of a day) before they can spend it: https://bitcoin.stackexchange.com/questions/40655/coinbase-transactions-100-block-cooldown-period
dave_thompson_085
CC BY-SA 4.0
2020-02-18T23:05:55.027Z
@W.Churchill yes that is correct, the miner creates a "coinbase" transaction that they include in the block before they start mining/hashing it. The coinbase includes the block subsidy (currently 12.5 BTC) + all of the transaction fees for the transactions in that block. The coinbase transaction sends those bitcoins to the miner.
billygarrison
CC BY-SA 4.0
2020-02-07T14:37:32.070Z
2020-02-07T14:37:32.070Z
billygarrison
<blockquote>
  <p>When a miner validates a block, does the block contain all transactions in Bitcoin for that time period?</p>
</blockquote>

<p><a href="https://bitcoin.stackexchange.com/questions/35699/what-is-a-block">See this question for info about the structure of a block.</a> </p>

<p><a href="https://bitcoin.stackexchange.com/questions/89385/is-there-a-difference-between-bytes-and-virtual-bytes-vbytes/">A block can contain up to 4,000,000 weight units worth of transactions.</a> So the miner can select transactions to include in the block, up to this limit. Generally, the miner will select the transactions that pay them the largest amount in fees. </p>

<blockquote>
  <p>So does a miner validate an individual transaction between two parties, or are they validating transactions between all the parties in Bitcoin for that time period.</p>
</blockquote>

<p>A full node checks all transactions it hears about on the network, to ensure they are valid. If they are not valid, they will be discarded and ignored. When mining a block, a miner will use a full node to select only valid transactions to be included in the block template. </p>

CC BY-SA 4.0
2020-02-07T03:56:04.710Z
2020-02-07T03:56:04.710Z
chytrik
<p>No. For example, I can make a TX now, a block can be found after the network pretty much all sees it but the miner doesn't include it (many reasons why this can happen, most likely one being it's a low fee TX and the block is already filled with higher fee TXs). It will then remain in mempools for varying amounts of time until a miner does include it in a block at some point in the future. (Sometimes it will never end up in a block. If the TX fee is 1s/b and the network is clogged for days on end it will probably being to drop out of mempools and never be included).</p>

CC BY-SA 4.0
2020-02-08T03:27:39.377Z
2020-02-08T03:27:39.377Z
merklesyrup
<p>When a miner validates a block, does the block contain all transactions in Bitcoin for that time period? So does a miner validate an individual transaction between two parties, or are they validating transactions between all the parties in Bitcoin for that time period.</p>

<p>When you read examples about a transaction in Bitcoin, it makes it seem like each individual transaction (e.g. 1 Bitcoin from Bob to Alice) is its own block, validated by a miner.</p>

CC BY-SA 4.0
2020-02-09T08:28:29.200Z
Mostly dupe https://bitcoin.stackexchange.com/questions/22643/does-a-new-block-necessarily-include-all-transactions-that-occurred-before-its-generation
dave_thompson_085
<transactions><block><validation><transaction-selection>
Does each block contain all the Bitcoin transactions for that time period?
W. Churchill
# Does each block contain all the Bitcoin transactions for that time period?

(Asked by: username_0 on 2020-02-06)

When a miner validates a block, does the block contain all transactions in Bitcoin for that time period? So does a miner validate an individual transaction between two parties, or are they validating transactions between all the parties in Bitcoin for that time period.

When you read examples about a transaction in Bitcoin, it makes it seem like each individual transaction (e.g. 1 Bitcoin from Bob to Alice) is its own block, validated by a miner.

**Tags:** transactions, block, validation, transaction-selection

> **Comments:**
> **username_1**: Mostly dupe https://bitcoin.stackexchange.com/questions/22643/does-a-new-block-necessarily-include-all-transactions-that-occurred-before-its-generation  

---

## 3 answers

### Answer by username_2 on 2020-02-07. Score: 4

The process of a transaction being created and included in the blockchain is as follows:

1. The sender creates, signs, and broadcasts the transaction
2. All Bitcoin full nodes, including miners and regular users, receive the transaction and validate it by making sure it follows the Bitcoin protocol rules
3. Nodes temporarily store the unconfirmed/yet-to-be-mined transaction in a database called the "mempool" (each node has its own copy of the mempool)
4. Miners combine many transactions from their mempool into a single block. They will put as many transactions as they can fit into a single block (based on the Bitcoin protocol rules)
5. Miners begin hashing the block until they come up with an acceptable hash (this is proof-of-work mining)
6. Once they have successfully "mined" the block by getting an acceptable hash, they broadcast the block to the network
7. All full nodes receive the block and check to make sure the block and the transactions within it are all valid with regard to the Bitcoin protocol
8. If the block is valid, nodes add it to their copy of the blockchain. They also remove the transactions within the block from their version of the mempool
9. Non-mining nodes sit and wait for more transactions/blocks to come in for them to validate. Mining nodes go back to step 4, bundle more transactions into a new block, and repeat the mining process

> **Comments:**
> **username_0**: After step 8 when the block is determined valid, will all transaction fees be awarded to the miner? So if there are 100 transactions, each with a transaction fee, they are all awarded to the miner?  
> **username_3**: Good answer, but note that this order of steps is not absolutely true. For example, a miner can create a tx broadcast it to nobody, but then include it in a block in the future. If it is valid, the block will be accepted (assuming it is otherwise still valid, of course).  
> **username_1**: @username_0: Yes, but miner must wait 100 blocks (most of a day) before they can spend it: https://bitcoin.stackexchange.com/questions/40655/coinbase-transactions-100-block-cooldown-period  
> **username_2**: @username_0 yes that is correct, the miner creates a "coinbase" transaction that they include in the block before they start mining/hashing it. The coinbase includes the block subsidy (currently 12.5 BTC) + all of the transaction fees for the transactions in that block. The coinbase transaction sends those bitcoins to the miner.  

---

### Answer by username_3 on 2020-02-07. Score: 2

> When a miner validates a block, does the block contain all transactions in Bitcoin for that time period?

[See this question for info about the structure of a block.](https://bitcoin.stackexchange.com/questions/35699/what-is-a-block)

[A block can contain up to 4,000,000 weight units worth of transactions.](https://bitcoin.stackexchange.com/questions/89385/is-there-a-difference-between-bytes-and-virtual-bytes-vbytes/) So the miner can select transactions to include in the block, up to this limit. Generally, the miner will select the transactions that pay them the largest amount in fees.

> So does a miner validate an individual transaction between two parties, or are they validating transactions between all the parties in Bitcoin for that time period.

A full node checks all transactions it hears about on the network, to ensure they are valid. If they are not valid, they will be discarded and ignored. When mining a block, a miner will use a full node to select only valid transactions to be included in the block template.


---

### Answer by username_4 on 2020-02-08. Score: 0

No. For example, I can make a TX now, a block can be found after the network pretty much all sees it but the miner doesn't include it (many reasons why this can happen, most likely one being it's a low fee TX and the block is already filled with higher fee TXs). It will then remain in mempools for varying amounts of time until a miner does include it in a block at some point in the future. (Sometimes it will never end up in a block. If the TX fee is 1s/b and the network is clogged for days on end it will probably being to drop out of mempools and never be included).


---

