<p><a href="https://www.coindesk.com/information/how-do-bitcoin-transactions-work/" rel="noreferrer">https://www.coindesk.com/information/how-do-bitcoin-transactions-work/</a></p>

<blockquote>
  <p>She then sends them from her bitcoin wallet out to the wider bitcoin
  network. From there, bitcoin miners verify the transaction, putting it
  into a transaction block and eventually solving it.</p>
</blockquote>

<p>Transactions are broadcast over the P2P network, which miners are also a part of, so they receive the transactions from their peers.</p>

<p>Miners are completely free to do choose which transactions to include in the blocks they mine, but generally prefer to maximize revenue by collecting fees from transactions.</p>

CC BY-SA 4.0
2021-02-16T01:08:49.043Z
Just want some clarification. If a transaction comes with no extra bonus fees, will the miners have no incentive to include it in the next block? Will there by any benefits of including that transaction with no bonus fee?
ZEWEI CHU
CC BY-SA 4.0
2021-02-16T09:44:12.657Z
@ZEWEICHU: I think that Bitcoin nodes don't relay transactions that don't have a transaction fee - so such transactions don't reach miners. During mining, miners have to vary the contents of their block (to find a set of contents that produce a low hash value) - so there might occasionally be some benefit to them for selecting a low-fee transaction - after they have tried everything else.
RedGrittyBrick
CC BY-SA 3.0
2017-08-09T10:54:02.517Z
2017-08-09T10:54:02.517Z
tuxcanfly
<p>Let me walk you through the lifecycle of a transaction, and I think it'll become clearer.</p>
<p>A sender submits their transaction to the network. Every node checks whether the transaction is spending existing funds and whether it is otherwise valid. If so, they relay the transaction to their peers. This way, transactions disseminate to all participants in the network.</p>
<p>Some of the network participants, <em>miners</em>, continuously attempt to author new blocks. They assemble a block from the valid unconfirmed transactions they receive from their peers. <strong>They can choose any subset of the transactions they know about, but generally choose the transactions with the highest feerates to maximize their block reward.</strong> They could for example also prefer to include their own transactions, not include any transactions, or instead pick transaction by any other pattern (e.g. oldest first?)—this happens in traces, but usually reduces the revenue of miners, so works against their interests.</p>
<p>Using their draft for the next block, their <em>block template</em>, they repeatedly slightly change a field that takes a random input, the <em>nonce</em>, to see whether they can find a valid block using their template. When a  miner exhausts the nonce space, they mix up the template in a different manner.</p>
<p>Once a miner discovers a block template for which the hash is below the difficulty target, they broadcast the new block to the network, extending the blockchain. All the transactions in the block are considered to have gotten their first confirmation and are now part of the blockchain. The successful author of the block pays the block reward out to themselves in the so-called <em>coinbase transaction</em>, the first transaction in the block. The reward can be spent when it has 100 confirmations.</p>

CC BY-SA 4.0
2021-12-24T10:47:44.967Z
Hi could you please give details about "not include any transactions, ": is it like a miner could send only a nonce as a block and it would be ok?
totalMongot
CC BY-SA 4.0
2021-12-24T14:13:32.433Z
A block must have a coinbase transaction (the transaction that collects the transaction fees and generates new coins), but other transactions are optional. See e.g. https://bitcoin.stackexchange.com/q/80663/5406 or other questions tagged [tag:empty-blocks]
Murch
CC BY-SA 4.0
2021-12-01T16:00:39.133Z
2021-12-01T16:05:56.280Z
2021-12-01T16:05:56.280Z
Murch
<p>I am a little puzzled about how miners choose transactions, are the people who want to transfer Bitcoin sending their transaction to miners asking them to validate them, or are they put somewhere and then the individual miners can aggregate the ones they like?</p>
<p>I tried to find some information on google about this but it didn't really illuminate the problem well enough for me.</p>

<transaction-selection><relay>
How do miners choose transactions?
no nein
# How do miners choose transactions?

(Asked by: username_0 on 2017-08-09)

I am a little puzzled about how miners choose transactions, are the people who want to transfer Bitcoin sending their transaction to miners asking them to validate them, or are they put somewhere and then the individual miners can aggregate the ones they like?

I tried to find some information on google about this but it didn't really illuminate the problem well enough for me.

**Tags:** transaction-selection, relay


---

## 2 answers

### Answer by username_1 on 2017-08-09. Score: 7

<https://www.coindesk.com/information/how-do-bitcoin-transactions-work/>

> She then sends them from her bitcoin wallet out to the wider bitcoin
> network. From there, bitcoin miners verify the transaction, putting it
> into a transaction block and eventually solving it.

Transactions are broadcast over the P2P network, which miners are also a part of, so they receive the transactions from their peers.

Miners are completely free to do choose which transactions to include in the blocks they mine, but generally prefer to maximize revenue by collecting fees from transactions.

> **Comments:**
> **username_2**: Just want some clarification. If a transaction comes with no extra bonus fees, will the miners have no incentive to include it in the next block? Will there by any benefits of including that transaction with no bonus fee?  
> **username_3**: @username_2: I think that Bitcoin nodes don't relay transactions that don't have a transaction fee - so such transactions don't reach miners. During mining, miners have to vary the contents of their block (to find a set of contents that produce a low hash value) - so there might occasionally be some benefit to them for selecting a low-fee transaction - after they have tried everything else.  

---

### Answer by username_4 on 2021-12-01. Score: 1

Let me walk you through the lifecycle of a transaction, and I think it'll become clearer.

A sender submits their transaction to the network. Every node checks whether the transaction is spending existing funds and whether it is otherwise valid. If so, they relay the transaction to their peers. This way, transactions disseminate to all participants in the network.

Some of the network participants, *miners*, continuously attempt to author new blocks. They assemble a block from the valid unconfirmed transactions they receive from their peers. **They can choose any subset of the transactions they know about, but generally choose the transactions with the highest feerates to maximize their block reward.** They could for example also prefer to include their own transactions, not include any transactions, or instead pick transaction by any other pattern (e.g. oldest first?)—this happens in traces, but usually reduces the revenue of miners, so works against their interests.

Using their draft for the next block, their *block template*, they repeatedly slightly change a field that takes a random input, the *nonce*, to see whether they can find a valid block using their template. When a miner exhausts the nonce space, they mix up the template in a different manner.

Once a miner discovers a block template for which the hash is below the difficulty target, they broadcast the new block to the network, extending the blockchain. All the transactions in the block are considered to have gotten their first confirmation and are now part of the blockchain. The successful author of the block pays the block reward out to themselves in the so-called *coinbase transaction*, the first transaction in the block. The reward can be spent when it has 100 confirmations.

> **Comments:**
> **username_5**: Hi could you please give details about "not include any transactions, ": is it like a miner could send only a nonce as a block and it would be ok?  
> **username_4**: A block must have a coinbase transaction (the transaction that collects the transaction fees and generates new coins), but other transactions are optional. See e.g. https://bitcoin.stackexchange.com/q/80663/5406 or other questions tagged [tag:empty-blocks]  

---

