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
|
Return-Path: <jonasdnick@gmail.com>
Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org
[172.17.192.35])
by mail.linuxfoundation.org (Postfix) with ESMTPS id 52CDF10AA
for <bitcoin-dev@lists.linuxfoundation.org>;
Wed, 26 Sep 2018 20:37:52 +0000 (UTC)
X-Greylist: whitelisted by SQLgrey-1.7.6
Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com
[209.85.221.44])
by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 9D6DF762
for <bitcoin-dev@lists.linuxfoundation.org>;
Wed, 26 Sep 2018 20:37:51 +0000 (UTC)
Received: by mail-wr1-f44.google.com with SMTP id s14-v6so278571wrw.6
for <bitcoin-dev@lists.linuxfoundation.org>;
Wed, 26 Sep 2018 13:37:51 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
h=from:subject:to:cc:references:openpgp:autocrypt:message-id:date
:user-agent:mime-version:in-reply-to:content-language
:content-transfer-encoding;
bh=F0PsBQtQBsUq8UBnY5BrSefoKsMmf2PIU/iSiC6xsxw=;
b=pFfebHREbzL/J+3M+uBxyTsqGfNhIfFi+ik78YINbGP7Ptc239PIKaxVmR3IFnjmPT
1wxpbbHuiJZamWfVdxLeycSMqnLhSWCjGRr3DsmxgnxCKI6JkqQBQOv4EiRv7jJr/66z
63xlSNvuh9fcvfgYPoaOd/vgsZg4GJJkTwZvVUQeHqLsBJgDr15lE0l33C7xHoOR6lKi
F3foQV4J2vP/ZtChqWDeCcN+qmsD79oz1Yyv/6gpTlwerjHtUhIS3JLBw8MD1hQ6sRlI
B2p3ObpVaVUHZJM6xg/DigTyfwEzWocvqKFSyst2+8y1nyv09cTnASwUnv9VWanuV345
jt0A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20161025;
h=x-gm-message-state:from:subject:to:cc:references:openpgp:autocrypt
:message-id:date:user-agent:mime-version:in-reply-to
:content-language:content-transfer-encoding;
bh=F0PsBQtQBsUq8UBnY5BrSefoKsMmf2PIU/iSiC6xsxw=;
b=EpCZNgF3nYlZFv+ZE2pQa+q2LyFIeLAXrlCjId7WCZ6anO+Q6uPlt+fpl9vbH9of5a
LhDH08LgUGjQpqZqSeXe8LWb9zbTJHUL138uA6+/fqn664NafjkYnoOVyeejg9VesK7y
zmv+kTRXKA5idPDl+EATbQQA959QnzxPKMA8Ce/7TcQmi539ntrCnumWVtaIqfZuEt4o
BHZctFsXd2MR0u4JNX3/ZS0ER2mOeNrQBzjbOOWb+kkmtk2QVnRlhak+uQ+mAX5B17mO
NfJxFlYOuEcVoc0xNkp0VB4ZOUA0rRc1Ok3D/qCJC9rmrlIySULIFvqeqS2OSHuj+Ydj
JW3A==
X-Gm-Message-State: ABuFfojJS4J33H2oizpG2SQq4doAJP8GbfDO6cF+/FJzyRnNQpLVEClu
9nzV30wWCNuWAY0HWoh0/AY=
X-Google-Smtp-Source: ACcGV63t+JwihgyPrRGNJYzu2GvyC8aISHjaxxzphKX5UNi6Cdq9cd9y0C+EaPDRfOoQbF9eJw5tjg==
X-Received: by 2002:a5d:5342:: with SMTP id
t2-v6mr6576474wrv.257.1537994269828;
Wed, 26 Sep 2018 13:37:49 -0700 (PDT)
Received: from [192.168.1.21] (194-166-164-159.adsl.highway.telekom.at.
[194.166.164.159]) by smtp.googlemail.com with ESMTPSA id
124-v6sm620489wmk.20.2018.09.26.13.37.45
(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
Wed, 26 Sep 2018 13:37:46 -0700 (PDT)
From: Jonas Nick <jonasdnick@gmail.com>
X-Google-Original-From: Jonas Nick <jonasd.nick@gmail.com>
To: Johnson Lau <jl2012@xbt.hk>, Jonas Nick <jonasdnick@gmail.com>,
bitcoin-dev <bitcoin-dev@lists.linuxfoundation.org>
References: <871sewirni.fsf@gmail.com>
<CAMZUoK=V9Dii7ja6n6mpW_tWt00PuT=-9Z8XoyKOY3y0_AwK5w@mail.gmail.com>
<feff454d-2cc2-2104-5c6c-69630506bd56@gmail.com>
<D3D0114C-0D5C-4EE4-AD48-B046551BAAD4@xbt.hk>
Openpgp: preference=signencrypt
Autocrypt: addr=jonasd.nick@gmail.com; prefer-encrypt=mutual; keydata=
xsFNBFQ2o3oBEACv5N5WajlYk+i/4B8FmniipCB4biIKg38spMNt1EYM6RzTu+hbOrVOlJW8
fq/ih+dvlpreGxRPQlX4jr75kwoJCykd3geywTUl3KPLeJ/JRQJ8fVkine4Wr5qB5Jwo3+wt
inDVooaaF32Y0HolNacXVzT1x9uwn83Bz/ifg+iGATn/e1Si3ga/ytY5wYDzFz6aUDRW8ulu
DcG8ARMAgtzmi66EuyQyIWwSyoWFU8wJ98slU9LKuTu23r6HdxFuV+P2H1omJm+z8cd4QBMj
I23uHst0Wx1MyTeVhZCnQAghyasA3oopwzqRf5wwECAui1oZhr59R4R1DHJjn0PeWZXBSnOo
XPQ1ERjz4nQrODiIDEabD5DClPHZ1bte0tswm1aYBtD8/me9ck+SJdoH5r0DJrXCTtNl1XG1
9TTUINQe0eaQUOTakZmVaneCeSrw/pKOknkzudOCNCbmngKa2oJQOynrdsBuoigIYY+NQdot
fk1nJljrBzyTh4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GGYX1
eMUVXwoi8EQeofLM7wmOQikXlDbVR0a3+kKj/g6yKsBFvRbtSx73DeLg2Zp4EodoUnF/0W3V
JqZCWeI794kfk6NFvKKn1GLfxdyj82wiqzzCNFnYe6H4l78kGCZ7E0yg0u0M0kCjtDfBlxHJ
r1FDbWf3e4yX76QwxsQwR5yiY9mpWWo6Z6XFDT2Jz6HQX7y9oJhV/cLyAMzVz3Y7BSLm9tX5
/pX1TjOC7jsEBBPYFk1XyLQ+Ip6ZT0TZx7nXNoF08GhTXFLLx7tSNzx1IE+Go0FXcA0vmYUy
Ex981QeJInExpznDYCvx7pHU1PzImXcSLzWzqR8Anw==
Message-ID: <7bb51255-bfe5-8f11-55ae-ddabebe76941@gmail.com>
Date: Wed, 26 Sep 2018 20:40:02 +0000
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101
Thunderbird/60.0
MIME-Version: 1.0
In-Reply-To: <D3D0114C-0D5C-4EE4-AD48-B046551BAAD4@xbt.hk>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US-large
Content-Transfer-Encoding: 7bit
X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,
DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM,
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: Wed, 26 Sep 2018 20:40:12 +0000
Subject: Re: [bitcoin-dev] BIP sighash_noinput
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: Wed, 26 Sep 2018 20:37:52 -0000
Oh, I missed that that's still the case with NOINPUT - thanks for pointing it
out. In that case there's no reason to sign the other inputs' sequence and
that's even better because the current NOINPUT proposal already enables
taprootifiability of eltoo unilateral closings.
On 9/26/18 7:45 PM, Johnson Lau wrote:
> In BIP143, the nSequence of the same input is always signed, with any hashtype. Why do you need to sign the sequence of other inputs?
>
>> On 26 Sep 2018, at 5:36 PM, Jonas Nick via bitcoin-dev <bitcoin-dev@lists.linuxfoundation.org> wrote:
>>
>>> At the risk of bikeshedding, shouldn't NOINPUT also zero out the
>>> hashSequence so that its behaviour is consistent with ANYONECANPAY?
>>
>> There is a good reason for not doing that. If NOINPUT would sign the
>> hashSequence then it would be possible to get rid of OP_CSV in eltoo update
>> scripts. As a result update scripts could be taprootified because the more
>> common branch (settlement) would be just a 2-of-2 multisig. Applying taproot
>> would then make unilateral settlement look like a single pubkey spend and avoid
>> having to reveal the unexecuted (update) branch.
>>
>> Eltoo update transaction outputs consist of two branches, update and
>> settlement, where the update branch can be spend by a more recent update
>> transaction if an obsolete update transaction ends up spending the funding
>> output. The settlement branch is a 2-of-2 multisig with a relative timelock
>> using OP_CSV. Removing OP_CSV is possible because both parties signature is
>> required to spend the update transaction. They will only sign if the input has
>> the right sequence numbers which is sufficient to enforce the timeout (BIP68) -
>> assuming they are covered by the signature.
>>
>> There's a catch: hashSequence includes the sequence numbers of all transaction
>> inputs. That's not a problem for eltoo because settlement transactions only
>> have one input. The update mechanism with update transactions relies on being
>> able to bump the fee by unilaterally adding inputs and and change outputs to
>> the transaction. That's also not a problem because update spends do not use
>> relative timelocks and they are signed with SINGLE. So whenever NOINPUT is
>> combined SINGLE the hashSequence should be zeroed. This is in fact what a
>> minimal change to the current NOINPUT implementation would naturally do (see
>> below). However, that's error-prone when using NOINPUT in other contexts so in
>> general it would be better if NOINPUT would only sign the sequence number of
>> the corresponding input.
>>
>> Another downside of this approach is that you can never rebind to an output
>> with an OP_CSV that requires a larger sequence number, unless you also sign
>> with SIGHASH_SINGLE. It's difficult to imagine application where this would be
>> an issue.
>>
>> This is the modification to the NOINPUT implementation
>> (https://github.com/cdecker/bitcoin/commits/noinput) which makes eltoo
>> unilateral closes taprootifiable:
>> +++ b/src/script/interpreter.cpp
>> @@ -1223,7 +1223,7 @@ uint256 SignatureHash(const CScript& scriptCode, const CTransaction& txTo, unsig
>> hashPrevouts = cacheready ? cache->hashPrevouts : GetPrevoutHash(txTo);
>> }
>>
>> - if (!(nHashType & SIGHASH_ANYONECANPAY) && (nHashType & 0x1f) != SIGHASH_SINGLE && (nHashType & 0x1f) != SIGHASH_NONE && !noinput) {
>> + if (!(nHashType & SIGHASH_ANYONECANPAY) && (nHashType & 0x1f) != SIGHASH_SINGLE && (nHashType & 0x1f) != SIGHASH_NONE) {
>> hashSequence = cacheready ? cache->hashSequence : GetSequenceHash(txTo);
>> }
>>
>> On 5/1/18 4:58 PM, Russell O'Connor via bitcoin-dev wrote:
>>> At the risk of bikeshedding, shouldn't NOINPUT also zero out the
>>> hashSequence so that its behaviour is consistent with ANYONECANPAY?
>>>
>>
>
>
|