summaryrefslogtreecommitdiff
path: root/b7/2be980642f6921a39b3c3614d08125711505ee
blob: 4e76a79b19f9bc3a254815ef2c5e2dccaaa5dcb3 (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
129
130
131
132
133
134
135
136
137
138
139
140
Received: from sog-mx-2.v43.ch3.sourceforge.com ([172.29.43.192]
	helo=mx.sourceforge.net)
	by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.76)
	(envelope-from <thomasv1@gmx.de>) id 1WTBrF-0002sw-6m
	for bitcoin-development@lists.sourceforge.net;
	Thu, 27 Mar 2014 15:04:41 +0000
Received-SPF: pass (sog-mx-2.v43.ch3.sourceforge.com: domain of gmx.de
	designates 212.227.17.21 as permitted sender)
	client-ip=212.227.17.21; envelope-from=thomasv1@gmx.de;
	helo=mout.gmx.net; 
Received: from mout.gmx.net ([212.227.17.21])
	by sog-mx-2.v43.ch3.sourceforge.com with esmtps (TLSv1:AES128-SHA:128)
	(Exim 4.76) id 1WTBrD-0000po-03
	for bitcoin-development@lists.sourceforge.net;
	Thu, 27 Mar 2014 15:04:41 +0000
Received: from [192.168.1.27] ([84.101.32.222]) by mail.gmx.com (mrgmx003)
	with ESMTPSA (Nemesis) id 0MLujU-1WPrPY2Ym4-007jy6 for
	<bitcoin-development@lists.sourceforge.net>;
	Thu, 27 Mar 2014 16:04:32 +0100
Message-ID: <53343DFF.2070406@gmx.de>
Date: Thu, 27 Mar 2014 16:04:31 +0100
From: Thomas Voegtlin <thomasv1@gmx.de>
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
	rv:24.0) Gecko/20100101 Thunderbird/24.4.0
MIME-Version: 1.0
CC: Bitcoin Development <bitcoin-development@lists.sourceforge.net>
References: <CANEZrP2hbBVGqytmXR1rAcVama4ONnR586Se-Ch=dsxOzy2O4w@mail.gmail.com>
	<53340999.807@gmx.de>
	<CAJna-HhmFya+3W67qQt0wMhW=B4vJvwdkr-5WnU+KEaKq7uaUA@mail.gmail.com>
	<5334144A.9040600@gmx.de>
	<CAJna-HitjJbL9TnfxTY=+TvfaeNvZM6aPWmNYmHUCwmw6V8PUg@mail.gmail.com>
In-Reply-To: <CAJna-HitjJbL9TnfxTY=+TvfaeNvZM6aPWmNYmHUCwmw6V8PUg@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Provags-ID: V03:K0:STfMNyoQqkuGhPmaofNasvPUtuOW60nxtkeuqtBtlGi5/b80ehg
	Kk/WN6cKM7sgZdK3SCD5YoOOVjF+3OkxPaYa46Si4D/VjB34MWUql0mxeE5ZX/3mNCLmcNc
	dmEO0UqMomizoCN4qymFFFWrQg0SakpTGbMNhbLxVsJP3Lw4jBj5keVaiLcvkC0tkM+iJev
	eBUmFxpw9X+0empA+Xz/Q==
X-Spam-Score: -0.0 (/)
X-Spam-Report: Spam Filtering performed by mx.sourceforge.net.
	See http://spamassassin.org/tag/ for more details.
	-0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/,
	no trust [212.227.17.21 listed in list.dnswl.org]
	-1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for
	sender-domain
	0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider
	(thomasv1[at]gmx.de)
	-0.0 SPF_PASS               SPF: sender matches SPF record
	0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in
	digit (thomasv1[at]gmx.de)
	1.2 MISSING_HEADERS        Missing To: header
X-Headers-End: 1WTBrD-0000po-03
Subject: Re: [Bitcoin-development] New BIP32 structure
X-BeenThere: bitcoin-development@lists.sourceforge.net
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: <bitcoin-development.lists.sourceforge.net>
List-Unsubscribe: <https://lists.sourceforge.net/lists/listinfo/bitcoin-development>,
	<mailto:bitcoin-development-request@lists.sourceforge.net?subject=unsubscribe>
List-Archive: <http://sourceforge.net/mailarchive/forum.php?forum_name=bitcoin-development>
List-Post: <mailto:bitcoin-development@lists.sourceforge.net>
List-Help: <mailto:bitcoin-development-request@lists.sourceforge.net?subject=help>
List-Subscribe: <https://lists.sourceforge.net/lists/listinfo/bitcoin-development>,
	<mailto:bitcoin-development-request@lists.sourceforge.net?subject=subscribe>
X-List-Received-Date: Thu, 27 Mar 2014 15:04:41 -0000

>
>     Related to this, here is another idea I would like to submit:
>
>     Instead of using a "gap limit" (maximal number of consecutive unused
>     addresses), I think we should get rid of the topology, and simply count
>     the number of unused addresses since the beginning of the sequence.
>     Indeed, the topology of the sequence of addresses is of no interest to
>     the user. Users often misinterpret "gap limit" as the "number of unused
>     addresses available", so I think we should just give them what they want
>     :) This is easier to understand, and it makes things more predictable,
>     because the wallet will always display the same number of unused
>     addresses (except when it is waiting for confirmations).
>
>
> I'm not convinced that it is either simpler to implement nor simpler to
> understand. I considering every "account" as completely independent
> structure (except that it has been derived from master seed). Because of
> this, I don't see a reason why number of generated addresses in one
> account should affect available addresses of other account.


Sorry if I was not clear, but no, I was not proposing that... I propose 
to count the number of unused addresses in each account, independently.

Here is an explanation with pictures:

Currently, Electrum does this:

x = used address
o = unused address

x x x o o x x x x o o o o o
       |           └───────┘ 5 unused addresses at the end (gap limit =5)
      existing gap, size 2

Case 1:
Suppose the user decides to use the 4th address starting from the end:
x x x o o x x x x x o o o o

After 3 confirmations, Electrum will create one extra address:
x x x o o x x x x x o o o o o
                     └───────┘ 5 final address (one new)

Case 2:
The user, who understands nothing about topology, decides to use the 
final address:
x x x o o x x x x o o o o x

After 3 confirmations, Electrum will create 5 new addresses:
x x x o o x x x x o o o o x o o o o o
                     |        └───────┘ 5 new addresses
                  new gap (size 4)


You see that this leads to a number of newly created addresses that 
depends on the address picked by the user. This is the behaviour that I 
want to fix. I think it is bad for two reasons: First, because it is 
unpredictable (I had a user who set his gap limit to 100, and then was 
systematically using the last address of the list, ending up with a lot 
of wasted addresses). Second, because the worst case scenario (case 2) 
creates large gaps, which are less robust to blockchain reorgs than in 
case 1. A reorg in case 1, where the last tx is cancelled will create no 
gap. A reorg in case 2 can result in a gap that is larger than the limit 
(5), if another transaction uses the final addresses. (this is why 
Electrum has to wait for a few confirmations before adding addresses)


So, what I propose is to always have a constant number of unused 
addresses in each account, instead of something that depends on the 
topology. (this number can be 10 or 20, I don't mind, but I guess Mike 
might prefer 20...)