public inbox for bitcoindev@googlegroups.com
 help / color / mirror / Atom feed
From: Wladimir <laanwj@gmail.com>
To: Denis Andrejew <da.colonel@gmail.com>
Cc: Bitcoin Dev <bitcoin-development@lists.sourceforge.net>
Subject: Re: [Bitcoin-development] working with the blockchain: transaction fees & sum(inputs) != sum(outputs) (newbie questions)
Date: Fri, 14 Feb 2014 13:42:56 +0100	[thread overview]
Message-ID: <CA+s+GJCrLv60TKC-C1cHRq+om9fMVSiVwjKL-vR9bBOy5kU=wQ@mail.gmail.com> (raw)
In-Reply-To: <CAPc1t_8kp7dRpjPkK0K6K+mBz4dF9tsVx9n55eaW30FeFvU1EA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1232 bytes --]

>
> 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
https://github.com/bitcoin/bitcoin/blob/master/src/main.cpp#L1711
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.

Wladimir

[-- Attachment #2: Type: text/html, Size: 2037 bytes --]

  reply	other threads:[~2014-02-14 12:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-14 12:20 [Bitcoin-development] working with the blockchain: transaction fees & sum(inputs) != sum(outputs) (newbie questions) Denis Andrejew
2014-02-14 12:42 ` Wladimir [this message]
     [not found] ` <52FE4782.6020001@monetize.io>
2014-02-14 20:56   ` Denis Andrejew
2014-02-14 23:01     ` Mark Friedenbach

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CA+s+GJCrLv60TKC-C1cHRq+om9fMVSiVwjKL-vR9bBOy5kU=wQ@mail.gmail.com' \
    --to=laanwj@gmail.com \
    --cc=bitcoin-development@lists.sourceforge.net \
    --cc=da.colonel@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox