As per my understanding, every transaction is included in a block and the difficulty to find a block gets adjusted such that one block is found for every 10 minutes. Is it the case that all transactions occurred in those 10 minutes included in that block? Is there a limit on number of transactions that can be included in a block?
1 Answer
Short answer: Yes, there's a limit but it depends on transaction size, not count.
Basic summary of blocks
Miners are incentivized to put as many transactions into a block as they can with fees. The more transactions, the more fees the miner collects, and that can mean an extra coin on top of block rewards. A block gets bigger as more transactions are added, this is the problem and the reason why fees need to be a certain amount.
Block size limit explained
But the more transactions a block has the larger it gets in size and larger blocks can fail to propagate, creating an orphan block. Orphan blocks cause a lot of pain to the network, the miner loses 25 BTC (current block reward) and certain confirmed transactions become unconfirmed. To prevent this from happening often, the Bitcoin protocol has a block size limit to enable speedy propagation and reduce anomalies. Each block has a size limit of 1,000,000 bytes. This can change based on community consensus and probably will some time in the future due to technological progress causing the internet to be faster and more robust. A valid block is below 1 million bytes in size, otherwise it just won't be accepted by most miners.
Which transaction make it in
Most miners choose transactions as profitably as possible. They go for largest fees and smallest transaction sizes. Since they can't claim all transactions they go for efficiency. You can have a transaction a little less than the size of a block be included and processed if it had a fee beating the collective fees of the next hundred most profitable small transactions that would normally be included in a block. This system is called priority, it's all about maximizing profit for the miner.
Resulting amount of transactions
The transaction count in a block can range be reasonably anywhere. There have been blocks with no transactions other than the block reward. I say reasonably because the max depends on the smallest possible transaction size (41 bytes + 9 bytes) divided by block size. The average seems to be around 350 transactions per block.
-
The priority mentioned here seems (to me) to suggest that blocks are regularly 1 MB, and so miners must eliminate some transactions they know about (via best fee/size ratio), but that doesn't appear to be the case at all. Besides the minimum fee for the default client to transmit the transaction, is there any real priority going on today?– Tim S.Commented Feb 2, 2014 at 20:54
-
Smaller blocks are better as well. Most miners have a cutoff of priority (some don't even put now fee blocks in), or it's just that miners are running through available transactions entirely.– John TCommented Feb 2, 2014 at 22:39