Bitcoin Forum
May 17, 2024, 01:43:53 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: miners rewards & fees  (Read 121 times)
Gdns8476 (OP)
Newbie
*
Offline Offline

Activity: 7
Merit: 1


View Profile
March 06, 2021, 11:56:05 PM
 #1

Hi, does anybody know, in Bitcoin system, which process(es) managing miners payments (fees & rewards)? If you can point to the place in the source code? Thank you.
NotATether
Legendary
*
Offline Offline

Activity: 1610
Merit: 6746


bitcoincleanup.com / bitmixlist.org


View Profile WWW
March 07, 2021, 04:32:44 AM
 #2

The mining rewards and transaction fees are contained in the coinbase transaction of the first block mined. BlockAssembler::CreateNewBlock of src/miner.cpp is where the coinbase transaction is created.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
Gdns8476 (OP)
Newbie
*
Offline Offline

Activity: 7
Merit: 1


View Profile
March 07, 2021, 09:13:40 AM
 #3

Thanks NotATether. Here is what I'm trying to figure out: mined block gets broadcasted to many nodes. 1. Which of those nodes make decision if block is a winner? 2. Which of those nodes initiate transaction of fees and rewards to winner miner?
ranochigo
Legendary
*
Offline Offline

Activity: 2968
Merit: 4193



View Profile
March 07, 2021, 09:32:30 AM
 #4

1. Which of those nodes make decision if block is a winner?
A block is valid if it meets the required target and doesn't violate any protocol rules. In the event that there are two or more competing blocks at the same height, the chain which gets lengthened first will win while the others will be discarded.


2. Which of those nodes initiate transaction of fees and rewards to winner miner?
None. The miner is responsible to calculate the appropriate fees that they can receive as well as the block rewards. It is located in the Coinbase transaction[1] though a miner can choose to only claim none or parts of it as well. In a sense, the miner awards the fees + block rewards to themselves in the coinbase transaction.

[1] https://blockchair.com/bitcoin/transaction/5474230016045376a7b6e9feabbfec4f413e48dcc9348abea6c1575bc3d6dabd

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


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
Gdns8476 (OP)
Newbie
*
Offline Offline

Activity: 7
Merit: 1


View Profile
March 07, 2021, 09:48:03 AM
 #5

Great ranochigo!
1. What happens if two miners create identical blocks at the same time and half of the network accept the block from the first miner and other half from the second one? Which miner will be rewarded?
2. Miners are self rewarding? Am I understand correctly? Who control them?
NeuroticFish
Legendary
*
Offline Offline

Activity: 3682
Merit: 6397


Looking for campaign manager? Contact icopress!


View Profile
March 07, 2021, 09:55:05 AM
 #6

1. Which of those nodes make decision if block is a winner?
In the event that there are two or more competing blocks at the same height, the chain which gets lengthened first will win while the others will be discarded.

Actually some nodes will probably have one new block and others will have another. And neither is really discarded until another block is mined. Only then the longest chain wins and the other one is discarded.

If two nodes broadcast different versions of the next block simultaneously, some nodes may receive one or the other first. In that case, they work on the first one they received, but save the other branch in case it becomes longer. The tie will be broken when the next proofof-work is found and one branch becomes longer; the nodes that were working on the other branch will then switch to the longer one.

PS: OP, Bitcoin white paper is only 8 pages to be read (+1 page of references); it's not so difficult and can answer to many important questions.

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


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
ranochigo
Legendary
*
Offline Offline

Activity: 2968
Merit: 4193



View Profile
March 07, 2021, 09:58:55 AM
 #7

What happens if two miners create identical blocks at the same time and half of the network accept the block from the first miner and other half from the second one? Which miner will be rewarded?
Due to the contents of the block headers, it is quite near impossible for two miners to generate blocks containing different transactions but have the same block hash. Unless of course, there is a collision. I'm assuming you're talking about blocks at the same height.

Taking Block A and Block B as the block that gets generated at approximately the same time and nodes will see either of the blocks. Once the miner receives either of the block, they would start working on it. Miners will start building a block by referencing Block A or Block B, mostly depending on the block which it sees first. Once a miner that was mining ontop of Block A finds a Block (calling it Block C), the half of the network that didn't see Block A first would simply just request data of Block A and accept both Block A and Block C while discarding Block B and those that accepted Block A first would just simply verify and accept Block C.

Since the chain containing Block A has a larger proof of work, this means that the network follows the chain for which Block A and Block C is in but discards Block B. As a result, Block B doesn't get rewarded as it is not included in the longest chain and thus the Coinbase transaction that I have mentioned won't exist.

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


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

Activity: 3388
Merit: 4653



View Profile
March 07, 2021, 10:38:35 AM
 #8

2. Miners are self rewarding? Am I understand correctly? Who control them?

We all do.  Nobody trusts the content of ANY block from anyone.  Everyone that is running a full node completely verifies every block they receive and every transaction in that block.  If a miner creates an invalid block (because the block pays too large of a reward), then my node will reject that block as invalid.  So will your node. So will ranichogo's node. So will every other node.

If there are some "bad" nodes out there with an altered copy of the node software, and those"bad" nodes accept the bad block from the miner, every other good node will still reject it. All the other miners (and pools) will reject it too.

Since the other miners will reject it, they will not include it in the chain they are building.  Instead, they will wait until someone else sends a VALID block. Then, when one of them builds another block on top of that, the new chain (without the "bad" block) will be longer (more proof-of-work). Therefore, EVERYONE (even the "bad" nodes) will use the longer chain and the "bad" block will be abandonded.
Gdns8476 (OP)
Newbie
*
Offline Offline

Activity: 7
Merit: 1


View Profile
March 07, 2021, 10:50:35 AM
 #9

I got it. Thank you all very much!!!
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!