<p>It's called a &quot;coinbase&quot; transaction. It's added before the hashing work is done, just like all of the other transactions are.</p>
<p>If a miner tried to pay themselves any more than allowed in the coinbase transaction then the block they mine is considered invalid (since it contains an invalid coinbase transaction) and will not be accepted by the network, so they would have wasted any money spent mining it. This has happened before; for example, AntPool at block #584,802 submitted a block with too high of a coinbase transaction, and the block was rejected (<a href="https://twitter.com/BitMEXResearch/status/1148989508588883970" rel="nofollow noreferrer">see more</a>).</p>
<p>Any amount above the block reward of 6.25 BTC paid in the coinbase is the sum of all of the transaction fees paid in that block, and this is how the miner claims their transaction fee reward.</p>

CC BY-SA 4.0
2021-01-27T10:37:58.297Z
2021-01-27T10:37:58.297Z
ieatpizza
<p>I'm new to blockchain and bitcoin. In my understanding, miners are trying to find a nonce that is added to a block, and then the hash of the block will have some zeros at first and the first transaction in each block is a coinbase transaction.</p>
<p>Is coinbase transaction added to block before calculating the hash or after??? And what forces the miner, not to add 100 bitcoins as their basecoin transaction??</p>
<p>Also on btc.com I saw that different blocks have different amounts of bitcoins. Shouldn't it be a fixed amount of bitcoin, i.e 6.25??</p>

<bitcoin-core><transactions><blockchain><mining-theory><coinbase-transaction>
How basecoin transaction is added to a block?
Ssaf
# How basecoin transaction is added to a block?

(Asked by: username_0 on 2021-01-27)

I'm new to blockchain and bitcoin. In my understanding, miners are trying to find a nonce that is added to a block, and then the hash of the block will have some zeros at first and the first transaction in each block is a coinbase transaction.

Is coinbase transaction added to block before calculating the hash or after??? And what forces the miner, not to add 100 bitcoins as their basecoin transaction??

Also on btc.com I saw that different blocks have different amounts of bitcoins. Shouldn't it be a fixed amount of bitcoin, i.e 6.25??

**Tags:** bitcoin-core, transactions, blockchain, mining-theory, coinbase-transaction


---

## 1 answers

### Answer by username_1 on 2021-01-27. Score: 1 | Accepted answer

It's called a "coinbase" transaction. It's added before the hashing work is done, just like all of the other transactions are.

If a miner tried to pay themselves any more than allowed in the coinbase transaction then the block they mine is considered invalid (since it contains an invalid coinbase transaction) and will not be accepted by the network, so they would have wasted any money spent mining it. This has happened before; for example, AntPool at block #584,802 submitted a block with too high of a coinbase transaction, and the block was rejected ([see more](https://twitter.com/BitMEXResearch/status/1148989508588883970)).

Any amount above the block reward of 6.25 BTC paid in the coinbase is the sum of all of the transaction fees paid in that block, and this is how the miner claims their transaction fee reward.


---

