summaryrefslogtreecommitdiff
path: root/6f/2d5e64eaff21a6520fd7ec34afe1921ca6cc0f
blob: 4c5a1ddd4ef9d91b7187a060f68bfaaed30385e4 (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
Return-Path: <mats@blockchain.com>
Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org
	[172.17.192.35])
	by mail.linuxfoundation.org (Postfix) with ESMTPS id CD537ACC
	for <bitcoin-dev@lists.linuxfoundation.org>;
	Tue, 14 Nov 2017 13:50:02 +0000 (UTC)
X-Greylist: whitelisted by SQLgrey-1.7.6
Received: from mail-wr0-f194.google.com (mail-wr0-f194.google.com
	[209.85.128.194])
	by smtp1.linuxfoundation.org (Postfix) with ESMTPS id C82401CE
	for <bitcoin-dev@lists.linuxfoundation.org>;
	Tue, 14 Nov 2017 13:50:01 +0000 (UTC)
Received: by mail-wr0-f194.google.com with SMTP id q66so17527677wrb.13
	for <bitcoin-dev@lists.linuxfoundation.org>;
	Tue, 14 Nov 2017 05:50:01 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=blockchain.com; s=google;
	h=from:message-id:mime-version:subject:date:in-reply-to:cc:to
	:references; bh=4RqnIaP8GMYGtmhAZDRAcd51fZH92X9Dh1vjtErt4fM=;
	b=EH1wyl8PI+8QUQ7wLB3+ZJa+skI3l+J9Mg5aaE3TK+dmMHVWvCXlgUv0PBht4jJZoM
	8x7HnER1SVz3T6cCX6rodfNvnHpKagvZQRT4tKf2GGXhn30OO02VohPg7FM0y69Lbj5C
	kADiRdJoUvx5Lu0JuGANVdAHoCVpB3bKZQcAw=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20161025;
	h=x-gm-message-state:from:message-id:mime-version:subject:date
	:in-reply-to:cc:to:references;
	bh=4RqnIaP8GMYGtmhAZDRAcd51fZH92X9Dh1vjtErt4fM=;
	b=SbrIXVO6MblLIQ3I1zsHjkIS7+MceB6HEFnRXb6mabO+m/5MfPYEX/eYMUwgfPpdui
	eQsYhLXDCR9kwykKrFTmgLcAEzHChfjKe6jdouUCdZ9EwIMlMQjyL3Vu/9Lo21hSghS5
	TtS4BGmh+QWLMXGoVXQrF6tqC2RTPl0bJ1VVCMrUzmCv/I8J63oNxUK6xc4nlmk6pHN0
	lfXdm8B+TVzvjoXei861hVwjkX7CLGOwxVew6Jn+1mQWEdDL6s/Szxwqk1MJvZv5u/PC
	eEk4kZr5GiyQr4zkxTmzulx4vMDyqAKNmpJH9LRhfjK2pxkTDA4AGwe/sPR2ydao1GeR
	xDEw==
X-Gm-Message-State: AJaThX6ZA3vrf9l6t0BjKcNTO7l9HyrElCGU0UlLVChVUqVkIU4KW1dE
	lW8dxMIRaXCK0ITEbMxH2dJK+Q==
X-Google-Smtp-Source: AGs4zMbzObYTFMt2dLn9kZDLCjOrY4zwmKIlgFq4cDrHJLPQxr5KOHJAlJ9YfYoFImvcfnlXoVr7qA==
X-Received: by 10.223.184.171 with SMTP id i40mr11204527wrf.124.1510667400416; 
	Tue, 14 Nov 2017 05:50:00 -0800 (PST)
Received: from [192.168.2.105] (p5089FF1E.dip0.t-ipconnect.de. [80.137.255.30])
	by smtp.gmail.com with ESMTPSA id
	80sm13529409wmk.14.2017.11.14.05.49.57
	(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
	Tue, 14 Nov 2017 05:49:58 -0800 (PST)
From: Mats Jerratsch <mats@blockchain.com>
Message-Id: <71A64D11-DE57-4AA2-A635-F2AA4DC04909@blockchain.com>
Content-Type: multipart/signed;
	boundary="Apple-Mail=_514CAD64-72A6-44B0-A168-59C192AEA883";
	protocol="application/pgp-signature"; micalg=pgp-sha512
Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\))
Date: Tue, 14 Nov 2017 13:49:56 +0000
In-Reply-To: <CA+Cf5AZT6KtRXmt3X6UiF0tP_hCtbUiUsS3XMXDdoaa0T1tepQ@mail.gmail.com>
To: Spartacus Rex <spartacusrex99@gmail.com>
References: <7601C2CD-8544-4501-80CE-CAEB402A72D2@blockchain.com>
	<CAAUaCyii2U5VBLS+Va+F3h4Hka0OWDnFFmjtsvyaaD4TKVzV3Q@mail.gmail.com>
	<CAAUaCyiZ0bmWZLZc-yDvVHupzbdRR=Kdq4P8VkWqpU1L3G-u3A@mail.gmail.com>
	<C9A47922-5777-44AC-871A-6C27A22054AC@blockchain.com>
	<CAAUaCyjVxJbPrbBUdb9irK5CNnuqUSnzSjywpozhLqONcb_m_w@mail.gmail.com>
	<45C2D68B-BA8E-47DE-BFA5-643922395B2A@sprovoost.nl>
	<CAAUaCygeOxAK=EpzfWndx6uVvVO9B+=YTs1m-jHa3BFp82jA4w@mail.gmail.com>
	<95ECB451-56AE-45E5-AAE6-10058C4B7FD7@sprovoost.nl>
	<CAAUaCyg_PGT0F=RHfX89T54j-vuyz5wcbXaYoikJv95WKgsNPg@mail.gmail.com>
	<55467A01-A8B2-4E73-8331-38C0A7CD90EF@sprovoost.nl>
	<CAAUaCyhncyCt_ao9i0=33LswDOkCf6o-+36zrGxKWD+WranmZw@mail.gmail.com>
	<46E317DF-C97C-4797-B989-594298BC6030@sprovoost.nl>
	<CAAUaCyibOEHqw1J5O8yEp8v=j8t9sovn2vn=S8bZPZCzCY-gRw@mail.gmail.com>
	<3FBEE883-A15E-425C-8BF1-F7792FA63961@blockchain.com>
	<CAAUaCyg70uUnUp1Q0a6kEoQ1Js68VFLgthyfwyMQaaEqO8R-UQ@mail.gmail.com>
	<24A6C651-272B-4452-8A81-31651D9A2694@blockchain.com>
	<CAAUaCygjVDuqmVPS-1thnEbKgKYM9LW-7CsuAAnn7vqntMnWxA@mail.gmail.com>
	<CA+Cf5AZT6KtRXmt3X6UiF0tP_hCtbUiUsS3XMXDdoaa0T1tepQ@mail.gmail.com>
X-Mailer: Apple Mail (2.3273)
X-Spam-Status: No, score=0.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
	DKIM_VALID_AU,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM
	autolearn=disabled version=3.3.1
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on
	smtp1.linux-foundation.org
X-Mailman-Approved-At: Wed, 15 Nov 2017 02:42:03 +0000
Cc: Bitcoin Protocol Discussion <bitcoin-dev@lists.linuxfoundation.org>
Subject: Re: [bitcoin-dev] Generalised Replay Protection for Future Hard
	Forks
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: Tue, 14 Nov 2017 13:50:02 -0000


--Apple-Mail=_514CAD64-72A6-44B0-A168-59C192AEA883
Content-Type: multipart/alternative;
	boundary="Apple-Mail=_F62ED146-51B9-4DD2-B93A-84D0D8AFA743"


--Apple-Mail=_F62ED146-51B9-4DD2-B93A-84D0D8AFA743
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=us-ascii


> But I like the 'old' idea of putting the hash of a block that MUST be =
on the chain that this txn can eventually be added to. If the hash is =
not a valid block on the chain, the txn can't be added.
>=20
> It means you can choose exactly which forks you want to allow your txn =
on, pre-fork for both, post-fork for only one, and gets round the issue =
of who gets to decide the nForkid value.. since you don't need one. =
Also, all the old outputs work fine, and LN not an issue.
>=20
> I'm missing why this scheme would be better ?

I do agree that solutions like `SIGHASH_BLOCKCOMMIT` are superior in the =
sense that they are very difficult to circumvent. However, a fork could =
also follow the original chain in SPV mode and allow transactions =
protected with these mechanism. Since it's fundamentally impossible to =
disallow transactions in future projects, the goal shouldn't be to make =
this overly complicated.

Furthermore, this schema is not just adding replay protection. It makes =
transacting safer overall (due to a dedicated address format per fork) =
and allows light clients to differentiate between multiple forks. In the =
past three months, at least $600k has been lost by users sending BCH to =
a BTC address [1].

> Thanks for the clarification.  How would a tx specify a constraint =
like "nForkId>=3D1"?  I was thinking of it just as a number set on the =
tx.

Whether the transaction is replay protected or not is specified by =
setting a bit in the `SigHashId`. If this bit is set, then the signature =
*preimage* MUST have `nForkId` appended. `nForkId` is not part of the =
final transaction, someone who wants to verify the transaction must know =
which `nForkId` it was created with.

If the bit isn't set, it means `nForkId=3D0`, which allows other forks =
to validate the signature.

> Also note that since forks form a partial order, but IDs (numbers) =
form a total order, ">=3D" will miss some cases.  Eg, suppose BCH had =
forked with nForkId 2, and then you set up a LN funding tx on BCH with =
nForkId>=3D2, and then Segwit2x forked (from BTC!) with nForkId 3.  The =
BCH funding tx would be valid on Segwit2x.  This is more of a =
fundamental problem than a bug - to avoid it you'd have to get into =
stuff like making each fork reference its parent-fork's first block or =
something, someone has written about this...

Sorry, I was careless with the use of `>=3D` there. You are correct, =
forks form a tree. For this proposal, every leaf must be assigned a =
unique `nForkId`. The relationship between `nForkId` is irrelevant (e.g. =
which number is bigger), as long as they are unique. Transactions are =
only valid IFF `nForkId` matches exactly the `nForkId` of the software =
validating it. As described above, the transaction doesn't even contain =
`nForkId`, and the node surely is not starting to guess which one it =
could be.

[1]
https://twitter.com/khannib/status/930223617744437253 =
<https://twitter.com/khannib/status/930223617744437253>

--Apple-Mail=_F62ED146-51B9-4DD2-B93A-84D0D8AFA743
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=us-ascii

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html =
charset=3Dus-ascii"></head><body style=3D"word-wrap: break-word; =
-webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" =
class=3D""><div><br class=3D""><blockquote type=3D"cite" class=3D""><div =
class=3D""><div dir=3D"auto" class=3D""><div dir=3D"auto" class=3D"">But =
I like the 'old' idea of putting the hash of a block that MUST be on the =
chain that this txn can eventually be added to. If the hash is not a =
valid block on the chain, the txn can't be added.<br class=3D""></div><div=
 dir=3D"auto" class=3D""><br class=3D""></div><div dir=3D"auto" =
class=3D"">It means you can choose exactly which forks you want to allow =
your txn on, pre-fork for both, post-fork for only one, and gets round =
the issue of who gets to decide the nForkid value.. since you don't need =
one. Also, all the old outputs work fine, and LN not an issue.</div><div =
dir=3D"auto" class=3D""><br class=3D""></div><div dir=3D"auto" =
class=3D"">I'm missing why this scheme would be better ?<br =
class=3D""></div></div></div></blockquote><div><br class=3D""></div><div>I=
 do agree that solutions like `SIGHASH_BLOCKCOMMIT` are superior in the =
sense that they are very difficult to circumvent. However, a fork could =
also follow the original chain in SPV mode and allow transactions =
protected with these mechanism. Since it's fundamentally impossible to =
disallow transactions in future projects, the goal shouldn't be to make =
this overly complicated.&nbsp;</div><div><br =
class=3D""></div><div>Furthermore, this schema is not just adding replay =
protection. It makes transacting safer overall (due to a dedicated =
address format per fork) and allows light clients to differentiate =
between multiple forks. In the past three months, at least $600k has =
been lost by users sending BCH to a BTC address [1].</div><div><br =
class=3D""></div><blockquote type=3D"cite" class=3D""><div =
class=3D"gmail_extra"><div class=3D"gmail_quote"><blockquote =
class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc =
solid;padding-left:1ex"><div dir=3D"ltr" class=3D"">Thanks for the =
clarification.&nbsp; How would a tx specify a constraint like =
"nForkId&gt;=3D1"?&nbsp; I was thinking of it just as a number set on =
the tx.</div></blockquote></div></div></blockquote><div><br =
class=3D""></div><div>Whether the transaction is replay protected or not =
is specified by setting a bit in the `SigHashId`. If this bit is set, =
then the signature *preimage* MUST have `nForkId` appended. `nForkId` is =
not part of the final transaction, someone who wants to verify the =
transaction must know which `nForkId` it was created =
with.&nbsp;</div><div><br class=3D""></div><div>If the bit isn't set, it =
means `nForkId=3D0`, which allows other forks to validate the =
signature.</div><div><br class=3D""></div><blockquote type=3D"cite" =
class=3D""><div class=3D"gmail_extra"><div =
class=3D"gmail_quote"><blockquote class=3D"gmail_quote" style=3D"margin:0 =
0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr" =
class=3D""><div class=3D"">Also note that since forks form a partial =
order, but IDs (numbers) form a total order, "&gt;=3D" will miss some =
cases.&nbsp; Eg, suppose BCH had forked with nForkId 2, and then you set =
up a LN funding tx on BCH with nForkId&gt;=3D2, and then Segwit2x forked =
(from BTC!) with nForkId 3.&nbsp; The BCH funding tx would be valid on =
Segwit2x.&nbsp; This is more of a fundamental problem than a bug - to =
avoid it you'd have to get into stuff like making each fork reference =
its parent-fork's first block or something, someone has written about =
this...<br =
class=3D""></div></div></blockquote></div></div></blockquote><div><br =
class=3D""></div><div>Sorry, I was careless with the use of `&gt;=3D` =
there. You are correct, forks form a tree. For this proposal, every leaf =
must be assigned a unique `nForkId`. The relationship between `nForkId` =
is irrelevant (e.g. which number is bigger), as long as they are unique. =
Transactions are only valid IFF `nForkId` matches exactly the `nForkId` =
of the software validating it. As described above, the transaction =
doesn't even contain `nForkId`, and the node surely is not starting to =
guess which one it could be.&nbsp;</div></div><br class=3D""><div =
class=3D"">[1]</div><div class=3D""><a =
href=3D"https://twitter.com/khannib/status/930223617744437253" =
class=3D"">https://twitter.com/khannib/status/930223617744437253</a></div>=
</body></html>=

--Apple-Mail=_F62ED146-51B9-4DD2-B93A-84D0D8AFA743--

--Apple-Mail=_514CAD64-72A6-44B0-A168-59C192AEA883
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename=signature.asc
Content-Type: application/pgp-signature;
	name=signature.asc
Content-Description: Message signed with OpenPGP

-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - https://gpgtools.org

iQIcBAEBCgAGBQJaCvSEAAoJEAYZmwZ/PsbKsO0P/R0Dm6NqaHqFqt9YMAg3wdRL
OpAta3qPp7smJ8xqKgrzIFHxnobQWYPPTNt4pN3FlPnaA5zxGbjcR2tNRm/OmSRM
2/vuJHcNfM4v2fbxLpCqfniqxynmlEKW6vxzQYJppS8rHURJ+/H6yMsbm9TSNgpW
IjIz8OuaSopk+bpvcB6iI64qMemd6UAKNnad5w1oQsZALok+DLe10VkGnenl08/L
CfcPhaEyBBPqpr8m66xxc7W/UtPWeg5+SMTC5XDw90f5ahG5LJ0ibJYszATrgNXG
Gz9oooNghAXVM7wMBYRlR9ZV6aTacFc/dZ/gdTqrhqtQ1e17bFU2qmRNMnuvUPl9
yuU0FF6Panc1e8LUs3/tBxsUK4z7l5YKya/KFlVzzipfZyALyvZSi99qxfPbMlgs
sL2wZiFgpTN6M5Byqo1Du6DlFNxjpcrp/s4u3iTdQWFzjZnZ/zHKfobeQqkVt8/g
TEpHm3B8bL+tNPIDzPLbQuN6uoakbUFvSd4MM736uQJClNZHZix/UCNGik3LJRdu
JagdAqyxLRyiAH+wxaZAQ2GooAn2mIiN50pWOPo/28WWl0QFRgshioSyRUrp2nyc
vcPPI8Fr/L83VxwI+1/d6o8H0rcVhnDQAs8EiUEU2ftfFkQ1ML8zctAdb2Q/Iq9Y
f6gYJfas37RS5IGOIX/r
=No9i
-----END PGP SIGNATURE-----

--Apple-Mail=_514CAD64-72A6-44B0-A168-59C192AEA883--