How do miners select which transactions to include in a block?

24

8

Where and how do you view and select which transactions to include in the block you are trying to create?

Do you look on the blockchain?

Is there some tool that you can use that allows you to see the fees as well?

BitCoin New Guy

Posted 2013-01-27T07:19:37.043

Reputation: 828

But what software use miners to accept transactions when they find a block? Their mining software or the Bitcoin client software? I'm searching information about Bitcoin and I don't know how miners can verify transactions, but I read here that miners that find a block can accept the transdactions that they want, but if they are "bad" or "malicious" miners, they can accept invalid transactions (double spending transactions). When this "bad" or "malicious" miner accept the transaction this validation is broadcasted over the network to be confirmated? Sorry for my english. If someone don't undersZanetti 2013-04-24T08:23:40.443

Most miners are mining through a pool. Solo miners, mining pool operators and those running P2Pool can be selective, but any miner that gets work from elsewhere has no say in what transactions get included in the block.Stephen Gornick 2013-02-05T02:39:36.860

So just to confirm if u are solo u can at an API level only select which transactions to excludeBitCoin New Guy 2013-02-07T04:09:16.180

Answers

8

A bitcoin node's (bitcoin's standard client acts as one) first function is to relay transactions on a best effort basis, it only relays valid transaction. The miner which also is a node will try to solve a block on the transaction it received, but in the end the miner has last word he can decide to arbitrarily discard some transaction (like one with no miner's fee)

Gopoi

Posted 2013-01-27T07:19:37.043

Reputation: 889

What if no miner wants to include your transaction? Will that transaction never happen?mercury0114 2017-06-02T18:22:20.690

In short yes. There two aspects to consider: if your transaction is invalid all the nodes (bitcoin clients) won't even broadcast it to the network so miners won't even see it. If your transaction is valid at first, but when the miner checks it finds that you have already spent your outputs, it won't include it in the block. If a miner actually mines a block with an invalid transaction the network won't accept it. Then this transaction is left out forever.Gopoi 2017-06-06T23:03:23.280

How would they exclude a transaction...is there some tool or viewer ???BitCoin New Guy 2013-01-31T21:39:03.217

Miner can choose not to include the transaction in their transaction tree... They don't have a tool they are a node who received the broadcast of transactions. If YOU want to see the transaction or block try http://blockchain.info/ or http://blockexplorer.com/. But it is to say that those sites are merely nodes that permits you to see what is going on the network a miner is a node thus receive about the same info.

Gopoi 2013-01-31T21:47:23.433

I got all that ...if you are broadcast all transactions as part of the peer to peer...how do u exclude a transaction with a low fee value when u start cgminer as an example ??BitCoin New Guy 2013-01-31T21:52:31.693

2Ok you speak pratically, you would need to see if cgminer is able to be configured...which I am not sure. If you are part of a pool (not p2pool) you can't really deny transactions since you get the work from the pool directly (the pool runs the node). When I said miner I was considering any miner that you could program or configure, a miner in general can choose which transaction to include but it maybe implemented not to.Gopoi 2013-01-31T22:03:15.800

Cool...so at a API level we could write code into our operation that excluded all transactions below a certain fee level... ThanksBitCoin New Guy 2013-02-01T04:35:06.250

6

Do you look on the blockchain ?

No, because the blockchain only has confirmed transactions. Instead, the miner looks at its memory pool. It's named that because they are forgotten when the miner shuts down.

Nick ODell

Posted 2013-01-27T07:19:37.043

Reputation: 26 536

-3

Just look up block 289791 from today at blockchain.info. No transactions included at all. Obviously that miner is speeding up his calculation by omitting them and got lucky today.

giest

Posted 2013-01-27T07:19:37.043

Reputation: 9

1Not including transactions doesn't speed up the calculation of a block in practice. In theory, you can omit a few hash calculations, but it's so insignificant that there is really no reason to omit them.Steven Roose 2014-03-10T10:48:28.030

@StevenRoose, just curious, what is the reason not to omit a transaction? Is there a reason for each transaction to be included?mercury0114 2017-06-02T18:23:13.807

1@mercury0114 The reason to not omit a transaction? Mostly the transaction fee that you can claim. The transaction fee goes to the miner of the block. For free transactions, it's more like a benevolent act. However, there is little reason not to include them if you have space. It makes Bitcoin more useful as a whole and thus increases the values of the coins you get as a block reward.Steven Roose 2017-06-24T14:44:53.577