Return-Path: Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id F0134C1B; Tue, 1 Mar 2016 02:06:01 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 X-Greylist: domain 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 55DFF109; Tue, 1 Mar 2016 02:06:01 +0000 (UTC) Received: by ozlabs.org (Postfix, from userid 1011) id 277A4140BB2; Tue, 1 Mar 2016 13:05:58 +1100 (AEDT) From: Rusty Russell To: Joseph Poon , bitcoin-dev@lists.linuxfoundation.org In-Reply-To: <20160226010746.GB10295@lightning.network> References: <20160226010746.GB10295@lightning.network> User-Agent: Notmuch/0.20.2 (http://notmuchmail.org) Emacs/24.5.1 (x86_64-pc-linux-gnu) Date: Mon, 29 Feb 2016 10:55:53 +1030 Message-ID: <87oab0e50u.fsf@rustcorp.com.au> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00, DATE_IN_PAST_24_48, 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: lightning-dev@lists.linuxfoundation.org Subject: Re: [bitcoin-dev] SIGHASH_NOINPUT in Segregated Witness X-BeenThere: bitcoin-dev@lists.linuxfoundation.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Bitcoin Development Discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Mar 2016 02:06:02 -0000 Joseph Poon via bitcoin-dev writes: > Ideally, a 3rd-party can be handed a transaction which can encompass all > prior states in a compact way. For currently-designed Segregated Witness > transactions, this requires storing all previous signatures, which can > become very costly if individuals to thousands of channel state updates > per day. AFAICT we need more than this. Or are you using something other than the deployable lightning commit tx style? If each HTLC output is a p2sh[1], you need the timeout and rhash for each one to build the script to redeem it. In practice, there's not much difference between sending a watcher a tx for every commit tx and sending it information for every new HTLC (roughly a factor of 2). So we also need to put more in the scriptPubKey for this to work; either the entire redeemscript, or possibly some kind of multiple-choice P2SH where any one of the hashes will redeem the payment. Cheers, Rusty. [1] eg. from https://github.com/ElementsProject/lightning/blob/master/doc/deployable-lightning.pdf OP_HASH160 OP_DUP # Replace top element with two copies of its hash OP_EQUAL # Test if they supplied the HTLC R value OP_SWAP OP_EQUAL OP_ADD # Or the commitment revocation hash OP_IF # If any hash matched. # Pay to B. OP_ELSE # Must be A, after HTLC has timed out. OP_CHECKLOCKTIMEVERIFY Ensure (absolute) time has passed. OP_CHECKSEQUENCEVERIFY # Delay gives B enough time to use revocation if it has it. OP_2DROP # Drop the delay and htlc-timeout from the stack. # Pay to A. OP_ENDIF OP_CHECKSIG # Verify A or B's signature is correct. Cheers, Rusty.