public inbox for bitcoindev@googlegroups.com
 help / color / mirror / Atom feed
From: Denis Andrejew <da.colonel@gmail.com>
To: bitcoin-development@lists.sourceforge.net
Subject: [Bitcoin-development] working with the blockchain: transaction fees & sum(inputs) != sum(outputs) (newbie questions)
Date: Fri, 14 Feb 2014 13:20:45 +0100	[thread overview]
Message-ID: <CAPc1t_8kp7dRpjPkK0K6K+mBz4dF9tsVx9n55eaW30FeFvU1EA@mail.gmail.com> (raw)

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

Hi all!

I'm new to development with bitcoin and I have a question for you guys:

What I'm trying to do is read the blockchain in order to find all unspent
outputs. I'm using bitcoind via rpc as my source of information about the
blockchain.

Now one thing that I don't understand fully yet when working with the
transaction data I'm being given is:

How do transaction fees work? More specifically: I can see that there is
often a gap between the sum of the ins and the sum of the outs in a
transaction and I understand that this is the transaction fee. But how can
the miner spend it if it is not assigned as an output of any transaction?
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? 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?

I am a bit confused about this part. Other than that it's quite fascinating
to see how bitcoin works and work with it. :)

So if one of you could kindly explain to me the technical view of
transaction fees (i.e. how exactly do I find them and account for them in
the blockchain), that would be brilliant!

And the other question would be this one (directly related):

What are the cases where the sum of the input values (from the referenced
transactions) can be different from the sum of the output values?

These cases I have found and understand:

1) "coinbase" transactions that "print money" have no inputs, only 50/25
coins output (less in the future)
2) transaction fees when in > out

Are there other cases?

Thanks,
Denis

"Be the change you want to see in the world." (Mahatma Gandhi)

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

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

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-14 12:20 Denis Andrejew [this message]
2014-02-14 12:42 ` [Bitcoin-development] working with the blockchain: transaction fees & sum(inputs) != sum(outputs) (newbie questions) Wladimir
     [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=CAPc1t_8kp7dRpjPkK0K6K+mBz4dF9tsVx9n55eaW30FeFvU1EA@mail.gmail.com \
    --to=da.colonel@gmail.com \
    --cc=bitcoin-development@lists.sourceforge.net \
    /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