summaryrefslogtreecommitdiff
path: root/27/9062e2d94a88763ed9154185d237f0540d8d28
blob: 220bc8ced950cce21f4720b53d7d44938a8b9130 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
Return-Path: <nickodell@gmail.com>
Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org
	[172.17.192.35])
	by mail.linuxfoundation.org (Postfix) with ESMTPS id 76BD88CC
	for <bitcoin-dev@lists.linuxfoundation.org>;
	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 <bitcoin-dev@lists.linuxfoundation.org>;
	Fri,  6 Nov 2015 09:22:27 +0000 (UTC)
Received: by ykek133 with SMTP id k133so177829550yke.2
	for <bitcoin-dev@lists.linuxfoundation.org>;
	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: <CANN4kmdq5zWDtKMQK5ov5SyRYZL4vZ5htn_POTUeCJhmJaBbhw@mail.gmail.com>
From: Nick ODell <nickodell@gmail.com>
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 <bitcoin-dev.lists.linuxfoundation.org>
List-Unsubscribe: <https://lists.linuxfoundation.org/mailman/options/bitcoin-dev>,
	<mailto:bitcoin-dev-request@lists.linuxfoundation.org?subject=unsubscribe>
List-Archive: <http://lists.linuxfoundation.org/pipermail/bitcoin-dev/>
List-Post: <mailto:bitcoin-dev@lists.linuxfoundation.org>
List-Help: <mailto:bitcoin-dev-request@lists.linuxfoundation.org?subject=help>
List-Subscribe: <https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev>,
	<mailto:bitcoin-dev-request@lists.linuxfoundation.org?subject=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
<bitcoin-dev@lists.linuxfoundation.org> 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 <jl2012@xbt.hk>
>   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