Return-Path: Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id EAEEF40F for ; Tue, 23 May 2017 04:58:02 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from ozlabs.org (ozlabs.org [103.22.144.67]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 1725917C for ; Tue, 23 May 2017 04:58:01 +0000 (UTC) Received: by ozlabs.org (Postfix, from userid 1011) id 3wX3F40B3Rz9sP4; Tue, 23 May 2017 14:57:59 +1000 (AEST) From: Rusty Russell To: Gregory Maxwell , Pieter Wuille In-Reply-To: References: <20170516110104.GA5564@fedora-23-dvm> Date: Tue, 23 May 2017 14:17:48 +0930 Message-ID: <8760gs2n7v.fsf@rustcorp.com.au> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Bitcoin Dev Subject: Re: [bitcoin-dev] Rolling UTXO set hashes X-BeenThere: bitcoin-dev@lists.linuxfoundation.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Bitcoin Protocol Discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 May 2017 04:58:03 -0000 Gregory Maxwell via bitcoin-dev writes: > On Tue, May 16, 2017 at 6:17 PM, Pieter Wuille wrote: >> just the first - and one that has very low costs and no normative >> datastructures at all. > > The serialization of the txout itself is normative, but very minimal. I do prefer the (2) approach, BTW, as it reuses existing primitives, but I know "simpler" means a different thing to mathier brains :) Since it wasn't explicit in the proposal, I think the txout information placed in the hash here is worth discussing. I prefer a simple txid||outnumber[1], because it allows simple validation without knowing the UTXO set itself; even a lightweight node can assert that UTXOhash for block N+1 is valid if the UTXOhash for block N is valid (and vice versa!) given block N+1. And miners can't really use that even if they were to try not validating against UTXO (!) because they need to know input amounts for fees (which are becoming significant). If I want to hand you the complete validatable UTXO set, I need to hand you all the txs with any unspent output, and some bitfield to indicate which ones are unspent. OTOH, if you serialize more (eg. ...||amount||scriptPubKey ?), then the UTXO set size needed to validate the utxohash is a little smaller: you need to send the txid, but not the tx nVersion, nLocktime or inputs. But in a SegWit world, that's actually *bigger* AFAICT. Thanks, Rusty. [1] I think you could actually use txid^outnumber, and if that's not a curve point SHA256() again, etc. But I don't think that saves any real time, and may cause other issues.