12

I am just starting to understand the internals of bitcoin. I am a CS graduate and familiar with most bitcoin terminologies. I've read Satoshi's paper and researched the question but I couldn't find the answer.

Now that it is much more profitable to mine blocks for the reward (25coins) than the transactions fees. my question is what prevents miners from only including 1 (or 0 if its allowed) transactions in their generated blocks as hashing smaller data will result in greater hashes/s (yes?)

Also, and most importantly is how does a miner decides that enough transactions has been received and start finding the nonce as adding a new transaction to the attempting block will result in all the work done for this block as obsolete.

I'll try to give my guess so correct me if I am wrong. While the miner tries to find the new block it buffers any received new transactions. If he/she finds the new block or a a new valid block is received they start working on the next block by putting all the buffered transactions into a new block and get to work.

Please excuse me if my questions seems primitive. I tried my best to research and any links are greatly appreciated. Thanks.

8

Nothing is stopping miners from not including transactions in their blocks, in fact it has happened before.

hashing smaller data will result in greater hashes/s (yes?)

No, the hashes are always the same size, and adding transactions to the block does not make any difference to the difficulty in finding the nounce that validates the block (the speed of hashing remains the same, and the probablity of finding the bock also remains unchanged), hence it makes financial sense for miners to add as many as they can since they earn more transaction fees.

Edit: for more details on the mining process, this thread provides a good summary:

Simplified mining process
1) Miners select tx from the memory pool for inclusion in a new block (the number, method, and criteria is up to the miner)
2) Miners construct a merkle tree from the tx in step #1
3) Miners create a block header with the merkle tree, prior block hash, version, timestamp, and nonce
4) Miner will hash the blockheader. If it is a solution go to step 5.
4a) Miner will increment nonce and go to step 4. If nonce range is exhausted go to step 4b
4b) Miner will modify another element in blockheader, reset nonce range back to 0 and go to step 4
5) Miner has found a block. They broadcast it to peers.

So once a miner finds a block they are done. All the work for deciding tx comes BEFORE solving a block.

So the number and size of transactions has no real impact on the repetitive step #4.

Having said that, it has been claimed that some miners do choose smaller blocks in order to minimise network propagation delays, and hence reduce the chance of their block becoming an orphan.

  • The probability of finding the hash remains unchanged but the speed? How is the time hashing 1kb = hashing 150kb. As of adding transactions wouldn't affect difficulty, could you elaborate why? is the nonce being tested picked randomly (or pseudo-randomly) or is sequential? – Moshohayeb Dec 2 '13 at 16:57
  • 1
    @Moshohayeb I have edited my answer to better explain why the size of the block does not affect the hashing speed, as there is a preliminary step involved in creating a block header out of them. The hashing process only uses this header. Having said that, block size will affect its network propagation speed. – ktorn Dec 3 '13 at 2:16
  • 2
    Thank you very much, also found this in the wiki The body of the block contains the transactions. These are hashed only indirectly through the Merkle root. Because transactions aren't hashed directly, hashing a block with 1 transaction takes exactly the same amount of effort as hashing a block with 10,000 transactions. – Moshohayeb Dec 3 '13 at 6:55
  • @ktorn thank you for this, answered my question directly. Does this mean that miners/pools have some sort of personal policy as to how many transactions to include, to weigh the risk of delays in producing the merkle tree? – streetlight Feb 22 '16 at 23:05
1

The others already answer your question, but I'd just like to clarify one more point (since you said it was "most important"):

Also, and most importantly is how does a miner decides that enough transactions has been received and start finding the nonce as adding a new transaction to the attempting block will result in all the work done for this block as obsolete.

The nonce-searching process is a memory-less process.

This means that if miners A and B have the same hashrate, and are working on the exact same block, and at time T A already tried 1000000000 nonces (with no success) and B already tried only 1 nonce (with no success), both have the same probability to find the next block. I.e., at time T, the fact A is "ahead" of B doesn't give B any advantage.

In this sense, every work a miner does which doesn't result with a block is already "obsolete".

With that in mind, if a miner wants to add txs to her block, she only needs to repeat once steps 1-3 from @ktorn's answer. It might waste some searching time (thus decreasing the probability to be the first to find the block), but it also increases the potential reward (more fees). This means there's a tradeoff, and a miner will do it only if she thinks it is profittable (e.g. there's a new tx with high enough fees).

0

Nothing prevents miners from not including transactions in their blocks. However, miners are trying to make money and 0.0005 * 54 = 0.027 BTC, which isn't a trivial amount in this market.

See https://en.bitcoin.it/wiki/Transaction_fees for more info.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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