Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: Euro1000 on January 23, 2020, 08:23:05 PM



Title: How does a miner receives a transaction fee
Post by: Euro1000 on January 23, 2020, 08:23:05 PM
Each block has a coingen transaction for the block subsidy - so far so good.
But how does the miner gets the fees of transactions in a block? Is there a "getTransactionFees()" transaction?


Title: Re: How does a miner receives a transaction fee
Post by: darosior on January 23, 2020, 08:31:16 PM
Hi,

Each block has a coingen transaction for the block subsidy - so far so good.
But how does the miner gets the fees of transactions in a block? Is there a "getTransactionFees()" transaction?

Transaction fees are implicit in Bitcoin tranasctions. They are the difference between the sum of the inputs' value and the sum of the outputs' value.
All transactions need to have `sum(outputs) <= sum(inputs)` (and not just equal! Which would, by the way not be relayed by most of the nodes).
A block generator needs to create a coinbase transaction outputs which value is <= to `block_subsidy + fees` with `fees = sum(inputs_of_all_txs) - sum(outputs_of_all_txs)` for other network (full) nodes to accept it.


Title: Re: How does a miner receives a transaction fee
Post by: DannyHamilton on January 24, 2020, 06:07:44 PM
Each block has a coingen transaction for the block subsidy - so far so good.
But how does the miner gets the fees of transactions in a block?

Exactly the same way.

The "coingen transaction" of the block doesn't only have the block subsidy. It has the block subsidy + the transaction fees.

Is there a "getTransactionFees()" transaction?

Nope.  Just the "coingen transaction"


Title: Re: How does a miner receives a transaction fee
Post by: bitmover on January 24, 2020, 11:14:08 PM
You can take a look at a coin base transaction here:
https://www.blockchain.com/btc/tx/6b8da0669bc5c3a6cb24108c8e3d3dd5a965e4deb390d441444871c28c451fa8

The block reward is only 12.5, however the miner received more than 12.6, due to fees.