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
|
Return-Path: <m@ib.tc>
Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org
[172.17.192.35])
by mail.linuxfoundation.org (Postfix) with ESMTPS id 55F9921F7
for <bitcoin-dev@lists.linuxfoundation.org>;
Fri, 19 Jul 2019 06:05:56 +0000 (UTC)
X-Greylist: whitelisted by SQLgrey-1.7.6
Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com
[209.85.221.50])
by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 28F1412E
for <bitcoin-dev@lists.linuxfoundation.org>;
Fri, 19 Jul 2019 06:05:54 +0000 (UTC)
Received: by mail-wr1-f50.google.com with SMTP id p17so30948507wrf.11
for <bitcoin-dev@lists.linuxfoundation.org>;
Thu, 18 Jul 2019 23:05:54 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ib.tc; s=google;
h=mime-version:from:date:message-id:subject:to;
bh=5b/fnZv9u8hWwytN7nE+plTI8m4ReHpaFuqOCjk1Fdo=;
b=fNAmJpLCdjXIEMLNuOBZ6at6lQx0lrF5SK2/XirovrhIYxzG/t/+87bhDxT2vjTKfB
daVK8C41z5jXC0e4MTuFl8wVKccJmar8t9zoyP+LGS4SMAciTd0qKoKVxFCP8pv7mUk/
XkElfgAMf5hO3BFBHWsK4cPS10QQHiXsjntNhFGDiab4JFpTC7+Di50q8XUOETgcy9/9
ICJ+0xWEa/8GJngdmSUirOajZR6uSX23wWTNCJhrUOMNxVIMEmG8YmCUAxztanQpLGdo
gqdZpkw6sBulK79NpU6Eu9rqrda4CrvMJV+gDNWavT7P5PUorHhoYsJc0Bw1Ept5bam/
jcfg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20161025;
h=x-gm-message-state:mime-version:from:date:message-id:subject:to;
bh=5b/fnZv9u8hWwytN7nE+plTI8m4ReHpaFuqOCjk1Fdo=;
b=FegtvFJBMsDdBMlEYLVTg+E7DJudecqkewecFMkvy3ikT241/RjKormAWmNa0Dcet7
VEgVTHvNZtbobdLxGcuNh6FiK/qO9icmbkObkPt+zNBZxHTKeO+z6C+kBcSf+0KvbtDL
lienep/AS6aDFacIYjSIaqMOrtbwot1usXBukvNzxKb9qLBPBmj9tB3Iim5xjJAOmqHM
sG/qilY77bK0RhNxPoAguZWdVFvXgHhglKiuuCIJwKlLMbTMrf/UIB3GU3kbjyBdiqZG
6g92CNYUKCasmvjoR1GaYLMVYIhB36tZCrkkfM2MwHuvc+BGIjcfd7MDbvpjdKDgEwqU
cslA==
X-Gm-Message-State: APjAAAV867J9Ms7KIXZ5nWgB3UE+fZBCSF3nTK75qV+nYKEb5DmqTtKO
X+c2dtOVczJfx5LplQYuSYBdCXbU0SeZziRAiB19pyuJHig=
X-Google-Smtp-Source: APXvYqy28hkfreZqyIAmUPMUoL24NSXtjKqUNaIK19hwBhi3Ggw4VMMJaBqyy4+yPaqqz8SrUEEOOJrn7MegcuanoWg=
X-Received: by 2002:adf:dfc4:: with SMTP id q4mr52786288wrn.54.1563516353480;
Thu, 18 Jul 2019 23:05:53 -0700 (PDT)
MIME-Version: 1.0
From: Mike Brooks <m@ib.tc>
Date: Thu, 18 Jul 2019 23:05:42 -0700
Message-ID: <CALFqKjQkQwuxjeYkGWO_Y_HhNQmJgrjqF3m04hbORV7FSbsi3Q@mail.gmail.com>
To: bitcoin-dev@lists.linuxfoundation.org
Content-Type: multipart/alternative; boundary="000000000000d99b6e058e02846c"
X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,
DKIM_VALID, DKIM_VALID_AU, HTML_MESSAGE,
RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on
smtp1.linux-foundation.org
X-Mailman-Approved-At: Fri, 19 Jul 2019 13:54:36 +0000
Subject: [bitcoin-dev] PubRef - Script OP Code For Public Data References
X-BeenThere: bitcoin-dev@lists.linuxfoundation.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: Bitcoin Protocol Discussion <bitcoin-dev.lists.linuxfoundation.org>
List-Unsubscribe: <https://lists.linuxfoundation.org/mailman/options/bitcoin-dev>,
<mailto:bitcoin-dev-request@lists.linuxfoundation.org?subject=unsubscribe>
List-Archive: <http://lists.linuxfoundation.org/pipermail/bitcoin-dev/>
List-Post: <mailto:bitcoin-dev@lists.linuxfoundation.org>
List-Help: <mailto:bitcoin-dev-request@lists.linuxfoundation.org?subject=help>
List-Subscribe: <https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev>,
<mailto:bitcoin-dev-request@lists.linuxfoundation.org?subject=subscribe>
X-List-Received-Date: Fri, 19 Jul 2019 06:05:56 -0000
--000000000000d99b6e058e02846c
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
I noticed that this Merkle tree we are building is made more expensive by
including repetitive data. So, this proposal draws inspiration from LZ78,
an algorithm which constructs a dictionary of repetitive strings which are
then referred to by their index. What if the blockchain already built a
dictionary for us, and now we just need to index it?
---
Abstract
This BIP describes how a new OP code can be used to construct smaller, more
compact transactions. With a public reference (PubRef), a newly created
transaction can reuse elements of a previously confirmed transaction by
representing this information with a smaller numeric offset or =E2=80=9Cpoi=
nter=E2=80=9D.
Motivation
Giving scripts the ability to refer to data on the blockchain will reduce
transaction sizes because key material does not have to be repeated in
every Script. Users of the network are rewarded with smaller transaction
sizes, and miners are able to fit more transactions into new blocks.
Pointers are a common feature and it felt like this was missing from
Bitcoin Script.
Specification
This BIP defines a new Script opcode that can be introduced with BIP-0141
(Segregated Witness (Consensus layer)). This new opcode is as follows:
Word
Opcode
Hex
Input
Output
Description
OP_PUBREF4
TBD
TBD
uint4
data
The next four bytes is an integer reference to a previously defined
PUSHDATA
Let there be an ordered list of all invocations of PUSHDATA (OP codes;
0x4c,0x4d,0x4e) across all scripts starting from the genesis block:
[t0,t2,...,tn]. With this list a newly created script can refer to a
specific PUSHDATA that was used in any previously confirmed block. The
values referenced by this list are immutable and uniform to all observers.
Lets assume there is some transaction containing a ScriptSig and
outputScript pair, here is what an input and an output script would look
like:
ScriptSig
PUSHDATA(72)[30450221008f906b9fe728cb17c81deccd6704f664ed1ac920223bb2eca918=
f066269c703302203b1c496fd4c3fa5071262b98447fbca5e3ed7a52efe3da26aa58f738bd3=
42d3101]
PUSHDATA
(65)[04bca69c59dc7a6d8ef4d3043bdcb626e9e29837b9beb143168938ae8165848bfc788d=
6ff4cdf1ef843e6a9ccda988b323d12a367dd758261dd27a63f18f56ce77]
outputScript
DUP HASH160 PUSHDATA(20)[dd6cce9f255a8cc17bda8ba0373df8e861cb866e]
EQUALVERIFY CHECKSIG
The ScriptSig of an input typically contains the full public key which is
~65 bytes. Outputs will typically contain a hash of the public key which is
20 bytes. Using PubRef, the public-key material shown above no longer need
to be repeated, instead the needed values can be resolved from previously
confirmed transaction. The signature of the input must still be unique,
however, the public key can be replaced with a call to PUBREF, as shown
below:
ScriptSig
PUSHDATA(72)[30450221008f906b9fe728cb17c81deccd6704f664ed1ac920223bb2eca918=
f066269c703302203b1c496fd4c3fa5071262b98447fbca5e3ed7a52efe3da26aa58f738bd3=
42d3101]
PUBREF[43123]
outputScript
DUP HASH160 PUBREF[12123] EQUALVERIFY CHECKSIG
The above call to PUBREF removed the need to include the full public-key,
or hash of the public key in a given transaction. This is only possible
because these values where used previously in a confirmed block. If for
example a user was sending Bitcoins to a newly formed address, then no
PUBREF can be created in this case - and a outputScript using PUSHDATA
would need to be used at least once. If a newly created wallet has never
been used on the Bitcoin network, then the full public-key will need to be
included in the ScriptSig. Once these transactions have been confirmed,
then these values will be indexed and any future script can refer to these
public-key values with a PUBREF operation.
PubRef is not susceptible to malleability attacks because the blockchain is
immutable. The PUSHDATA operation can store at most 520 bytes on the stack,
therefore a single PUBREF operation can never obtain more than 520 bytes.
In order for a client to make use of the PUBREF operations they=E2=80=99ll =
need
access to a database that look up public-keys and resolve their PUBREF
index. A value can be resolved to an index with a hash-table lookup in
O(1) constant time. Additionally, all instances of PUSHDATA can be indexed
as an ordered list, resolution of a PUBREF index to the intended value
would be an O(1) array lookup. Although the data needed to build and
resolve public references is already included with every full node,
additional computational effort is needed to build and maintain these
indices - a tradeoff which provides smaller transaction sizes and relieving
the need to store repetitive data on the blockchain.
--000000000000d99b6e058e02846c
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><p dir=3D"ltr" style=3D"line-height:1.38;margin-top:0pt;ma=
rgin-bottom:0pt"><span style=3D"font-size:11pt;font-family:Arial;color:rgb(=
0,0,0);background-color:transparent;font-variant-numeric:normal;font-varian=
t-east-asian:normal;vertical-align:baseline;white-space:pre-wrap">I noticed=
that this Merkle tree we are building is made more expensive by including =
repetitive data.=C2=A0 So, this proposal draws inspiration from LZ78, an al=
gorithm which constructs a dictionary of repetitive strings which are then =
referred to by their index. What if the blockchain already built a dictiona=
ry for us, and now we just need to index it?</span></p><br><p dir=3D"ltr" s=
tyle=3D"line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style=3D"f=
ont-size:11pt;font-family:Arial;color:rgb(0,0,0);background-color:transpare=
nt;font-variant-numeric:normal;font-variant-east-asian:normal;vertical-alig=
n:baseline;white-space:pre-wrap">---</span></p><br><p dir=3D"ltr" style=3D"=
line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style=3D"font-size=
:14pt;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-=
variant-numeric:normal;font-variant-east-asian:normal;vertical-align:baseli=
ne;white-space:pre-wrap">Abstract</span></p><p dir=3D"ltr" style=3D"line-he=
ight:1.38;margin-top:0pt;margin-bottom:0pt"><span style=3D"font-size:11pt;f=
ont-family:Arial;color:rgb(0,0,0);background-color:transparent;font-variant=
-numeric:normal;font-variant-east-asian:normal;vertical-align:baseline;whit=
e-space:pre-wrap">This BIP describes how a new OP code can be used to const=
ruct smaller, more compact transactions.=C2=A0 With a public reference (Pub=
Ref), a newly created transaction can reuse elements of a previously confir=
med transaction by representing this information with a smaller numeric off=
set or =E2=80=9Cpointer=E2=80=9D.</span></p><br><p dir=3D"ltr" style=3D"lin=
e-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style=3D"font-size:14=
pt;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-var=
iant-numeric:normal;font-variant-east-asian:normal;vertical-align:baseline;=
white-space:pre-wrap">Motivation</span></p><p dir=3D"ltr" style=3D"line-hei=
ght:1.38;margin-top:0pt;margin-bottom:0pt"><span style=3D"font-size:11pt;fo=
nt-family:Arial;color:rgb(0,0,0);background-color:transparent;font-variant-=
numeric:normal;font-variant-east-asian:normal;vertical-align:baseline;white=
-space:pre-wrap">Giving scripts the ability to refer to data on the blockch=
ain will reduce transaction sizes because key material does not have to be =
repeated in every Script. Users of the network are rewarded with smaller tr=
ansaction sizes, and miners are able to fit more transactions into new bloc=
ks.=C2=A0 Pointers are a common feature and it felt like this was missing f=
rom Bitcoin Script.</span></p><br><p dir=3D"ltr" style=3D"line-height:1.38;=
margin-top:0pt;margin-bottom:0pt"><span style=3D"font-size:14pt;font-family=
:Arial;color:rgb(0,0,0);background-color:transparent;font-variant-numeric:n=
ormal;font-variant-east-asian:normal;vertical-align:baseline;white-space:pr=
e-wrap">Specification</span></p><br><p dir=3D"ltr" style=3D"line-height:1.3=
8;margin-top:0pt;margin-bottom:0pt"><span style=3D"font-size:11pt;font-fami=
ly:Arial;color:rgb(0,0,0);background-color:transparent;font-variant-numeric=
:normal;font-variant-east-asian:normal;vertical-align:baseline;white-space:=
pre-wrap">This BIP defines a new Script opcode that can be introduced with =
BIP-0141 (Segregated Witness (Consensus layer)). This new opcode is as foll=
ows:</span></p><br><div dir=3D"ltr" style=3D"margin-left:0pt"><table style=
=3D"border:none;border-collapse:collapse"><colgroup><col width=3D"119"><col=
width=3D"65"><col width=3D"43"><col width=3D"47"><col width=3D"59"><col wi=
dth=3D"262"></colgroup><tbody><tr style=3D"height:15pt"><td style=3D"border=
-width:0.75pt;border-style:solid;border-color:rgb(162,169,177);vertical-ali=
gn:top;background-color:rgb(234,236,240);padding:2pt 4pt"><p dir=3D"ltr" st=
yle=3D"line-height:1.38;text-align:center;margin-top:11pt;margin-bottom:11p=
t"><span style=3D"font-size:10.5pt;font-family:Arial;background-color:trans=
parent;font-weight:700;font-variant-numeric:normal;font-variant-east-asian:=
normal;vertical-align:baseline;white-space:pre-wrap">Word</span></p></td><t=
d style=3D"border-width:0.75pt;border-style:solid;border-color:rgb(162,169,=
177);vertical-align:top;background-color:rgb(234,236,240);padding:2pt 4pt">=
<p dir=3D"ltr" style=3D"line-height:1.38;text-align:center;margin-top:11pt;=
margin-bottom:11pt"><span style=3D"font-size:10.5pt;font-family:Arial;backg=
round-color:transparent;font-weight:700;font-variant-numeric:normal;font-va=
riant-east-asian:normal;vertical-align:baseline;white-space:pre-wrap">Opcod=
e</span></p></td><td style=3D"border-width:0.75pt;border-style:solid;border=
-color:rgb(162,169,177);vertical-align:top;background-color:rgb(234,236,240=
);padding:2pt 4pt"><p dir=3D"ltr" style=3D"line-height:1.38;text-align:cent=
er;margin-top:11pt;margin-bottom:11pt"><span style=3D"font-size:10.5pt;font=
-family:Arial;background-color:transparent;font-weight:700;font-variant-num=
eric:normal;font-variant-east-asian:normal;vertical-align:baseline;white-sp=
ace:pre-wrap">Hex</span></p></td><td style=3D"border-width:0.75pt;border-st=
yle:solid;border-color:rgb(162,169,177);vertical-align:top;background-color=
:rgb(234,236,240);padding:2pt 4pt"><p dir=3D"ltr" style=3D"line-height:1.38=
;text-align:center;margin-top:11pt;margin-bottom:11pt"><span style=3D"font-=
size:10.5pt;font-family:Arial;background-color:transparent;font-weight:700;=
font-variant-numeric:normal;font-variant-east-asian:normal;vertical-align:b=
aseline;white-space:pre-wrap">Input</span></p></td><td style=3D"border-widt=
h:0.75pt;border-style:solid;border-color:rgb(162,169,177);vertical-align:to=
p;background-color:rgb(234,236,240);padding:2pt 4pt"><p dir=3D"ltr" style=
=3D"line-height:1.38;text-align:center;margin-top:11pt;margin-bottom:11pt">=
<span style=3D"font-size:10.5pt;font-family:Arial;background-color:transpar=
ent;font-weight:700;font-variant-numeric:normal;font-variant-east-asian:nor=
mal;vertical-align:baseline;white-space:pre-wrap">Output</span></p></td><td=
style=3D"border-width:0.75pt;border-style:solid;border-color:rgb(162,169,1=
77);vertical-align:top;background-color:rgb(234,236,240);padding:2pt 4pt"><=
p dir=3D"ltr" style=3D"line-height:1.38;text-align:center;margin-top:11pt;m=
argin-bottom:11pt"><span style=3D"font-size:10.5pt;font-family:Arial;backgr=
ound-color:transparent;font-weight:700;font-variant-numeric:normal;font-var=
iant-east-asian:normal;vertical-align:baseline;white-space:pre-wrap">Descri=
ption</span></p></td></tr><tr style=3D"height:15pt"><td style=3D"border-wid=
th:0.75pt;border-style:solid;border-color:rgb(162,169,177);vertical-align:t=
op;background-color:rgb(248,249,250);padding:2pt 4pt"><p dir=3D"ltr" style=
=3D"line-height:1.38;margin-top:11pt;margin-bottom:11pt"><span style=3D"fon=
t-size:10.5pt;font-family:Arial;background-color:transparent;font-variant-n=
umeric:normal;font-variant-east-asian:normal;vertical-align:baseline;white-=
space:pre-wrap">OP_PUBREF4</span></p></td><td style=3D"border-width:0.75pt;=
border-style:solid;border-color:rgb(162,169,177);vertical-align:top;backgro=
und-color:rgb(248,249,250);padding:2pt 4pt"><p dir=3D"ltr" style=3D"line-he=
ight:1.38;margin-top:11pt;margin-bottom:11pt"><span style=3D"font-size:10.5=
pt;font-family:Arial;background-color:transparent;font-variant-numeric:norm=
al;font-variant-east-asian:normal;vertical-align:baseline;white-space:pre-w=
rap">TBD</span></p></td><td style=3D"border-width:0.75pt;border-style:solid=
;border-color:rgb(162,169,177);vertical-align:top;background-color:rgb(248,=
249,250);padding:2pt 4pt"><p dir=3D"ltr" style=3D"line-height:1.38;margin-t=
op:11pt;margin-bottom:11pt"><span style=3D"font-size:10.5pt;font-family:Ari=
al;background-color:transparent;font-variant-numeric:normal;font-variant-ea=
st-asian:normal;vertical-align:baseline;white-space:pre-wrap">TBD</span></p=
></td><td style=3D"border-width:0.75pt;border-style:solid;border-color:rgb(=
162,169,177);vertical-align:top;background-color:rgb(248,249,250);padding:2=
pt 4pt"><p dir=3D"ltr" style=3D"line-height:1.38;margin-top:11pt;margin-bot=
tom:11pt"><span style=3D"font-size:10.5pt;font-family:Arial;background-colo=
r:transparent;font-variant-numeric:normal;font-variant-east-asian:normal;ve=
rtical-align:baseline;white-space:pre-wrap">uint4</span></p></td><td style=
=3D"border-width:0.75pt;border-style:solid;border-color:rgb(162,169,177);ve=
rtical-align:top;background-color:rgb(248,249,250);padding:2pt 4pt"><p dir=
=3D"ltr" style=3D"line-height:1.38;margin-top:11pt;margin-bottom:11pt"><spa=
n style=3D"font-size:10.5pt;font-family:Arial;background-color:transparent;=
font-variant-numeric:normal;font-variant-east-asian:normal;vertical-align:b=
aseline;white-space:pre-wrap">data</span></p></td><td style=3D"border-width=
:0.75pt;border-style:solid;border-color:rgb(162,169,177);vertical-align:top=
;background-color:rgb(248,249,250);padding:2pt 4pt"><p dir=3D"ltr" style=3D=
"line-height:1.38;margin-top:11pt;margin-bottom:11pt"><span style=3D"font-s=
ize:10.5pt;font-family:Arial;font-variant-numeric:normal;font-variant-east-=
asian:normal;vertical-align:baseline;white-space:pre-wrap">The next four by=
tes is an integer reference to a previously defined PUSHDATA=C2=A0</span></=
p></td></tr></tbody></table></div><br><p dir=3D"ltr" style=3D"line-height:1=
.38;margin-top:0pt;margin-bottom:0pt"><span style=3D"font-size:11pt;font-fa=
mily:Arial;color:rgb(0,0,0);background-color:transparent;font-variant-numer=
ic:normal;font-variant-east-asian:normal;vertical-align:baseline;white-spac=
e:pre-wrap">Let there be an ordered list of all invocations of PUSHDATA (OP=
codes; 0x4c,0x4d,0x4e) across all scripts starting from the genesis block:=
[t0,t2,...,tn]. =C2=A0 With this list a newly created script can refer to =
a specific PUSHDATA that was used in any previously confirmed block. The v=
alues referenced by this list are immutable and uniform to all observers.</=
span></p><br><p dir=3D"ltr" style=3D"line-height:1.38;margin-top:0pt;margin=
-bottom:0pt"><span style=3D"font-size:11pt;font-family:Arial;color:rgb(0,0,=
0);background-color:transparent;font-variant-numeric:normal;font-variant-ea=
st-asian:normal;vertical-align:baseline;white-space:pre-wrap">Lets assume t=
here is some transaction containing a ScriptSig and outputScript pair, here=
is what an input and an output script would look like:</span></p><br><p di=
r=3D"ltr" style=3D"line-height:1.38;margin-left:36pt;margin-top:0pt;margin-=
bottom:12pt"><span style=3D"font-size:11pt;font-family:Arial;color:rgb(0,0,=
0);background-color:transparent;font-variant-numeric:normal;font-variant-ea=
st-asian:normal;vertical-align:baseline;white-space:pre-wrap">ScriptSig</sp=
an></p><p dir=3D"ltr" style=3D"line-height:1.38;margin-left:36pt;margin-top=
:0pt;margin-bottom:12pt"><span style=3D"font-size:11pt;font-family:Arial;co=
lor:rgb(0,0,0);background-color:transparent;font-weight:700;font-variant-nu=
meric:normal;font-variant-east-asian:normal;vertical-align:baseline;white-s=
pace:pre-wrap">PUSHDATA</span><span style=3D"font-size:11pt;font-family:Ari=
al;color:rgb(0,0,0);background-color:transparent;font-variant-numeric:norma=
l;font-variant-east-asian:normal;vertical-align:baseline;white-space:pre-wr=
ap">(72)[30450221008f906b9fe728cb17c81deccd6704f664ed1ac920223bb2eca918f066=
269c703302203b1c496fd4c3fa5071262b98447fbca5e3ed7a52efe3da26aa58f738bd342d3=
101] </span><span style=3D"font-size:11pt;font-family:Arial;color:rgb(0,0,0=
);background-color:transparent;font-weight:700;font-variant-numeric:normal;=
font-variant-east-asian:normal;vertical-align:baseline;white-space:pre-wrap=
">PUSHDATA</span><span style=3D"font-size:11pt;font-family:Arial;color:rgb(=
0,0,0);background-color:transparent;font-variant-numeric:normal;font-varian=
t-east-asian:normal;vertical-align:baseline;white-space:pre-wrap">(65)[04bc=
a69c59dc7a6d8ef4d3043bdcb626e9e29837b9beb143168938ae8165848bfc788d6ff4cdf1e=
f843e6a9ccda988b323d12a367dd758261dd27a63f18f56ce77]</span></p><p dir=3D"lt=
r" style=3D"line-height:1.38;margin-left:36pt;margin-top:0pt;margin-bottom:=
12pt"><span style=3D"font-size:11pt;font-family:Arial;color:rgb(0,0,0);back=
ground-color:transparent;font-variant-numeric:normal;font-variant-east-asia=
n:normal;vertical-align:baseline;white-space:pre-wrap">outputScript</span><=
/p><p dir=3D"ltr" style=3D"line-height:1.38;margin-left:36pt;margin-top:0pt=
;margin-bottom:12pt"><span style=3D"font-size:11pt;font-family:Arial;color:=
rgb(0,0,0);background-color:transparent;font-variant-numeric:normal;font-va=
riant-east-asian:normal;vertical-align:baseline;white-space:pre-wrap">DUP H=
ASH160 </span><span style=3D"font-size:11pt;font-family:Arial;color:rgb(0,0=
,0);background-color:transparent;font-weight:700;font-variant-numeric:norma=
l;font-variant-east-asian:normal;vertical-align:baseline;white-space:pre-wr=
ap">PUSHDATA</span><span style=3D"font-size:11pt;font-family:Arial;color:rg=
b(0,0,0);background-color:transparent;font-variant-numeric:normal;font-vari=
ant-east-asian:normal;vertical-align:baseline;white-space:pre-wrap">(20)[dd=
6cce9f255a8cc17bda8ba0373df8e861cb866e] EQUALVERIFY CHECKSIG</span></p><p d=
ir=3D"ltr" style=3D"line-height:1.38;margin-top:0pt;margin-bottom:12pt"><sp=
an style=3D"font-size:11pt;font-family:Arial;color:rgb(0,0,0);background-co=
lor:transparent;font-variant-numeric:normal;font-variant-east-asian:normal;=
vertical-align:baseline;white-space:pre-wrap">The ScriptSig of an input typ=
ically contains the full public key which is ~65 bytes. Outputs will typica=
lly contain a hash of the public key which is 20 bytes.=C2=A0 Using PubRef,=
the public-key material shown above no longer need to be repeated, instead=
the needed values can be resolved from previously confirmed transaction. =
=C2=A0 The signature of the input must still be unique, however, the public=
key can be replaced with a call to PUBREF, as shown below:</span></p><p di=
r=3D"ltr" style=3D"line-height:1.38;margin-left:36pt;margin-top:0pt;margin-=
bottom:12pt"><span style=3D"font-size:11pt;font-family:Arial;color:rgb(0,0,=
0);background-color:transparent;font-variant-numeric:normal;font-variant-ea=
st-asian:normal;vertical-align:baseline;white-space:pre-wrap">ScriptSig</sp=
an></p><p dir=3D"ltr" style=3D"line-height:1.38;margin-left:36pt;margin-top=
:0pt;margin-bottom:12pt"><span style=3D"font-size:11pt;font-family:Arial;co=
lor:rgb(0,0,0);background-color:transparent;font-weight:700;font-variant-nu=
meric:normal;font-variant-east-asian:normal;vertical-align:baseline;white-s=
pace:pre-wrap">PUSHDATA</span><span style=3D"font-size:11pt;font-family:Ari=
al;color:rgb(0,0,0);background-color:transparent;font-variant-numeric:norma=
l;font-variant-east-asian:normal;vertical-align:baseline;white-space:pre-wr=
ap">(72)[30450221008f906b9fe728cb17c81deccd6704f664ed1ac920223bb2eca918f066=
269c703302203b1c496fd4c3fa5071262b98447fbca5e3ed7a52efe3da26aa58f738bd342d3=
101] </span><span style=3D"font-size:11pt;font-family:Arial;color:rgb(0,0,0=
);background-color:transparent;font-weight:700;font-variant-numeric:normal;=
font-variant-east-asian:normal;vertical-align:baseline;white-space:pre-wrap=
">PUBREF</span><span style=3D"font-size:11pt;font-family:Arial;color:rgb(0,=
0,0);background-color:transparent;font-variant-numeric:normal;font-variant-=
east-asian:normal;vertical-align:baseline;white-space:pre-wrap">[43123]</sp=
an></p><p dir=3D"ltr" style=3D"line-height:1.38;margin-left:36pt;margin-top=
:0pt;margin-bottom:12pt"><span style=3D"font-size:11pt;font-family:Arial;co=
lor:rgb(0,0,0);background-color:transparent;font-variant-numeric:normal;fon=
t-variant-east-asian:normal;vertical-align:baseline;white-space:pre-wrap">o=
utputScript</span></p><p dir=3D"ltr" style=3D"line-height:1.38;margin-left:=
36pt;margin-top:0pt;margin-bottom:12pt"><span style=3D"font-size:11pt;font-=
family:Arial;color:rgb(0,0,0);background-color:transparent;font-variant-num=
eric:normal;font-variant-east-asian:normal;vertical-align:baseline;white-sp=
ace:pre-wrap">DUP HASH160 </span><span style=3D"font-size:11pt;font-family:=
Arial;color:rgb(0,0,0);background-color:transparent;font-weight:700;font-va=
riant-numeric:normal;font-variant-east-asian:normal;vertical-align:baseline=
;white-space:pre-wrap">PUBREF</span><span style=3D"font-size:11pt;font-fami=
ly:Arial;color:rgb(0,0,0);background-color:transparent;font-variant-numeric=
:normal;font-variant-east-asian:normal;vertical-align:baseline;white-space:=
pre-wrap">[12123] EQUALVERIFY CHECKSIG</span></p><p dir=3D"ltr" style=3D"li=
ne-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style=3D"font-size:1=
1pt;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-va=
riant-numeric:normal;font-variant-east-asian:normal;vertical-align:baseline=
;white-space:pre-wrap">The above call to PUBREF removed the need to include=
the full public-key, or hash of the public key in a given transaction.=C2=
=A0 This is only possible because these values where used previously in a c=
onfirmed block. If for example a user was sending Bitcoins to a newly form=
ed address, then no PUBREF can be created in this case - and a outputScript=
using PUSHDATA would need to be used at least once.=C2=A0 If a newly creat=
ed wallet has never been used on the Bitcoin network, then the full public-=
key will need to be included in the ScriptSig. Once these transactions hav=
e been confirmed, then these values will be indexed and any future script c=
an refer to these public-key values with a PUBREF operation.</span></p><br>=
<p dir=3D"ltr" style=3D"line-height:1.38;margin-top:0pt;margin-bottom:0pt">=
<span style=3D"font-size:11pt;font-family:Arial;color:rgb(0,0,0);background=
-color:transparent;font-variant-numeric:normal;font-variant-east-asian:norm=
al;vertical-align:baseline;white-space:pre-wrap">PubRef is not susceptible =
to malleability attacks because the blockchain is immutable. The PUSHDATA o=
peration can store at most 520 bytes on the stack, therefore a single PUBRE=
F operation can never obtain more than 520 bytes.</span></p><br><p dir=3D"l=
tr" style=3D"line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style=
=3D"font-size:11pt;font-family:Arial;color:rgb(0,0,0);background-color:tran=
sparent;font-variant-numeric:normal;font-variant-east-asian:normal;vertical=
-align:baseline;white-space:pre-wrap">In order for a client to make use of =
the PUBREF operations they=E2=80=99ll need access to a database that look u=
p public-keys and resolve their PUBREF index.=C2=A0 A value can be resolved=
to an index with a hash-table lookup in O(1) constant time. Additionally,=
all instances of PUSHDATA can be indexed as an ordered list, resolution of=
a PUBREF index to the intended value would be an O(1) array lookup.=C2=A0 =
Although the data needed to build and resolve public references is already =
included with every full node, additional computational effort is needed to=
build and maintain these indices - a tradeoff which provides smaller trans=
action sizes and relieving the need to store repetitive data on the blockch=
ain.</span></p></div>
--000000000000d99b6e058e02846c--
|