Author

Topic: Question about blocks and mining (Read 183 times)

legendary
Activity: 3430
Merit: 3080
January 21, 2018, 12:06:26 PM
#6
In which moment would the miner recollect the fees? on putting the transaction on the block, or when he broadcasts a succesful block to the network? Would this be a new transaction on top of each tx, how do the miners exactly recollect the fee?

The transaction fees are added to the block reward and paid to the miner's mining address as a part of the coinbase transaction in a block. This means that all block rewards are "tainted" with whatever fees are accepted by the miner (which can of course be zero fees, i.e. zero tainting).
member
Activity: 142
Merit: 13
January 21, 2018, 12:04:13 PM
#5
Would this node inmediately continue proof of work even if the transaction pool is empty?
Yes. The block doesn't have to include any other transactions. Some blocks only contain the Coinbase.
What would happen if he mine the block and new transactions would come in? He would to start again with the new transaction because the tx are included in the block so the hash of the block changes, so he each time new tx are added the node has to restart the PoW, Right?
No, he doesn't have to. The transactions are already technically included in the block before the miner starts hashing the header. The header contains the merkle roots which is the hash of all the transactions that the miner wishes to include. Unless the miners wants to waste his resources, they won't discard a valid block which fulfills the target even if new transactions with larger fees gets relayed to them.

There is no restrictions about how many transactions a miner should include. He is free to decide. [Read DannyHamilton's part on this.]

Sorry, didn't see the message, thank you!
member
Activity: 142
Merit: 13
January 21, 2018, 11:51:42 AM
#4
It's a easy question:

Imagine 2 nodes, they two have different transactions on them.

Node B finish to mine the block first, it broadcasts it and the network accept it.

Ok.

Would this node inmediately continue proof of work even if the transaction pool is empty?

Lately, the transaction pool is never empty.  There are more transactions than fit in a block. Therefore, there are always more transactions waiting for the next block.

However, if the transaction pool was empty, the miner can create the transaction that pays himself the block reward, and then build a block from that transaction.  Therefore, a block always has at least 1 transaction in it.

What would happen if he mine the block and new transactions would come in?

Do you mean that he is in the process of mining the block, but has not found the solution yet?  Or do you mean that he finished mining the block, has the solution for the block that has only 1 transaction in it, and then before he can broadcast it, more transactions come in?

If he hasn't found a solution yet, then he can build a new block header from the new transaction list and start mining on that new header.  This way, if he solves the block, he can increase his revenue with the additional transaction fees.

If he has just found a solution, then he can immediately broadcast the block that has only one transaction, and then immediately start a new block with the transactions that he has just received.  That way he can collect the block subsidy that he has already earned.

He would to start again with the new transaction because the tx are included in the block so the hash of the block changes, so he each time new tx are added the node has to restart the PoW, Right?

Every hash attempt is a new start to the PoW.  It doesn't matter if you have tried a million hashes, or one hash. In either case the next hash attempt is  equally likely to be successful.  Therefore, there is no wasted effort to start with a new block header.

Unless the miners wants to waste his resources, they won't discard a valid block even if new transactions with larger fees gets relayed to them.

When you say "valid" block, I assume you are talking about a "solved" block?  In that case your are correct.  The miner just broadcasts the solved block and then immediately starts on a new block with the transactions in it.

On the other hand, if you are talking about a block that has been built , but which has not had the proof-of-work solved yet, then there is no waste of resources to discard the current unsolved block and start over with a new block.

There is no restrictions about how many transactions a miner should include. He is free to decide.

There are two legacy restrictions and one new restriction.

Legacy Restriction 1:  The block MUST contain the "coinbase" transaction.

Legacy Restriction 2:  The total number of bytes in the non-witness portion MUST be less than one megabyte.

New Restriction 1: The total block weight MUST be less than four megabytes.

Danny to the rescue, thanks a lot.

In which moment would the miner recollect the fees? on putting the transaction on the block, or when he broadcasts a succesful block to the network? Would this be a new transaction on top of each tx, how do the miners exactly recollect the fee?
legendary
Activity: 3472
Merit: 4801
January 19, 2018, 12:06:59 PM
#3
It's a easy question:

Imagine 2 nodes, they two have different transactions on them.

Node B finish to mine the block first, it broadcasts it and the network accept it.

Ok.

Would this node inmediately continue proof of work even if the transaction pool is empty?

Lately, the transaction pool is never empty.  There are more transactions than fit in a block. Therefore, there are always more transactions waiting for the next block.

However, if the transaction pool was empty, the miner can create the transaction that pays himself the block reward, and then build a block from that transaction.  Therefore, a block always has at least 1 transaction in it.

What would happen if he mine the block and new transactions would come in?

Do you mean that he is in the process of mining the block, but has not found the solution yet?  Or do you mean that he finished mining the block, has the solution for the block that has only 1 transaction in it, and then before he can broadcast it, more transactions come in?

If he hasn't found a solution yet, then he can build a new block header from the new transaction list and start mining on that new header.  This way, if he solves the block, he can increase his revenue with the additional transaction fees.

If he has just found a solution, then he can immediately broadcast the block that has only one transaction, and then immediately start a new block with the transactions that he has just received.  That way he can collect the block subsidy that he has already earned.

He would to start again with the new transaction because the tx are included in the block so the hash of the block changes, so he each time new tx are added the node has to restart the PoW, Right?

Every hash attempt is a new start to the PoW.  It doesn't matter if you have tried a million hashes, or one hash. In either case the next hash attempt is  equally likely to be successful.  Therefore, there is no wasted effort to start with a new block header.

Unless the miners wants to waste his resources, they won't discard a valid block even if new transactions with larger fees gets relayed to them.

When you say "valid" block, I assume you are talking about a "solved" block?  In that case your are correct.  The miner just broadcasts the solved block and then immediately starts on a new block with the transactions in it.

On the other hand, if you are talking about a block that has been built , but which has not had the proof-of-work solved yet, then there is no waste of resources to discard the current unsolved block and start over with a new block.

There is no restrictions about how many transactions a miner should include. He is free to decide.

There are two legacy restrictions and one new restriction.

Legacy Restriction 1:  The block MUST contain the "coinbase" transaction.

Legacy Restriction 2:  The total number of bytes in the non-witness portion MUST be less than one megabyte.

New Restriction 1: The total block weight MUST be less than four megabytes.
legendary
Activity: 3038
Merit: 4418
Crypto Swap Exchange
January 19, 2018, 09:17:33 AM
#2
Would this node inmediately continue proof of work even if the transaction pool is empty?
Yes. The block doesn't have to include any other transactions. Some blocks only contain the Coinbase.
What would happen if he mine the block and new transactions would come in? He would to start again with the new transaction because the tx are included in the block so the hash of the block changes, so he each time new tx are added the node has to restart the PoW, Right?
No, he doesn't have to. The transactions are already technically included in the block before the miner starts hashing the header. The header contains the merkle roots which is the hash of all the transactions that the miner wishes to include. Unless the miners wants to waste his resources, they won't discard a valid block which fulfills the target even if new transactions with larger fees gets relayed to them.

There is no restrictions about how many transactions a miner should include. He is free to decide. [Read DannyHamilton's part on this.]
member
Activity: 142
Merit: 13
January 19, 2018, 06:10:49 AM
#1
It's a easy question:

Imagine 2 nodes, they two have different transactions on them.

Node B finish to mine the block first, it broadcasts it and the network accept it.

Would this node inmediately continue proof of work even if the transaction pool is empty?

What would happen if he mine the block and new transactions would come in? He would to start again with the new transaction because the tx are included in the block so the hash of the block changes, so he each time new tx are added the node has to restart the PoW, Right?

Jump to: