summaryrefslogtreecommitdiff
path: root/97/58618760be7d3c1205afecfabaf1835cfb66fc
blob: 2d52ae5e7ba4f190eee65976d3d166966d2584a7 (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
Return-Path: <bitcoin-dev@wuille.net>
Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])
 by lists.linuxfoundation.org (Postfix) with ESMTP id BCE5AC0051
 for <bitcoin-dev@lists.linuxfoundation.org>;
 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 <bitcoin-dev@lists.linuxfoundation.org>;
 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 <bitcoin-dev@lists.linuxfoundation.org>;
 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 <bitcoin-dev@lists.linuxfoundation.org>;
 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 <rusty@rustcorp.com.au>,
 Bitcoin Protocol Discussion <bitcoin-dev@lists.linuxfoundation.org>
From: Pieter Wuille <bitcoin-dev@wuille.net>
Reply-To: Pieter Wuille <bitcoin-dev@wuille.net>
Message-ID: <p6i6YqXjOBastpss12gNUcJGGqomgPiLXOIyob71VptqVwJwcFwrd4m8Mad4RDnAhSyFXAZqsD67fW0kS3NayQ6k6dB-h2_V7vl7RBxmvvA=@wuille.net>
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 <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: Wed, 28 Oct 2020 00:20:56 -0000

On Wednesday, October 7, 2020 5:21 PM, Rusty Russell via bitcoin-dev <bitco=
in-dev@lists.linuxfoundation.org> 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