Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: NdaMk on April 15, 2022, 10:44:42 AM



Title: Newbie help; What happens when the combine transaction fee and block reward ar
Post by: NdaMk on April 15, 2022, 10:44:42 AM
Coinbase transaction; this transaction is the first stored in a block. It differs from a Bitcoin transaction by creating new currency which were not spent (the reward for the miner). There by having an empty input in a transaction. This reward can be transferred to another wallet ( base on the choice of the miner). Some of the data found in a Coinbase transaction data are; version, output, input number, output count, VOUT, Scriptsig, and its size, lock time, TXID. Reading through I found that the transaction outputs can only be spent only when it must have confirmed a 100blocks or more.
My questions;
1. Does these apply to every transactions?
2. If no, please explain the phenomenon behind it?
3. What happens when combined reward of the block with its transaction fee is bigger than the output value


Title: Re: Newbie help; What happens when the combine transaction fee and block reward ar
Post by: hosseinimr93 on April 15, 2022, 11:06:49 AM
1. Does these apply to every transactions?
It only applies to coinbase transactions.
Bitcoin received in other transactions can be spent once it's received (even if the parent is still unconfirmed).


2. If no, please explain the phenomenon behind it?
There's always the chance that a block is orphaned*.
The rule prevents miners from spending the bitcoin that has been generated in a block that may be orphaned.


*An orphan block is a block which has been mined successfully, but it's not accepted due to not being in the longest chain.


Title: Re: Newbie help; What happens when the combine transaction fee and block reward ar
Post by: Charles-Tim on April 15, 2022, 11:07:18 AM
To avoid the possibility of miners to manipulate coinbase transaction, newly mined coin can only be spent after 100 confirmations.

Bitcoin transaction can be spent even if not yet confirmed, you can do that on wallets like Electrum. But best to only accept coin that have one confirmation already. Be careful of depending on spending unconfirmed transactions because the transaction that is not yet confirmed can be double spent using replace-by-fee (RBF).

For more understanding about the manipulation, you can read about chain reorganization and the quote below:

https://learnmeabitcoin.com/technical/chain-reorganisation

Does chain Reorg has any negative impact on the fate of the miner's reward and the entire blockchain?
No, just that new blocks stop building on old longest chain after a block is mined at the same time by two miners which later lead to new longest chain that new mined blocks are building on.
It does have an impact on the miners' reward for the block (or blocks) which are discarded from the chain with the lower proof of work; these miners effectively lose their block reward.

The 100 confirmation should be enough for chain reorg to have occured successfully without any manipulation. The miner that mined the orphaned block which new blocks are no more building on will lose his reward.


Title: Re: Newbie help; What happens when the combine transaction fee and block reward ar
Post by: Cricktor on April 15, 2022, 11:29:04 AM
3. What happens when combined reward of the block with its transaction fee is bigger than the output value
Not sure if I understand your question correctly. By example:
Say, transaction fees of a block are 0.2 BTC and current block reward is 6.25 BTC and a particular miner found a valid block hash:
1. Coinbase transaction output value the miner chose to mine is 6.4 BTC (for whatever reason not the exactly allowed max. value of 6.45 BTC in my example): result is 0.05 BTC are destroyed from available total Bitcoins (such deliberate or erronous destruction of Bitcoins have happened in the past by miners with extremes like destroying 50 BTC)
2. Coinbase transaction output value the miner chose to mine is 6.46 BTC by a modified mining software, 0.01 BTC too much than fees and block reward would allow: result is wasted energy for "mining" a faulty block that won't be accepted by any compliant node due to consensus rules violation!


Title: Re: Newbie help; What happens when the combine transaction fee and block reward ar
Post by: ABCbits on April 15, 2022, 11:54:59 AM
My questions;
1. Does these apply to every transactions?

No.

2. If no, please explain the phenomenon behind it?

There's no rule which forbid you to spend output from non-coinbase transaction with less than 100 confirmation (even if it has 0 confirmation).

3. What happens when combined reward of the block with its transaction fee is bigger than the output value

The unclaimed amount of Bitcoin is lost forever.


Title: Re: Newbie help; What happens when the combine transaction fee and block reward ar
Post by: nc50lc on April 16, 2022, 04:51:22 AM
2. If no, please explain the phenomenon behind it?
It's part of the consensus rules.
The value is set in this part of the reference client's code: github.com/bitcoin/bitcoin/blob/master/src/consensus/consensus.h (https://github.com/bitcoin/bitcoin/blob/master/src/consensus/consensus.h#L19)

Reasons for the having "coinbase_maturity" are already given by others;
more in bitcoin.stackexchange: bitcoin.stackexchange.com/questions/1991/what-is-the-block-maturation-time (https://bitcoin.stackexchange.com/questions/1991/what-is-the-block-maturation-time)


Title: Re: Newbie help; What happens when the combine transaction fee and block reward ar
Post by: o_e_l_e_o on April 16, 2022, 01:13:37 PM
3. What happens when combined reward of the block with its transaction fee is bigger than the output value
It's not entirely clear what you are asking here.

The limit enforced by the protocol is that the sum of all the outputs in a block must be equal to or less than the sum of all the inputs in a block plus the block subsidy, which is currently 6.25 BTC. This effectively places an upper limit on the output from the coinbase transaction of 6.25 BTC plus the sum of all the fees in the block. Miners are free to claim less than this if they wish (including claiming nothing at all), but attempting to claim more than this will result in their block being rejected by other nodes.

Coinbase transactions themselves do not pay fees, since the miner includes the transaction directly.