7

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.

2 Answers 2

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.

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?
    – ZEWEI CHU
    Feb 16, 2021 at 1:08
  • @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. Feb 16, 2021 at 9:44
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.

2
  • 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? Dec 24, 2021 at 10:47
  • 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. bitcoin.stackexchange.com/q/80663/5406 or other questions tagged empty-blocks
    – Murch
    Dec 24, 2021 at 14:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.