# How does a miner decide how many contracts & transactions to pack into a block?

The way I understand how miners work is that they see a queue of transactions and contracts, they have a choice of picking a number of those, process them, then pack them into a block, do a PoW, then whoever finishes first wins. (please let me know if this understanding is incorrect)

This raises a question: how many contracts / transactions does a miner pack into the block? How does the miner make that decision?

There seems to be a tradeoff between speed and reward. If I want to make a ton of gas reward, then I put in a ton of transactions & contracts. But then that slows me down, and my likelihood of winning the next block is lower. If I only put a single transaction into the next block, then I can process it faster, but my reward will be low if I do win.

Does each miner then create his own optimized strategy for this? Seems like this is something I can't ever find online.

Thanks!

The way I understand how miners work is that they see a queue of transactions and contracts, they have a choice of picking a number of those, process them, then pack them into a block, do a PoW, then whoever finishes first wins. (please let me know if this understanding is incorrect)

Correct.

This raises a question: how many contracts / transactions does a miner pack into the block? How does the miner make that decision?

Good question. The answer is almost certainly game theoretical, and will differ depending on how a given miner is playing the game, and what strategy they've developed and honed over time. (Which itself will depend on what other miners are doing... )

There seems to be a tradeoff between speed and reward.

Yes.

If I want to make a ton of gas reward, then I put in a ton of transactions & contracts. But then that slows me down, and my likelihood of winning the next block is lower. If I only put a single transaction into the next block, then I can process it faster, but my reward will be low if I do win.

Again, yes. Not only can you process it faster, but it can propagate around the network more quickly (i.e. it's smaller, therefore requires less bandwidth), and it can also be validated by other clients and miners more quickly.

Does each miner then create his own optimized strategy for this?

There's no way of knowing. All we can say, without involving speculation, is that the vanilla client code (at least for Geth) attempts to fill the block by selecting higher priced transactions first. Miners are free to either use the CLI options to tweak their preferences, or code their own version of the client that does something more game theoretical.

Of interest might be:

• When you say "fill the block by selecting higher priced transactions first" - what does fill the block mean? I thought ETH has no max block size? Feb 26, 2018 at 4:06
• There is a "block gas limit", which is currently set to ~8Mgas (million gas). It can be increased or decreased by miners, but a consensus has to be reached through a voting mechanism. (I'm not entirely sure of the specifics of how that agreement/voting mechanism works.) Feb 26, 2018 at 9:46