Return-Path: Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id BE6AB919 for ; Wed, 8 Jun 2016 06:46:03 +0000 (UTC) X-Greylist: delayed 00:47:55 by SQLgrey-1.7.6 Received: from s37.web-hosting.com (s37.web-hosting.com [198.54.114.154]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 2F92CFC for ; Wed, 8 Jun 2016 06:46:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xbt.hk; s=default; h=Mime-Version:To:Message-Id:Date:Subject:Content-Type:From; bh=/BsI1pA5yfz9pKrge1FOoss6fXMfWxBZ20fIQyVrn+w=; b=TR4x3eIgCbOpUH3FAx7IThXmcP S0dDwBqkN8Ct19RDZWuckVzZFZzXu6igoPDN6Yte9DiJdgWm82wNAkig/bl79ySWB0yufX4fORLIp 3kc2s3sIQl9hknqNWmSUeQR46UT7teICKXFRifx1Vzvt5hE7oq2WLz+/bv6UzE8ViEWrTPTLhsOXC qKZBwp1YY/acdWJ//ep1STeazUukX7gEfMNVX+zHippTXIDELDLXjX48VwwmMe0IAQH7eZGmCwYWo gFFFKx4sIyx8aoxg+glkjlsX7DRDeysPseT450pm3LNX8Mgb/iK8Cu7TZ9Qv9cH1O2b+xRKQ4SSz+ BzSRvBfw==; Received: from [137.189.134.42] (port=55825 helo=[192.168.0.102]) by server37.web-hosting.com with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.86_1) (envelope-from ) id 1bAWVA-002kr8-6y for bitcoin-dev@lists.linuxfoundation.org; Wed, 08 Jun 2016 01:58:04 -0400 From: Johnson Lau X-Pgp-Agent: GPGMail 2.6b2 Content-Type: multipart/signed; boundary="Apple-Mail=_7D4E5349-F6FC-4123-BEAC-E2B9DC1E367A"; protocol="application/pgp-signature"; micalg=pgp-sha512 Date: Wed, 8 Jun 2016 13:57:36 +0800 Message-Id: To: bitcoin-dev Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) X-Mailer: Apple Mail (2.3124) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - server37.web-hosting.com X-AntiAbuse: Original Domain - lists.linuxfoundation.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - xbt.hk X-Get-Message-Sender-Via: server37.web-hosting.com: authenticated_id: jl2012@xbt.hk X-Authenticated-Sender: server37.web-hosting.com: jl2012@xbt.hk X-Source: X-Source-Args: X-Source-Dir: X-From-Rewrite: unmodified, already matched X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, T_DKIM_INVALID autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [bitcoin-dev] BIP141 segwit consensus rule update: extension of witness program definition 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: Wed, 08 Jun 2016 06:46:03 -0000 --Apple-Mail=_7D4E5349-F6FC-4123-BEAC-E2B9DC1E367A Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Please note that the segregated witness (BIP141) consensus rule is = updated. Originally, a witness program is a scriptPubKey or redeemScript = that consists of a 1-byte push opcode (OP_0 to OP_16) followed by a data = push between 2 and 32 bytes. The definition is now extended to 2 to 40 = bytes: = https://github.com/bitcoin/bips/commit/d1b52cb198066d4e515e8a50fc3928c5397= c3d9b = https://github.com/bitcoin/bitcoin/pull/7910/commits/14d4d1d23a3cbaa8a3051= d0da10ff7a536517ed0 Why? ---------- BIP141 defines only version 0 witness program: 20 bytes program for = P2WPKH and 32 bytes program for P2WSH. Versions 1 to 16 are not defined, = and are considered as anyone-can-spend scripts, reserved for future = extension (e.g. the proposed BIP114). BIP141 also requires that only a = witness program input may have witness data. Therefore, before this = update, an 1-byte push opcode followed by a 33 bytes data push was not = considered to be a witness program, and no witness data is allowed for = that. This may be over-restrictive for a future witness program softfork. When = 32-byte program is used, this leaves only 16 versions for upgrade, and = any =E2=80=9Csub-version=E2=80=9D metadata must be recorded in the = witness field. This may not be compatible with some novel hashing = functions we are exploring. By extending the maximum length by 8 bytes, it allows up to 16 * 2 ^ 64 = versions for future upgrades, which is enough for any foreseeable use. Why not make it even bigger, e.g. 75 bytes? ---------- A 40 bytes witness program allows a 32-byte hash with 8-byte metadata. = For any scripts that are larger than 32 bytes, they should be recorded = in the witness field, like P2WSH in BIP141, to reduce the transaction = cost and impact on UTXO set. Since SHA256 is already used everywhere, it = is very unlikely that we would require a larger witness program (e.g. = SHA512) without also a major revamp of the bitcoin protocol. In any case, since scripts with a 1-byte push followed by a push of >40 = bytes remain anyone-can-spend, we always have the option to redefine = them with a softfork. What are affected? ---------- As defined in BIP141, a version 0 witness program is valid only with 20 = bytes (P2WPKH) or 32 bytes (P2WSH). Before this update, an OP_0 followed = by a data push of 33-40 bytes was not a witness program and considered = as anyone-can-spend. Now, such a script will fail due to incorrect = witness program length. Before this update, no witness data was allowed for a script with a = 1-byte push followed by a data push of 33-40 bytes. This is now allowed. Actions to take: ---------- If you are running a segnet node, or a testnet node with segwit code, = please upgrade to the latest version at = https://github.com/bitcoin/bitcoin/pull/7910 If you have an alternative implementation, please make sure your = consensus code is updated accordingly, or your node may fork off the = network. --Apple-Mail=_7D4E5349-F6FC-4123-BEAC-E2B9DC1E367A Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQGcBAEBCgAGBQJXV7PoAAoJEO6eVSA0viTSk7cMALvB8iyirVL9YKCUDhvUzEqA 6fJQf6QcB8wKNB8lL97FDfCp8ojVQKN3ITq7G6JwuUSKM8RiP0LGZZBH1CU2yHn6 L8xWoo99eoixvIuNl9waUYZFnF/3Ng4V8c+7ezpDLKVflPulHYiggoZsFs6p0ZnT c2aJBTWhKKYUDZ4Xg+lerPfGIftRJGHCOUf6ZXStwweXpdNlC+TtDV8j0kDaa4Bl bC+EIUnCrC+Xb61G2nzTjiRFZ6kAAGM5c0p2Ig0GjiUQ/hpZjtEfqZHfiyjhIknI SG1r55WuBpRElqRsp9mJl3Y5QAAVlfIWTLJ8eHwzpsCNyyeXZlfflPv6G4B89MPO 7u7oB1udd5YoUMPePTqmz7H7esvtJB+TE8XMa1O3yAEd4IUxfaQtMBDfIBNTR4YX y0OA7cI+7L84mb9PWtSqCIyk6DGpp6xo/bSEtGfXmzN/ywPcP8xFNf3UrlZuVwZg c+aqMhcjAn4yPtSSr+LxCCztq8p78DHoiBsBgYyC3g== =v8dA -----END PGP SIGNATURE----- --Apple-Mail=_7D4E5349-F6FC-4123-BEAC-E2B9DC1E367A--