Return-Path: Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 393CBC016F for ; Mon, 11 May 2020 22:12:44 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 2EBB288392 for ; Mon, 11 May 2020 22:12:44 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 8DmdtgD0dyPp for ; Mon, 11 May 2020 22:12:42 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail1.protonmail.ch (mail1.protonmail.ch [185.70.40.18]) by whitealder.osuosl.org (Postfix) with ESMTPS id C2FE088337 for ; Mon, 11 May 2020 22:12:42 +0000 (UTC) Date: Mon, 11 May 2020 22:12:33 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wuille.net; s=protonmail; t=1589235160; bh=bzyaghEMjwQRMDQ+x7faJaPuKeJHxWIyEmPupmnhVBQ=; h=Date:To:From:Reply-To:Subject:In-Reply-To:References:From; b=oMcMZ58rWaZyFC7Mxf68nw851OSM9ZC3kFahu80BNAP/wbWJr68EydSvMHiB0Noze aIQjtwE29HOJeERG6ku/ii4sdNM4dqkhttsp4BSlHO/G6GrX+px1/OkWR66Q4pbTxT WBXpY6rE/eGvMTShqHBDgCTatT8jWDRIXk/Fw9fg= To: Bitcoin Protocol Discussion From: Pieter Wuille Reply-To: Pieter Wuille Message-ID: In-Reply-To: <1a8f1b92-e965-c1b3-b554-600541c8bac9@gmail.com> References: <1a8f1b92-e965-c1b3-b554-600541c8bac9@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Mailman-Approved-At: Mon, 11 May 2020 22:51:22 +0000 Subject: Re: [bitcoin-dev] BIP-341: Committing to all scriptPubKeys in the signature message X-BeenThere: bitcoin-dev@lists.linuxfoundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Bitcoin Protocol Discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 May 2020 22:12:44 -0000 Hi all, On Tuesday, May 5, 2020 3:20 AM, Jonas Nick via bitcoin-dev wrote: > This is a reasonable suggestion. Committing to every spent scriptPubKey a= nd > therefore every element of the TxOut instead of just the amount makes sen= se > conceptually. And it would be a small diff (~4 lines + rationale) compare= d to > the current bip-taproot version. I agree. There have been several steps so far towards making it possible for signers= to determine whether they can safely sign with just O(1) information per i= nput. This was initially attempted in BIP141 (by committing to spent input,= to thwart the ability to lie about fees to ofline signers), and is improve= d in the current BIP341. I think the CoinJoin + offline signer model indeed shows that is still inco= mplete, as it is yet another example where a signer may need to be provided= with the entire creating transaction, which would be very unfortunate. It's also counter to the model proposed by BIP147 (PSBT) workflows: the ass= umption is effectively already that it is sufficient to provide signers wit= h just amount + scriptPubKey of the spent outputs. It feels very natural th= at signatures then indeed also need to commit to all that data; otherwise t= here should be ways that this information can be undetectably wrong. AJ's approach seems great. It means not increasing the per-signature hashin= g, while retaining the ability to cache information across BIP141/BIP341. As for coinbaseness and height: these are indeed also things currently kept= track of in the UTXO set, but I don't think any signer is using this infor= mation to determine whether to sign or not (which I think is the minimum re= quirement for it to be included in a signature hash, see above). Signing he= ight would cripple the ability to spend unconfirmed outputs, or force signe= rs to reveal they're doing so (if done through a separate sighash flag) - b= oth of which would be undesirable. That leaves coinbaseness, but I think th= e utility is very low. The only downside is that this potentially slows down review, but I agree w= ith earlier comments that it's hard to see how this would hurt. I also thin= k it's important to get these things right from the start. Many things insi= de BIP341/BIP342 are extensible with future softforks, but signature hashes= for key-path spends is not one of them (the set of potential signature has= h semantics must be committed to directly by the output, so changing them r= equires a new output type - which would be highly unfortunate for fungibili= ty reasons). Thus, unless there are objections, I'd like to go through with this and mak= e the suggested changes. Thoughts? -- Pieter