Received: from sog-mx-4.v43.ch3.sourceforge.com ([172.29.43.194] helo=mx.sourceforge.net) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1Z4c9N-0008BQ-HF for bitcoin-development@lists.sourceforge.net; Mon, 15 Jun 2015 21:42:37 +0000 Received-SPF: pass (sog-mx-4.v43.ch3.sourceforge.com: domain of ozlabs.org designates 103.22.144.67 as permitted sender) client-ip=103.22.144.67; envelope-from=rusty@ozlabs.org; helo=ozlabs.org; Received: from ozlabs.org ([103.22.144.67]) by sog-mx-4.v43.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) id 1Z4c9L-0004rX-FX for bitcoin-development@lists.sourceforge.net; Mon, 15 Jun 2015 21:42:37 +0000 Received: by ozlabs.org (Postfix, from userid 1011) id 916E8140284; Tue, 16 Jun 2015 07:42:27 +1000 (AEST) From: Rusty Russell To: Mark Friedenbach , Gregory Maxwell In-Reply-To: References: <87k2vhfnx9.fsf@rustcorp.com.au> <87r3pdembs.fsf@rustcorp.com.au> User-Agent: Notmuch/0.17 (http://notmuchmail.org) Emacs/24.4.1 (x86_64-pc-linux-gnu) Date: Tue, 16 Jun 2015 06:31:04 +0930 Message-ID: <87eglcelf3.fsf@rustcorp.com.au> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.0 (--) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.5 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain X-Headers-End: 1Z4c9L-0004rX-FX Cc: Bitcoin Dev Subject: Re: [Bitcoin-development] [RFC] Canonical input and output ordering in transactions X-BeenThere: bitcoin-development@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Jun 2015 21:42:37 -0000 Mark Friedenbach writes: > There's another important use case which you mentioned Greg, that also > requires special exemption: compact commitments via mid-state compression. > > The use case is an OP_RETURN output sorted last, whose last N bytes are a > commitment of some kind. A proof of the commitment can then use mid state > compression to elide the beginning of the transaction. > > How do you make a special exemption for this category of outputs? I can't > think of a very clean way of doing so that doesn't require an ugly > advertising of sort-order exemptions. Yes, we can suit any one use case, but not all of them. For example, outputs shall be sorted by: 1. First byte (or 0 if script is zero length) minus 107. 2. The remainder of the script in lexographical order. This would put OP_RETURN outputs last. Though Peter Todd's more general best-effort language might make more sense. It's not like you can hide an OP_RETURN transaction to make it look like something else, so that transaction not going to be distinguished by non-canonical ordering. Cheers, Rusty.