Bitcoin Forum
May 26, 2024, 05:03:55 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Question about blocks and mining  (Read 155 times)
redigaffi (OP)
Member
**
Offline Offline

Activity: 142
Merit: 13


View Profile
January 19, 2018, 11:10:49 AM
Merited by ABCbits (1)
 #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?


Earn Money With Skill while having fun, Answer this 6 questions and get a bonus when the project get's launched:

https://docs.google.com/forms/d/e/1FAIpQLSdCRubC4wu4seHYdDqiZDFsXizqaViUnOtE5sZcx3spjGc84A/viewform
ranochigo
Legendary
*
Offline Offline

Activity: 2982
Merit: 4193



View Profile
January 19, 2018, 02:17:33 PM
Last edit: January 19, 2018, 06:08:46 PM by ranochigo
Merited by ABCbits (1)
 #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.]

█████████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████
█████████████████████████
.
BC.GAME
▄▄░░░▄▀▀▄████████
▄▄▄
██████████████
█████░░▄▄▄▄████████
▄▄▄▄▄▄▄▄▄██▄██████▄▄▄▄████
▄███▄█▄▄██████████▄████▄████
███████████████████████████▀███
▀████▄██▄██▄░░░░▄████████████
▀▀▀█████▄▄▄███████████▀██
███████████████████▀██
███████████████████▄██
▄███████████████████▄██
█████████████████████▀██
██████████████████████▄
.
..CASINO....SPORTS....RACING..
█░░░░░░█░░░░░░█
▀███▀░░▀███▀░░▀███▀
▀░▀░░░░▀░▀░░░░▀░▀
░░░░░░░░░░░░
▀██████████
░░░░░███░░░░
░░█░░░███▄█░░░
░░██▌░░███░▀░░██▌
░█░██░░███░░░█░██
░█▀▀▀█▌░███░░█▀▀▀█▌
▄█▄░░░██▄███▄█▄░░▄██▄
▄███▄
░░░░▀██▄▀


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
DannyHamilton
Legendary
*
Offline Offline

Activity: 3402
Merit: 4656



View Profile
January 19, 2018, 05:06:59 PM
Merited by ABCbits (3)
 #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.
redigaffi (OP)
Member
**
Offline Offline

Activity: 142
Merit: 13


View Profile
January 21, 2018, 04:51:42 PM
 #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?

Earn Money With Skill while having fun, Answer this 6 questions and get a bonus when the project get's launched:

https://docs.google.com/forms/d/e/1FAIpQLSdCRubC4wu4seHYdDqiZDFsXizqaViUnOtE5sZcx3spjGc84A/viewform
redigaffi (OP)
Member
**
Offline Offline

Activity: 142
Merit: 13


View Profile
January 21, 2018, 05: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!

Earn Money With Skill while having fun, Answer this 6 questions and get a bonus when the project get's launched:

https://docs.google.com/forms/d/e/1FAIpQLSdCRubC4wu4seHYdDqiZDFsXizqaViUnOtE5sZcx3spjGc84A/viewform
Carlton Banks
Legendary
*
Offline Offline

Activity: 3430
Merit: 3074



View Profile
January 21, 2018, 05: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).

Vires in numeris
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!