[Bitcoin-development] working with the blockchain: transaction fees & sum(inputs) != sum(outputs) (newbie questions)
laanwj at gmail.com
Fri Feb 14 12:42:56 UTC 2014
> Is there special code somewhere that keeps track of all the btc not spent
> in all the transactions of a block and allows the miner's address (ie the
> address in the first tx of that block) to spend that?
Something like that:
Every block has a coinbase transaction at the beginning.
The coinbase transaction is special, in that it can pay coins to its
outputs without having to specify an input.
The total value of the outputs of the coinbase transaction can be at most
the block value (the fixed amount per block) + the fees (summed over all
transactions in the block).
This is checked in ConnectBlock in
The value of the coinbase transaction is being checked on line 1731.
But if so, how would that work then? I should be finding transactions then
> where the sum of the ouputs is higher than the sum of the inputs and one of
> the inputs should have the miner's address attached to it or what?
The only transactions in which the sum of the outputs can be larger than
the sum of the inputs are the aforementioned coinbase transactions (which
cannot have inputs).
The outputs from the coinbase transaction can be spent as any other output.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the bitcoin-dev