summaryrefslogtreecommitdiff
path: root/0d/30c3e1f1be90d1f14779205491221f4c4cb15a
blob: 1bcc30d1f2e4944eb4865134dc2862d87408bd15 (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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
Received: from sog-mx-3.v43.ch3.sourceforge.com ([172.29.43.193]
	helo=mx.sourceforge.net)
	by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.76)
	(envelope-from <mh.in.england@gmail.com>) id 1X5Fa7-0005MT-GG
	for bitcoin-development@lists.sourceforge.net;
	Thu, 10 Jul 2014 14:44:19 +0000
Received-SPF: pass (sog-mx-3.v43.ch3.sourceforge.com: domain of gmail.com
	designates 209.85.219.52 as permitted sender)
	client-ip=209.85.219.52; envelope-from=mh.in.england@gmail.com;
	helo=mail-oa0-f52.google.com; 
Received: from mail-oa0-f52.google.com ([209.85.219.52])
	by sog-mx-3.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128)
	(Exim 4.76) id 1X5Fa5-0000Jf-Ja
	for bitcoin-development@lists.sourceforge.net;
	Thu, 10 Jul 2014 14:44:19 +0000
Received: by mail-oa0-f52.google.com with SMTP id j17so9992929oag.11
	for <bitcoin-development@lists.sourceforge.net>;
	Thu, 10 Jul 2014 07:44:12 -0700 (PDT)
MIME-Version: 1.0
X-Received: by 10.182.133.69 with SMTP id pa5mr33074924obb.2.1405003452115;
	Thu, 10 Jul 2014 07:44:12 -0700 (PDT)
Sender: mh.in.england@gmail.com
Received: by 10.76.35.234 with HTTP; Thu, 10 Jul 2014 07:44:11 -0700 (PDT)
In-Reply-To: <CANEZrP1t3Pz3FOgxkxsj+sSgyQhPxfUTdCGXTC7=yxeZkGt-DQ@mail.gmail.com>
References: <CANEZrP1t3Pz3FOgxkxsj+sSgyQhPxfUTdCGXTC7=yxeZkGt-DQ@mail.gmail.com>
Date: Thu, 10 Jul 2014 16:44:11 +0200
X-Google-Sender-Auth: MeoDwwKDuak-ELBXAKGPPwqyW7g
Message-ID: <CANEZrP3++BPQsX_oxw-BTOgOhf5Gt1oaGz=hJ_iBcwVCzrS+ZA@mail.gmail.com>
From: Mike Hearn <mike@plan99.net>
To: Bitcoin Dev <bitcoin-development@lists.sourceforge.net>
Content-Type: multipart/alternative; boundary=e89a8ff1ce12abf25804fdd7db7b
X-Spam-Score: -0.5 (/)
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
	(mh.in.england[at]gmail.com)
	-0.0 SPF_PASS               SPF: sender matches SPF record
	1.0 HTML_MESSAGE           BODY: HTML included in message
	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: 1X5Fa5-0000Jf-Ja
Subject: Re: [Bitcoin-development] Draft BIP for geutxos message
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: Thu, 10 Jul 2014 14:44:19 -0000

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

I took the number out, it is now just "the getutxo bip" until a number is
assigned.


On Thu, Jul 10, 2014 at 4:29 PM, Mike Hearn <mike@plan99.net> wrote:

> I opened up a pull req for a draft BIP for getutxo.
>
>    https://github.com/bitcoin/bips/pull/88
>
> I include a rendering below for your reading convenience. If you'd like to
> comment on design/security/etc then please first familiarise yourself with
> the long discussions that were already had here:
>
>    https://github.com/bitcoin/bitcoin/pull/4351
>
>
>   BIP: 45
>   Title: getutxo message
>   Author: Mike Hearn <hearn@vinumeris.com>
>   Status: Draft
>   Type: Standards Track
>   Created: 2014-06-10
>
>  Table of Contents
>
>    - Abstract
>       <https://github.com/mikehearn/bips/commit/6058b92f5d9804ee4104649f53afc2fa53248c81?short_path=35c7795#Abstract>
>       - Motivation
>       <https://github.com/mikehearn/bips/commit/6058b92f5d9804ee4104649f53afc2fa53248c81?short_path=35c7795#Motivation>
>       - Specification
>       <https://github.com/mikehearn/bips/commit/6058b92f5d9804ee4104649f53afc2fa53248c81?short_path=35c7795#Specification>
>       - Backward compatibility
>       <https://github.com/mikehearn/bips/commit/6058b92f5d9804ee4104649f53afc2fa53248c81?short_path=35c7795#Backward_compatibility>
>       - Authentication
>       <https://github.com/mikehearn/bips/commit/6058b92f5d9804ee4104649f53afc2fa53248c81?short_path=35c7795#Authentication>
>       - Implementation
>       <https://github.com/mikehearn/bips/commit/6058b92f5d9804ee4104649f53afc2fa53248c81?short_path=35c7795#Implementation>
>
>
> <https://github.com/mikehearn/bips/commit/6058b92f5d9804ee4104649f53afc2fa53248c81?short_path=35c7795#abstract>
> Abstract
>
> This document describes a small P2P protocol extension that performs UTXO
> lookups given a set of outpoints.
>
> <https://github.com/mikehearn/bips/commit/6058b92f5d9804ee4104649f53afc2fa53248c81?short_path=35c7795#motivation>
> Motivation
>
> All full Bitcoin nodes maintain a database called the unspent transaction
> output set. This set is how double spending is checked for: to be valid a
> transaction must identify unspent outputs in this set using an identifier
> called an "outpoint", which is merely the hash of the output's containing
> transaction plus an index.
>
> The ability to query this can sometimes be useful for a lightweight/SPV
> client which does not have the full UTXO set at hand. For example, it can
> be useful in applications implementing assurance contracts to do a quick
> check when a new pledge becomes visible to test whether that pledge was
> already revoked via a double spend. Although this message is not strictly
> necessary because e.g. such an app could be implemented by fully
> downloading and storing the block chain, it is useful for obtaining
> acceptable performance and resolving various UI cases.
>
> Another example of when this data can be useful is for performing floating
> fee calculations in an SPV wallet. This use case requires some other
> changes to the Bitcoin protocol however, so we will not dwell on it here.
>
> <https://github.com/mikehearn/bips/commit/6058b92f5d9804ee4104649f53afc2fa53248c81?short_path=35c7795#specification>
> Specification
>
> Two new messages are defined. The "getutxos" message has the following
> structure:
>
>  Field Size DescriptionData typeComments 1check mempoolbool Whether to
> apply mempool transactions during the calculation, thus exposing their
> UTXOs and removing outputs that they spend. ?outpointsvector The list of
> outpoints to be queried. Each outpoint is serialized in the same way it is
> in a tx message.
>
> The response message "utxos" has the following structure:
>
>  Field Size DescriptionData typeComments 4chain heightuint32 The height
> of the chain at the moment the result was calculated. 32chain tip hash
> uint256 Block hash of the top of the chain at the moment the result was
> calculated. ?hit bitmapbyte[] An array of bytes encoding one bit for each
> outpoint queried. Each bit indicates whether the queried outpoint was found
> in the UTXO set or not. ?result utxosresult[] A list of result objects
> (defined below), one for each outpoint that is unspent (i.e. has a bit set
> in the bitmap).
>
> The result object is defined as:
>
>  Field Size DescriptionData typeComments 4tx versionuint32 The version
> number of the transaction the UTXO was found in. 4heightuint256 The
> height of the block containing the defining transaction, or 0x7FFFFFFF if
> the tx is in the mempool. ?outputCTxOut The output itself, serialized in
> the same way as in a tx message.
> <https://github.com/mikehearn/bips/commit/6058b92f5d9804ee4104649f53afc2fa53248c81?short_path=35c7795#backward-compatibility>Backward
> compatibility
>
> Nodes indicate support by advertising a protocol version above 70003 and
> by setting a new NODE_GETUTXO flag in their nServices field, which has a
> value of 2 (1
>
> <https://github.com/mikehearn/bips/commit/6058b92f5d9804ee4104649f53afc2fa53248c81?short_path=35c7795#authentication>
> Authentication
>
> The UTXO set is not currently authenticated by anything. There are
> proposals to resolve this by introducing a new consensus rule that commits
> to a root hash of the UTXO set in blocks, however this feature is not
> presently available in the Bitcoin protocol. Once it is, the utxos message
> could be upgraded to include Merkle branches showing inclusion of the UTXOs
> in the committed sets.
>
> If the requesting client is looking up outputs for a signed transaction
> that they have locally, the client can partly verify the returned output by
> running the input scripts with it. Currently this verifies only that the
> script is correct. A future version of the Bitcoin protocol is likely to
> also allow the value to be checked in this way. It does not show that the
> output is really unspent or was ever actually created in the block chain
> however.
>
> If the requesting client has a mapping of chain heights to block hashes in
> the best chain e.g. obtained via getheaders, then they can obtain a proof
> that the output did at one point exist by requesting the block and
> searching for the output within it. When combined with Bloom filtering this
> can be reasonably efficient.
>
> Note that even when the outputs are being checked against something this
> protocol has the same security model as Bloom filtering: a remote node can
> lie through omission by claiming the requested UTXO does not exist / was
> already spent (they are the same, from the perspective of a full node).
> Querying multiple nodes and combining their answers can be a partial
> solution to this, although as nothing authenticates the Bitcoin P2P network
> a man in the middle could still yield incorrect results.
>
> <https://github.com/mikehearn/bips/commit/6058b92f5d9804ee4104649f53afc2fa53248c81?short_path=35c7795#implementation>
> Implementation
>
> https://github.com/bitcoin/bitcoin/pull/4351/files
>

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

<div dir=3D"ltr">I took the number out, it is now just &quot;the getutxo bi=
p&quot; until a number is assigned.</div><div class=3D"gmail_extra"><br><br=
><div class=3D"gmail_quote">On Thu, Jul 10, 2014 at 4:29 PM, Mike Hearn <sp=
an dir=3D"ltr">&lt;<a href=3D"mailto:mike@plan99.net" target=3D"_blank">mik=
e@plan99.net</a>&gt;</span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div>I opened up a pull req=
 for a draft BIP for getutxo.</div><div><br></div>=C2=A0 =C2=A0<a href=3D"h=
ttps://github.com/bitcoin/bips/pull/88" target=3D"_blank">https://github.co=
m/bitcoin/bips/pull/88</a><br>
<div><br></div><div>I include a rendering below for your reading convenienc=
e. If you&#39;d like to comment on design/security/etc then please first fa=
miliarise yourself with the long discussions that were already had here:</d=
iv>

<div><br></div><div>=C2=A0 =C2=A0<a href=3D"https://github.com/bitcoin/bitc=
oin/pull/4351" target=3D"_blank">https://github.com/bitcoin/bitcoin/pull/43=
51</a><br></div><div><br></div><div><br></div><div><pre style=3D"overflow:a=
uto;font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;=
font-size:13px;margin:15px auto;border:1px solid rgb(221,221,221);line-heig=
ht:19px;padding:10px 20px;border-top-left-radius:3px;border-top-right-radiu=
s:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-wra=
p:normal;max-width:700px;color:rgb(51,51,51);background-color:rgb(248,248,2=
48)">
  BIP: 45
  Title: getutxo message
  Author: Mike Hearn &lt;<a href=3D"mailto:hearn@vinumeris.com" target=3D"_=
blank">hearn@vinumeris.com</a>&gt;
  Status: Draft
  Type: Standards Track
  Created: 2014-06-10
</pre><p style=3D"margin:15px auto;max-width:700px;color:rgb(51,51,51);font=
-family:Helvetica,arial,freesans,clean,sans-serif,&#39;Segoe UI Emoji&#39;,=
&#39;Segoe UI Symbol&#39;;font-size:16px;line-height:27.200000762939453px">

</p><table summary=3D"Contents" style=3D"border-collapse:collapse;border-sp=
acing:0px;margin:15px auto;width:700px;overflow:auto;display:block;max-widt=
h:700px;color:rgb(51,51,51);font-family:Helvetica,arial,freesans,clean,sans=
-serif,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;;font-size:16px;li=
ne-height:27.200000762939453px">

<tbody><tr style=3D"border-top-width:1px;border-top-style:solid;border-top-=
color:rgb(204,204,204)"><td style=3D"padding:6px 13px;border:1px solid rgb(=
221,221,221)"><div>Table of Contents</div><ul style=3D"padding:0px 0px 0px =
30px;margin:15px 0px">

<ul style=3D"padding:0px 0px 0px 30px;margin:0px"><li><a href=3D"https://gi=
thub.com/mikehearn/bips/commit/6058b92f5d9804ee4104649f53afc2fa53248c81?sho=
rt_path=3D35c7795#Abstract" style=3D"color:rgb(65,131,196);text-decoration:=
none;background:transparent" target=3D"_blank">Abstract</a></li>

<li><a href=3D"https://github.com/mikehearn/bips/commit/6058b92f5d9804ee410=
4649f53afc2fa53248c81?short_path=3D35c7795#Motivation" style=3D"color:rgb(6=
5,131,196);text-decoration:none;background:transparent" target=3D"_blank">M=
otivation</a></li>
<li>
<a href=3D"https://github.com/mikehearn/bips/commit/6058b92f5d9804ee4104649=
f53afc2fa53248c81?short_path=3D35c7795#Specification" style=3D"color:rgb(65=
,131,196);text-decoration:none;background:transparent" target=3D"_blank">Sp=
ecification</a></li>

<li><a href=3D"https://github.com/mikehearn/bips/commit/6058b92f5d9804ee410=
4649f53afc2fa53248c81?short_path=3D35c7795#Backward_compatibility" style=3D=
"color:rgb(65,131,196);text-decoration:none;background:transparent" target=
=3D"_blank">Backward compatibility</a></li>

<li><a href=3D"https://github.com/mikehearn/bips/commit/6058b92f5d9804ee410=
4649f53afc2fa53248c81?short_path=3D35c7795#Authentication" style=3D"color:r=
gb(65,131,196);text-decoration:none;background:transparent" target=3D"_blan=
k">Authentication</a></li>

<li><a href=3D"https://github.com/mikehearn/bips/commit/6058b92f5d9804ee410=
4649f53afc2fa53248c81?short_path=3D35c7795#Implementation" style=3D"color:r=
gb(65,131,196);text-decoration:none;background:transparent" target=3D"_blan=
k">Implementation</a></li>

</ul></ul></td></tr></tbody></table><h2 style=3D"margin:15px auto;line-heig=
ht:1.7;font-size:2em;padding:0px;border-bottom-width:1px;border-bottom-styl=
e:solid;border-bottom-color:rgb(238,238,238);max-width:700px;color:rgb(51,5=
1,51);font-family:Helvetica,arial,freesans,clean,sans-serif,&#39;Segoe UI E=
moji&#39;,&#39;Segoe UI Symbol&#39;">

<a name=3D"14720ad957acd8bb_user-content-abstract" href=3D"https://github.c=
om/mikehearn/bips/commit/6058b92f5d9804ee4104649f53afc2fa53248c81?short_pat=
h=3D35c7795#abstract" style=3D"color:rgb(65,131,196);text-decoration:none;d=
isplay:block;padding-right:6px;padding-left:30px;background:transparent" ta=
rget=3D"_blank"></a><a name=3D"14720ad957acd8bb_user-content-Abstract" styl=
e=3D"color:rgb(65,131,196);background:transparent">Abstract</a></h2>

<p style=3D"margin:15px auto;max-width:700px;color:rgb(51,51,51);font-famil=
y:Helvetica,arial,freesans,clean,sans-serif,&#39;Segoe UI Emoji&#39;,&#39;S=
egoe UI Symbol&#39;;font-size:16px;line-height:27.200000762939453px">This d=
ocument describes a small P2P protocol extension that performs UTXO lookups=
 given a set of outpoints.</p>

<h2 style=3D"margin:15px auto;line-height:1.7;font-size:2em;padding:0px;bor=
der-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(238,=
238,238);max-width:700px;color:rgb(51,51,51);font-family:Helvetica,arial,fr=
eesans,clean,sans-serif,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;"=
>

<a name=3D"14720ad957acd8bb_user-content-motivation" href=3D"https://github=
.com/mikehearn/bips/commit/6058b92f5d9804ee4104649f53afc2fa53248c81?short_p=
ath=3D35c7795#motivation" style=3D"color:rgb(65,131,196);text-decoration:no=
ne;display:block;padding-right:6px;padding-left:30px;background:transparent=
" target=3D"_blank"></a><a name=3D"14720ad957acd8bb_user-content-Motivation=
" style=3D"color:rgb(65,131,196);background:transparent">Motivation</a></h2=
>

<p style=3D"margin:15px auto;max-width:700px;color:rgb(51,51,51);font-famil=
y:Helvetica,arial,freesans,clean,sans-serif,&#39;Segoe UI Emoji&#39;,&#39;S=
egoe UI Symbol&#39;;font-size:16px;line-height:27.200000762939453px">All fu=
ll Bitcoin nodes maintain a database called the unspent transaction output =
set. This set is how double spending is checked for: to be valid a transact=
ion must identify unspent outputs in this set using an identifier called an=
 &quot;outpoint&quot;, which is merely the hash of the output&#39;s contain=
ing transaction plus an index.</p>

<p style=3D"margin:15px auto;max-width:700px;color:rgb(51,51,51);font-famil=
y:Helvetica,arial,freesans,clean,sans-serif,&#39;Segoe UI Emoji&#39;,&#39;S=
egoe UI Symbol&#39;;font-size:16px;line-height:27.200000762939453px">The ab=
ility to query this can sometimes be useful for a lightweight/SPV client wh=
ich does not have the full UTXO set at hand. For example, it can be useful =
in applications implementing assurance contracts to do a quick check when a=
 new pledge becomes visible to test whether that pledge was already revoked=
 via a double spend. Although this message is not strictly necessary becaus=
e e.g. such an app could be implemented by fully downloading and storing th=
e block chain, it is useful for obtaining acceptable performance and resolv=
ing various UI cases.</p>

<p style=3D"margin:15px auto;max-width:700px;color:rgb(51,51,51);font-famil=
y:Helvetica,arial,freesans,clean,sans-serif,&#39;Segoe UI Emoji&#39;,&#39;S=
egoe UI Symbol&#39;;font-size:16px;line-height:27.200000762939453px">Anothe=
r example of when this data can be useful is for performing floating fee ca=
lculations in an SPV wallet. This use case requires some other changes to t=
he Bitcoin protocol however, so we will not dwell on it here.</p>

<h2 style=3D"margin:15px auto;line-height:1.7;font-size:2em;padding:0px;bor=
der-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(238,=
238,238);max-width:700px;color:rgb(51,51,51);font-family:Helvetica,arial,fr=
eesans,clean,sans-serif,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;"=
>

<a name=3D"14720ad957acd8bb_user-content-specification" href=3D"https://git=
hub.com/mikehearn/bips/commit/6058b92f5d9804ee4104649f53afc2fa53248c81?shor=
t_path=3D35c7795#specification" style=3D"color:rgb(65,131,196);text-decorat=
ion:none;display:block;padding-right:6px;padding-left:30px;background:trans=
parent" target=3D"_blank"></a><a name=3D"14720ad957acd8bb_user-content-Spec=
ification" style=3D"color:rgb(65,131,196);background:transparent">Specifica=
tion</a></h2>

<p style=3D"margin:15px auto;max-width:700px;color:rgb(51,51,51);font-famil=
y:Helvetica,arial,freesans,clean,sans-serif,&#39;Segoe UI Emoji&#39;,&#39;S=
egoe UI Symbol&#39;;font-size:16px;line-height:27.200000762939453px">Two ne=
w messages are defined. The &quot;getutxos&quot; message has the following =
structure:</p>

<p style=3D"margin:15px auto;max-width:700px;color:rgb(51,51,51);font-famil=
y:Helvetica,arial,freesans,clean,sans-serif,&#39;Segoe UI Emoji&#39;,&#39;S=
egoe UI Symbol&#39;;font-size:16px;line-height:27.200000762939453px"></p>

<table style=3D"border-collapse:collapse;border-spacing:0px;margin:15px aut=
o;width:700px;overflow:auto;display:block;max-width:700px;color:rgb(51,51,5=
1);font-family:Helvetica,arial,freesans,clean,sans-serif,&#39;Segoe UI Emoj=
i&#39;,&#39;Segoe UI Symbol&#39;;font-size:16px;line-height:27.200000762939=
453px">

<tbody><tr style=3D"border-top-width:1px;border-top-style:solid;border-top-=
color:rgb(204,204,204)"><th style=3D"padding:6px 13px;border:1px solid rgb(=
221,221,221)">Field Size</th><th style=3D"padding:6px 13px;border:1px solid=
 rgb(221,221,221)">

Description</th><th style=3D"padding:6px 13px;border:1px solid rgb(221,221,=
221)">Data type</th><th style=3D"padding:6px 13px;border:1px solid rgb(221,=
221,221)">Comments</th></tr><tr style=3D"border-top-width:1px;border-top-st=
yle:solid;border-top-color:rgb(204,204,204);background-color:rgb(248,248,24=
8)">

<td style=3D"padding:6px 13px;border:1px solid rgb(221,221,221)">1</td><td =
style=3D"padding:6px 13px;border:1px solid rgb(221,221,221)">check mempool<=
/td><td style=3D"padding:6px 13px;border:1px solid rgb(221,221,221)">bool</=
td>

<td style=3D"padding:6px 13px;border:1px solid rgb(221,221,221)">Whether to=
 apply mempool transactions during the calculation, thus exposing their UTX=
Os and removing outputs that they spend.</td></tr><tr style=3D"border-top-w=
idth:1px;border-top-style:solid;border-top-color:rgb(204,204,204)">

<td style=3D"padding:6px 13px;border:1px solid rgb(221,221,221)">?</td><td =
style=3D"padding:6px 13px;border:1px solid rgb(221,221,221)">outpoints</td>=
<td style=3D"padding:6px 13px;border:1px solid rgb(221,221,221)">vector</td=
>
<td style=3D"padding:6px 13px;border:1px solid rgb(221,221,221)">
The list of outpoints to be queried. Each outpoint is serialized in the sam=
e way it is in a tx message.</td></tr></tbody></table><p style=3D"margin:15=
px auto;max-width:700px;color:rgb(51,51,51);font-family:Helvetica,arial,fre=
esans,clean,sans-serif,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;;f=
ont-size:16px;line-height:27.200000762939453px">

The response message &quot;utxos&quot; has the following structure:</p><p s=
tyle=3D"margin:15px auto;max-width:700px;color:rgb(51,51,51);font-family:He=
lvetica,arial,freesans,clean,sans-serif,&#39;Segoe UI Emoji&#39;,&#39;Segoe=
 UI Symbol&#39;;font-size:16px;line-height:27.200000762939453px">

</p><table style=3D"border-collapse:collapse;border-spacing:0px;margin:15px=
 auto;width:700px;overflow:auto;display:block;max-width:700px;color:rgb(51,=
51,51);font-family:Helvetica,arial,freesans,clean,sans-serif,&#39;Segoe UI =
Emoji&#39;,&#39;Segoe UI Symbol&#39;;font-size:16px;line-height:27.20000076=
2939453px">

<tbody><tr style=3D"border-top-width:1px;border-top-style:solid;border-top-=
color:rgb(204,204,204)"><th style=3D"padding:6px 13px;border:1px solid rgb(=
221,221,221)">Field Size</th><th style=3D"padding:6px 13px;border:1px solid=
 rgb(221,221,221)">

Description</th><th style=3D"padding:6px 13px;border:1px solid rgb(221,221,=
221)">Data type</th><th style=3D"padding:6px 13px;border:1px solid rgb(221,=
221,221)">Comments</th></tr><tr style=3D"border-top-width:1px;border-top-st=
yle:solid;border-top-color:rgb(204,204,204);background-color:rgb(248,248,24=
8)">

<td style=3D"padding:6px 13px;border:1px solid rgb(221,221,221)">4</td><td =
style=3D"padding:6px 13px;border:1px solid rgb(221,221,221)">chain height</=
td><td style=3D"padding:6px 13px;border:1px solid rgb(221,221,221)">uint32<=
/td>

<td style=3D"padding:6px 13px;border:1px solid rgb(221,221,221)">The height=
 of the chain at the moment the result was calculated.</td></tr><tr style=
=3D"border-top-width:1px;border-top-style:solid;border-top-color:rgb(204,20=
4,204)">

<td style=3D"padding:6px 13px;border:1px solid rgb(221,221,221)">32</td><td=
 style=3D"padding:6px 13px;border:1px solid rgb(221,221,221)">chain tip has=
h</td><td style=3D"padding:6px 13px;border:1px solid rgb(221,221,221)">uint=
256</td>

<td style=3D"padding:6px 13px;border:1px solid rgb(221,221,221)">Block hash=
 of the top of the chain at the moment the result was calculated.</td></tr>=
<tr style=3D"border-top-width:1px;border-top-style:solid;border-top-color:r=
gb(204,204,204);background-color:rgb(248,248,248)">

<td style=3D"padding:6px 13px;border:1px solid rgb(221,221,221)">?</td><td =
style=3D"padding:6px 13px;border:1px solid rgb(221,221,221)">hit bitmap</td=
><td style=3D"padding:6px 13px;border:1px solid rgb(221,221,221)">byte[]</t=
d>

<td style=3D"padding:6px 13px;border:1px solid rgb(221,221,221)">An array o=
f bytes encoding one bit for each outpoint queried. Each bit indicates whet=
her the queried outpoint was found in the UTXO set or not.</td></tr><tr sty=
le=3D"border-top-width:1px;border-top-style:solid;border-top-color:rgb(204,=
204,204)">

<td style=3D"padding:6px 13px;border:1px solid rgb(221,221,221)">?</td><td =
style=3D"padding:6px 13px;border:1px solid rgb(221,221,221)">result utxos</=
td><td style=3D"padding:6px 13px;border:1px solid rgb(221,221,221)">result[=
]</td>

<td style=3D"padding:6px 13px;border:1px solid rgb(221,221,221)">A list of =
result objects (defined below), one for each outpoint that is unspent (i.e.=
 has a bit set in the bitmap).</td></tr></tbody></table><p style=3D"margin:=
15px auto;max-width:700px;color:rgb(51,51,51);font-family:Helvetica,arial,f=
reesans,clean,sans-serif,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;=
;font-size:16px;line-height:27.200000762939453px">

The result object is defined as:</p><p style=3D"margin:15px auto;max-width:=
700px;color:rgb(51,51,51);font-family:Helvetica,arial,freesans,clean,sans-s=
erif,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;;font-size:16px;line=
-height:27.200000762939453px">

</p><table style=3D"border-collapse:collapse;border-spacing:0px;margin:15px=
 auto;width:700px;overflow:auto;display:block;max-width:700px;color:rgb(51,=
51,51);font-family:Helvetica,arial,freesans,clean,sans-serif,&#39;Segoe UI =
Emoji&#39;,&#39;Segoe UI Symbol&#39;;font-size:16px;line-height:27.20000076=
2939453px">

<tbody><tr style=3D"border-top-width:1px;border-top-style:solid;border-top-=
color:rgb(204,204,204)"><th style=3D"padding:6px 13px;border:1px solid rgb(=
221,221,221)">Field Size</th><th style=3D"padding:6px 13px;border:1px solid=
 rgb(221,221,221)">

Description</th><th style=3D"padding:6px 13px;border:1px solid rgb(221,221,=
221)">Data type</th><th style=3D"padding:6px 13px;border:1px solid rgb(221,=
221,221)">Comments</th></tr><tr style=3D"border-top-width:1px;border-top-st=
yle:solid;border-top-color:rgb(204,204,204);background-color:rgb(248,248,24=
8)">

<td style=3D"padding:6px 13px;border:1px solid rgb(221,221,221)">4</td><td =
style=3D"padding:6px 13px;border:1px solid rgb(221,221,221)">tx version</td=
><td style=3D"padding:6px 13px;border:1px solid rgb(221,221,221)">uint32</t=
d>

<td style=3D"padding:6px 13px;border:1px solid rgb(221,221,221)">The versio=
n number of the transaction the UTXO was found in.</td></tr><tr style=3D"bo=
rder-top-width:1px;border-top-style:solid;border-top-color:rgb(204,204,204)=
">

<td style=3D"padding:6px 13px;border:1px solid rgb(221,221,221)">4</td><td =
style=3D"padding:6px 13px;border:1px solid rgb(221,221,221)">height</td><td=
 style=3D"padding:6px 13px;border:1px solid rgb(221,221,221)">uint256</td><=
td style=3D"padding:6px 13px;border:1px solid rgb(221,221,221)">

The height of the block containing the defining transaction, or 0x7FFFFFFF =
if the tx is in the mempool.</td></tr><tr style=3D"border-top-width:1px;bor=
der-top-style:solid;border-top-color:rgb(204,204,204);background-color:rgb(=
248,248,248)">

<td style=3D"padding:6px 13px;border:1px solid rgb(221,221,221)">?</td><td =
style=3D"padding:6px 13px;border:1px solid rgb(221,221,221)">output</td><td=
 style=3D"padding:6px 13px;border:1px solid rgb(221,221,221)">CTxOut</td><t=
d style=3D"padding:6px 13px;border:1px solid rgb(221,221,221)">

The output itself, serialized in the same way as in a tx message.</td></tr>=
</tbody></table><h2 style=3D"margin:15px auto;line-height:1.7;font-size:2em=
;padding:0px;border-bottom-width:1px;border-bottom-style:solid;border-botto=
m-color:rgb(238,238,238);max-width:700px;color:rgb(51,51,51);font-family:He=
lvetica,arial,freesans,clean,sans-serif,&#39;Segoe UI Emoji&#39;,&#39;Segoe=
 UI Symbol&#39;">

<a name=3D"14720ad957acd8bb_user-content-backward-compatibility" href=3D"ht=
tps://github.com/mikehearn/bips/commit/6058b92f5d9804ee4104649f53afc2fa5324=
8c81?short_path=3D35c7795#backward-compatibility" style=3D"color:rgb(65,131=
,196);text-decoration:none;display:block;padding-right:6px;padding-left:30p=
x;background:transparent" target=3D"_blank"></a><a name=3D"14720ad957acd8bb=
_user-content-Backward_compatibility" style=3D"color:rgb(65,131,196);backgr=
ound:transparent">Backward compatibility</a></h2>

<p style=3D"margin:15px auto;max-width:700px;color:rgb(51,51,51);font-famil=
y:Helvetica,arial,freesans,clean,sans-serif,&#39;Segoe UI Emoji&#39;,&#39;S=
egoe UI Symbol&#39;;font-size:16px;line-height:27.200000762939453px">Nodes =
indicate support by advertising a protocol version above 70003 and by setti=
ng a new NODE_GETUTXO flag in their nServices field, which has a value of 2=
 (1</p>

<h2 style=3D"margin:15px auto;line-height:1.7;font-size:2em;padding:0px;bor=
der-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(238,=
238,238);max-width:700px;color:rgb(51,51,51);font-family:Helvetica,arial,fr=
eesans,clean,sans-serif,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;"=
>

<a name=3D"14720ad957acd8bb_user-content-authentication" href=3D"https://gi=
thub.com/mikehearn/bips/commit/6058b92f5d9804ee4104649f53afc2fa53248c81?sho=
rt_path=3D35c7795#authentication" style=3D"color:rgb(65,131,196);text-decor=
ation:none;display:block;padding-right:6px;padding-left:30px;background:tra=
nsparent" target=3D"_blank"></a><a name=3D"14720ad957acd8bb_user-content-Au=
thentication" style=3D"color:rgb(65,131,196);background:transparent">Authen=
tication</a></h2>

<p style=3D"margin:15px auto;max-width:700px;color:rgb(51,51,51);font-famil=
y:Helvetica,arial,freesans,clean,sans-serif,&#39;Segoe UI Emoji&#39;,&#39;S=
egoe UI Symbol&#39;;font-size:16px;line-height:27.200000762939453px">The UT=
XO set is not currently authenticated by anything. There are proposals to r=
esolve this by introducing a new consensus rule that commits to a root hash=
 of the UTXO set in blocks, however this feature is not presently available=
 in the Bitcoin protocol. Once it is, the utxos message could be upgraded t=
o include Merkle branches showing inclusion of the UTXOs in the committed s=
ets.</p>

<p style=3D"margin:15px auto;max-width:700px;color:rgb(51,51,51);font-famil=
y:Helvetica,arial,freesans,clean,sans-serif,&#39;Segoe UI Emoji&#39;,&#39;S=
egoe UI Symbol&#39;;font-size:16px;line-height:27.200000762939453px">If the=
 requesting client is looking up outputs for a signed transaction that they=
 have locally, the client can partly verify the returned output by running =
the input scripts with it. Currently this verifies only that the script is =
correct. A future version of the Bitcoin protocol is likely to also allow t=
he value to be checked in this way. It does not show that the output is rea=
lly unspent or was ever actually created in the block chain however.</p>

<p style=3D"margin:15px auto;max-width:700px;color:rgb(51,51,51);font-famil=
y:Helvetica,arial,freesans,clean,sans-serif,&#39;Segoe UI Emoji&#39;,&#39;S=
egoe UI Symbol&#39;;font-size:16px;line-height:27.200000762939453px">If the=
 requesting client has a mapping of chain heights to block hashes in the be=
st chain e.g. obtained via getheaders, then they can obtain a proof that th=
e output did at one point exist by requesting the block and searching for t=
he output within it. When combined with Bloom filtering this can be reasona=
bly efficient.</p>

<p style=3D"margin:15px auto;max-width:700px;color:rgb(51,51,51);font-famil=
y:Helvetica,arial,freesans,clean,sans-serif,&#39;Segoe UI Emoji&#39;,&#39;S=
egoe UI Symbol&#39;;font-size:16px;line-height:27.200000762939453px">Note t=
hat even when the outputs are being checked against something this protocol=
 has the same security model as Bloom filtering: a remote node can lie thro=
ugh omission by claiming the requested UTXO does not exist / was already sp=
ent (they are the same, from the perspective of a full node). Querying mult=
iple nodes and combining their answers can be a partial solution to this, a=
lthough as nothing authenticates the Bitcoin P2P network a man in the middl=
e could still yield incorrect results.</p>

<h2 style=3D"margin:15px auto;line-height:1.7;font-size:2em;padding:0px;bor=
der-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(238,=
238,238);max-width:700px;color:rgb(51,51,51);font-family:Helvetica,arial,fr=
eesans,clean,sans-serif,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;"=
>

<a name=3D"14720ad957acd8bb_user-content-implementation" href=3D"https://gi=
thub.com/mikehearn/bips/commit/6058b92f5d9804ee4104649f53afc2fa53248c81?sho=
rt_path=3D35c7795#implementation" style=3D"color:rgb(65,131,196);text-decor=
ation:none;display:block;padding-right:6px;padding-left:30px;background:tra=
nsparent" target=3D"_blank"></a><a name=3D"14720ad957acd8bb_user-content-Im=
plementation" style=3D"color:rgb(65,131,196);background:transparent">Implem=
entation</a></h2>

<p style=3D"margin:15px auto;max-width:700px;color:rgb(51,51,51);font-famil=
y:Helvetica,arial,freesans,clean,sans-serif,&#39;Segoe UI Emoji&#39;,&#39;S=
egoe UI Symbol&#39;;font-size:16px;line-height:27.200000762939453px"><a hre=
f=3D"https://github.com/bitcoin/bitcoin/pull/4351/files" style=3D"color:rgb=
(65,131,196);text-decoration:none;background:transparent" target=3D"_blank"=
>https://github.com/bitcoin/bitcoin/pull/4351/files</a></p>

</div></div>
</blockquote></div><br></div>

--e89a8ff1ce12abf25804fdd7db7b--