Return-Path: Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 76BD88CC for ; Fri, 6 Nov 2015 09:22:28 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-yk0-f179.google.com (mail-yk0-f179.google.com [209.85.160.179]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id E32E111F for ; Fri, 6 Nov 2015 09:22:27 +0000 (UTC) Received: by ykek133 with SMTP id k133so177829550yke.2 for ; Fri, 06 Nov 2015 01:22:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=jyL8tF6UaHczldOk99Qd9+DUqbgOpncdLUp83B9IY4k=; b=PhkZNDI+1Z0A+2HCuI9NuDgvSvu+NCwzQCDbKaLxZROmXQt8onjN4kAj3mwivkbPG8 ykTBWGAAW/Ll9w9ktstadORCVpiqUqkS0ttQqgC8v9tr202REzPYT4fBXWCIJvd87Za3 5CYyKV689HAM/JJ+K9LM0jeDYN2pSOrKLykfIpLdz3FXsPBH6aJ2udYAdj639IYNwkjL 4gPK41agj3GKFe/OQACdaQbxC74KN82eU/eMnhgXvT5F054fd2QE462gMUe28pMW+F+x Ql7LOKcyWeB0HzDPIJE0C4ajh+F1Y83f65MeWRQfTamLHB/zCBZdALqyB7cfq7PQSvmC 8CMg== MIME-Version: 1.0 X-Received: by 10.13.202.141 with SMTP id m135mr10052964ywd.305.1446801747164; Fri, 06 Nov 2015 01:22:27 -0800 (PST) Received: by 10.13.201.2 with HTTP; Fri, 6 Nov 2015 01:22:27 -0800 (PST) In-Reply-To: <0e72b173ea8e8aaf6b1b678182fa1ea7@xbt.hk> References: <0e72b173ea8e8aaf6b1b678182fa1ea7@xbt.hk> Date: Fri, 6 Nov 2015 02:22:27 -0700 Message-ID: From: Nick ODell To: jl2012@xbt.hk, bitcoin-dev@lists.linuxfoundation.org Content-Type: text/plain; charset=UTF-8 X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW 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: Fri, 06 Nov 2015 11:11:58 +0000 Subject: Re: [bitcoin-dev] Dealing with OP_IF and OP_NOTIF malleability 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: Fri, 06 Nov 2015 09:22:28 -0000 Your suggested modification seems sound. Though, a script author could do something similar right now by prefacing his IF with this: OP_DUP OP_DUP OP_0 OP_EQUAL OP_SWAP OP_1 OP_EQUAL OP_BOOLOR OP_NOTIF OP_RETURN OP_ENDIF [actual OP_IF goes here] That checks whether the input is 0 or 1, and runs OP_RETURN if not. Your way is cleaner, though. On Fri, Nov 6, 2015 at 1:13 AM, jl2012 via bitcoin-dev wrote: > I have a new BIP draft for fixing OP_IF and OP_NOTIF malleability. Please > comment: > https://github.com/jl2012/bips/blob/master/opifmalleability.mediawiki > > Copied below: > > BIP: x > Title: Dealing with OP_IF and OP_NOTIF malleability > Author: jl2012 > Status: Draft > Type: Standards Track > Created: 2015-11-06 > > Abstract > > As an supplement to BIP62, this document specifies proposed changes to the > Bitcoin transaction validity rules in order to make malleability of > transactions with OP_IF and OP_NOTIF impossible. > > Motivation > > OP_IF and OP_NOTIF are flow control codes in the Bitcoin script system. The > programme flow is decided by whether the top stake value is 0 or not. > However, this behavior opens a source of malleability as a third party may > alter a non-zero flow control value to any other non-zero value without > invalidating the transaction. > > As of November 2015, OP_IF and OP_NOTIF are not commonly used in the > blockchain. However, as more sophisticated functions such as > OP_CHECKLOCKTIMEVERITY are being introduced, OP_IF and OP_NOTIF will become > more popular and the related malleability should be fixed. This proposal > serves as a supplement to BIP62 and should be implemented with other > malleability fixes together. > > Specification > > If the transaction version is 3 or above, the flow control value for OP_IF > and OP_NOTIF must be either 0 or 1, or the transaction fails. > > This is to be implemented with BIP62. > > Compatibility > > This is a softfork. To ensure OP_IF and OP_NOTIF transactions created before > the introduction of this BIP will still be accpeted by the network, the new > rules only apply to transactions of version 3 or above. > > For people who want to preserve the original behaviour of OP_IF and > OP_NOTIF, an OP_0NOTEQUAL could be used before the flow control code to > transform any non-zero value to 1. > > Reference > > BIP62: https://github.com/bitcoin/bips/blob/master/bip-0062.mediawiki > > _______________________________________________ > bitcoin-dev mailing list > bitcoin-dev@lists.linuxfoundation.org > https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev