summaryrefslogtreecommitdiff
path: root/79/8e596705a31cd504f1b1bcff596b63af7f3f55
blob: 4224160d1b50e02efab956dee38ed295f6cddb40 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
Received: from sog-mx-1.v43.ch3.sourceforge.com ([172.29.43.191]
	helo=mx.sourceforge.net)
	by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.76)
	(envelope-from <laanwj@gmail.com>) id 1WEI6h-0007lJ-RZ
	for bitcoin-development@lists.sourceforge.net;
	Fri, 14 Feb 2014 12:43:03 +0000
Received-SPF: pass (sog-mx-1.v43.ch3.sourceforge.com: domain of gmail.com
	designates 209.85.214.44 as permitted sender)
	client-ip=209.85.214.44; envelope-from=laanwj@gmail.com;
	helo=mail-bk0-f44.google.com; 
Received: from mail-bk0-f44.google.com ([209.85.214.44])
	by sog-mx-1.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128)
	(Exim 4.76) id 1WEI6g-0000b3-P2
	for bitcoin-development@lists.sourceforge.net;
	Fri, 14 Feb 2014 12:43:03 +0000
Received: by mail-bk0-f44.google.com with SMTP id r7so195151bkg.31
	for <bitcoin-development@lists.sourceforge.net>;
	Fri, 14 Feb 2014 04:42:56 -0800 (PST)
MIME-Version: 1.0
X-Received: by 10.205.75.74 with SMTP id yz10mr103200bkb.43.1392381776392;
	Fri, 14 Feb 2014 04:42:56 -0800 (PST)
Received: by 10.205.75.72 with HTTP; Fri, 14 Feb 2014 04:42:56 -0800 (PST)
In-Reply-To: <CAPc1t_8kp7dRpjPkK0K6K+mBz4dF9tsVx9n55eaW30FeFvU1EA@mail.gmail.com>
References: <CAPc1t_8kp7dRpjPkK0K6K+mBz4dF9tsVx9n55eaW30FeFvU1EA@mail.gmail.com>
Date: Fri, 14 Feb 2014 13:42:56 +0100
Message-ID: <CA+s+GJCrLv60TKC-C1cHRq+om9fMVSiVwjKL-vR9bBOy5kU=wQ@mail.gmail.com>
From: Wladimir <laanwj@gmail.com>
To: Denis Andrejew <da.colonel@gmail.com>
Content-Type: multipart/alternative; boundary=f46d041037372c9fc204f25d257a
X-Spam-Score: -0.6 (/)
X-Spam-Report: Spam Filtering performed by mx.sourceforge.net.
	See http://spamassassin.org/tag/ for more details.
	-1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for
	sender-domain
	0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider
	(laanwj[at]gmail.com)
	-0.0 SPF_PASS               SPF: sender matches SPF record
	1.0 HTML_MESSAGE           BODY: HTML included in message
	-0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from
	author's domain
	0.1 DKIM_SIGNED            Message has a DKIM or DK signature,
	not necessarily valid
	-0.1 DKIM_VALID Message has at least one valid DKIM or DK signature
X-Headers-End: 1WEI6g-0000b3-P2
Cc: Bitcoin Dev <bitcoin-development@lists.sourceforge.net>
Subject: Re: [Bitcoin-development] working with the blockchain: transaction
 fees & sum(inputs) != sum(outputs) (newbie questions)
X-BeenThere: bitcoin-development@lists.sourceforge.net
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: <bitcoin-development.lists.sourceforge.net>
List-Unsubscribe: <https://lists.sourceforge.net/lists/listinfo/bitcoin-development>,
	<mailto:bitcoin-development-request@lists.sourceforge.net?subject=unsubscribe>
List-Archive: <http://sourceforge.net/mailarchive/forum.php?forum_name=bitcoin-development>
List-Post: <mailto:bitcoin-development@lists.sourceforge.net>
List-Help: <mailto:bitcoin-development-request@lists.sourceforge.net?subject=help>
List-Subscribe: <https://lists.sourceforge.net/lists/listinfo/bitcoin-development>,
	<mailto:bitcoin-development-request@lists.sourceforge.net?subject=subscribe>
X-List-Received-Date: Fri, 14 Feb 2014 12:43:04 -0000

--f46d041037372c9fc204f25d257a
Content-Type: text/plain; charset=UTF-8

>
> 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

--f46d041037372c9fc204f25d257a
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_extra"><div class=3D"gmail_quote"><blo=
ckquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left=
-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;paddi=
ng-left:1ex">
<div dir=3D"ltr"><div>Is there special code somewhere that keeps track of a=
ll the btc not spent in all the transactions of a block and allows the mine=
r&#39;s address (ie the address in the first tx of that block) to spend tha=
t? </div>
</div></blockquote><div><br></div><div>Something like that:</div><div>Every=
 block has a coinbase transaction at the beginning.</div><div>The coinbase =
transaction is special, in that it can pay coins to its outputs without hav=
ing to specify an input.</div>
<div><br></div><div>The total value of the outputs of the coinbase transact=
ion can be at most the block value (the fixed amount per block) + the fees =
(summed over all transactions in the block).</div><div><br></div><div>This =
is checked in ConnectBlock in=C2=A0</div>
<div><a href=3D"https://github.com/bitcoin/bitcoin/blob/master/src/main.cpp=
#L1711">https://github.com/bitcoin/bitcoin/blob/master/src/main.cpp#L1711</=
a><br></div><div>The value of the coinbase transaction is being checked on =
line 1731.</div>
<div><br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0p=
x 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-lef=
t-style:solid;padding-left:1ex"><div dir=3D"ltr"><div>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 ha=
ve the miner&#39;s address attached to it or what?</div>
</div></blockquote><div><br></div><div>The only transactions in which the s=
um of the outputs can be larger than the sum of the inputs are the aforemen=
tioned coinbase transactions (which cannot have inputs).</div><div><br>
</div><div>The outputs from the coinbase transaction can be spent as any ot=
her output.</div><div><br></div><div>Wladimir</div><div><br></div></div></d=
iv></div>

--f46d041037372c9fc204f25d257a--