From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id BCE5AC0051 for ; Wed, 28 Oct 2020 00:20:56 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id A5BD72E15D for ; Wed, 28 Oct 2020 00:20:56 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id aoWNB9xRM13r for ; Wed, 28 Oct 2020 00:20:54 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail-40131.protonmail.ch (mail-40131.protonmail.ch [185.70.40.131]) by silver.osuosl.org (Postfix) with ESMTPS id 5F60E2E154 for ; Wed, 28 Oct 2020 00:20:54 +0000 (UTC) Date: Wed, 28 Oct 2020 00:20:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wuille.net; s=protonmail2; t=1603844450; bh=D59PP8wxo9FMOtd1OSARvAFMNHuGkh0FyScRX8vd+Tc=; h=Date:To:From:Reply-To:Subject:In-Reply-To:References:From; b=hAopcpi3eqC+5nNkKKG6L7Ts3LIb5X0bPlg6E97o7+Wp7A5PJnjgYJRJDYq9ZhF4N r/E2i0TU2c1jPGCPks0JJUtj+oSEbC25ftfSArgW5Ipb9WBtduWzzDQ2vIObpw0Wgl b5O6oWrQisFs8AehGDtgnEyukmRWNGRwTmiuNMIL2pxKwc3gTiF/nKu9M6V+Z2VQ5W VpqWRugeISPTQI1yIV/Gjo2/mmRWIwDS0OIHhkhd1LaXRl8MQVGsR30WrUCYLMUSgf VUgfspEE/fql5c+ZeuKJfx1w/32eQFohdEPob0pevVVW7V2gewMi6apCOI1uYQ0KUm yMx5az7N8StXw== To: Rusty Russell , Bitcoin Protocol Discussion From: Pieter Wuille Reply-To: Pieter Wuille Message-ID: In-Reply-To: <87imblmutl.fsf@rustcorp.com.au> References: <87imblmutl.fsf@rustcorp.com.au> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Mailman-Approved-At: Wed, 28 Oct 2020 00:42:20 +0000 Subject: Re: [bitcoin-dev] Progress on bech32 for future Segwit Versions (BIP-173) X-BeenThere: bitcoin-dev@lists.linuxfoundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Bitcoin Protocol Discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Oct 2020 00:20:56 -0000 On Wednesday, October 7, 2020 5:21 PM, Rusty Russell via bitcoin-dev wrote: > I propose an alternative to length restrictions suggested by > Russell in https://github.com/bitcoin/bips/pull/945: use the > https://gist.github.com/sipa/a9845b37c1b298a7301c33a04090b2eb variant, > unless the first byte is 0. Hi all, starting a slight side-thread here. The discussion here made me realize that as we're introducing (at some poin= t) a new checksum scheme, we don't just care about the new scheme's own err= or detection capabilities, but also about the probability that a new style = address + errors is incorrectly accepted as an old style address. Clearly these properties are less of a priority than just the new-style + e= rror being misinterpreted as a new-style address, as problems will only occ= ur when entering a new address with errors in old software that supports th= e old scheme (which this thread shows, is not very common). Still, all othe= r things being equal, it can't hurt to see if some choices are better than = others. https://gist.github.com/sipa/a9845b37c1b298a7301c33a04090b2eb suggested the= use of constant M =3D 0x3FFFFFFF. It turns out this is slightly suboptimal= in two ways: * It's possible to take a new-style address with that constant, make 3 subs= titution errors, and obtain an old-style address. * If a new-style address ends with '7', inserting 'g78u' just before it wil= l result in a valid old-style address (ignoring length constraints). I don't think either of these is serious, but it's possible to improve upon= them: * Guaranteeing that 4 substitution errors are always detected while switchi= ng schemes seems impossible, but a constant can be picked that guarantees 3= errors always are. * Insertion/deletion errors can be restricted to patterns that require 6 fi= xed characters (which, assuming uniformly random characters, implies a prob= ability of 2^-30). It seems M=3D0x3ffeffff has both these properties. I'm going to do some more analysis (swapping, and insertion/erasure near th= e start), and then update my gist, but so far it seems this is a strictly (= albeit only slightly) better choice. Cheers, -- Pieter