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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
|
Delivery-date: Sat, 24 Feb 2024 14:54:05 -0800
Received: from mail-qv1-f56.google.com ([209.85.219.56])
by mail.fairlystable.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
(Exim 4.94.2)
(envelope-from <bitcoindev+bncBCYMD7OS6ECBBBPH5GXAMGQEEOVLFOQ@googlegroups.com>)
id 1re0uC-00009p-Nf
for bitcoindev@gnusha.org; Sat, 24 Feb 2024 14:54:05 -0800
Received: by mail-qv1-f56.google.com with SMTP id 6a1803df08f44-68f892ca388sf22322446d6.2
for <bitcoindev@gnusha.org>; Sat, 24 Feb 2024 14:54:04 -0800 (PST)
ARC-Seal: i=2; a=rsa-sha256; t=1708815238; cv=pass;
d=google.com; s=arc-20160816;
b=b79LP9cfLuStdBp1C9JVgeVlk/iHzp7cFdiGBREfbwv7NPCn4NdSlRCkZ16JJraLzR
Bvz04RU+8GhD0VRpXraiLoTcw3j0+4vpwc4QGJ8NblDmqr+MsbeZSP1SpomCaGrx1t+t
lklW7BI1ALLZkVbhylP3AabcD7TU6FfqwbPt90UTq8gJ1Rpyq+YGJKhbMIWRHK4JILPp
tqQ6+fpxVPalhBSmtSayW6nWIpT1O40EcBoV9uz2UAKXNT6q+riAzOtdSeH84nr38u5V
w+8m3AppMD67tygRbBKYWgBnY0HziwDpKKYlw+DmNRM8aYOzJD1lBlOpS9Bx8yaqtT2p
IV5A==
ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post
:list-id:mailing-list:precedence:content-transfer-encoding:cc:to
:subject:message-id:date:from:in-reply-to:references:mime-version
:sender:dkim-signature:dkim-signature;
bh=JYfnyi1Wbs07Ynn3i0RTjZn+wl0cONmLKBuxbCT4h0g=;
fh=mKcU+OuyA+Yo0itzmfNJKySNsjkNUHUnDjoqYr5cv9M=;
b=UPoscBG4kEwhiL1SB2txAQsdil8PiszImrRrb0ZT3+MxNRCC66qkpiJ/5DzVNmIbEp
Sr5kxuVajLyXPM5V0KI98NnR4pn17ShQV14GBfM06Ef0na7mhx3uUPgqLmAdAf3g9gbb
T/IlRR3drKVZjb51W7peLhXt/uVUJ3pXPYpEyoPeKZ2LXxXfJRmDn+X/17sIqzSUgsF3
b2uGovmbC5ZXYo5lKCdeTZ0c+Noa4jBl5ofM93wFfoHKQRgxzZziOFXEBTLLzuqoj42E
0bWUNxImUEY1iaIjCG0/wjvU5xyGRCZ5Ec+HBup7K4zOjeKLFrClISyXsh/IEkoAFeIr
eWtQ==;
darn=gnusha.org
ARC-Authentication-Results: i=2; gmr-mx.google.com;
dkim=pass header.i=@gmail.com header.s=20230601 header.b=FWOTu8RN;
spf=pass (google.com: domain of bnagaev@gmail.com designates 2607:f8b0:4864:20::12d as permitted sender) smtp.mailfrom=bnagaev@gmail.com;
dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=googlegroups.com; s=20230601; t=1708815238; x=1709420038; darn=gnusha.org;
h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post
:list-id:mailing-list:precedence:x-original-authentication-results
:x-original-sender:content-transfer-encoding:cc:to:subject
:message-id:date:from:in-reply-to:references:mime-version:sender
:from:to:cc:subject:date:message-id:reply-to;
bh=JYfnyi1Wbs07Ynn3i0RTjZn+wl0cONmLKBuxbCT4h0g=;
b=Wtqsw7X2PRLy055zu+yEnJ7WYXmn7HMqwyO8RksJnoThlvWS2Yb+IaeDQQOQCYVRUa
rFn2LPHvgFYNgaOCa7JzxdQglBDI655E0ZXroLqT/oGKhuMZWRte4HrEi+QlJtWakh3v
12RTuD1Gvj4B6gX6c1LI1UmS6/icwH+9/RHKRqDx5kLVcw5GRjZnorshjaoybwzR1AFI
6fJLQBAZ9ok9L/8pD4ePv3P8m3xzURttEFjLMBdKnH8MmE+Wi2JZXJy+O394TnK9Q63B
cZEklxpV5w13HFJob3h/ozj77H2HOMJmdfHKlNTb9Jd21LxRXV2KLAyBMuy5nh2p1wjr
qTUQ==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1708815238; x=1709420038; darn=gnusha.org;
h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post
:list-id:mailing-list:precedence:x-original-authentication-results
:x-original-sender:content-transfer-encoding:cc:to:subject
:message-id:date:from:in-reply-to:references:mime-version:from:to:cc
:subject:date:message-id:reply-to;
bh=JYfnyi1Wbs07Ynn3i0RTjZn+wl0cONmLKBuxbCT4h0g=;
b=W40qGZLCyDeLPamPwolZex7yWgIJ/N34NgYk9FujQcyibQPsL2ohnR7hIOfKisnSJU
6MrffpTxM/J3Jf6taRBrEgOWe2BLuTFo7BDzUeAoQvAdVqgEQT04dYnZdkh7IXemCiuC
O4G7Ft7jJZkYJeyvAgUGBi6Go2ScPq7+9SCE+sV7y/Q4x3UGcAqwUhJiJhDgejWJs7k4
q8iNMLFYZmWXQ1knWjD45vIYps4GUh3Tui8hQDFb1l4kuHM7cLR3TGmtBDNLS2uJBR9j
5C+n/epoA6U1fyWlg8ZGnE4dMq6v4r+5j7vL0FXiEdXYvCL5DfIgzElVqa/wWZbgJMgL
6nhw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1708815238; x=1709420038;
h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post
:list-id:mailing-list:precedence:x-original-authentication-results
:x-original-sender:content-transfer-encoding:cc:to:subject
:message-id:date:from:in-reply-to:references:mime-version
:x-beenthere:x-gm-message-state:sender:from:to:cc:subject:date
:message-id:reply-to;
bh=JYfnyi1Wbs07Ynn3i0RTjZn+wl0cONmLKBuxbCT4h0g=;
b=vzulaWpeytKAgp0VLzPCNAYPtEm4nFlwuflwA2gokKoTizV7BOU16ZxhTG6uNMaLX6
t7KsMtV5DxhNfZrZlDD3sWy+r/kKXLNvzMhhHpC5yQC+sBwf/3jvzbdyni18YmMZYTS9
fJWOjP8hW//b4rYQtQJEzkuVAu+LmNzfU0rEcwT8T3ysoBI5JkzAUOS9vTjj7M6P6bk9
+C8yWRpMtduYVD17M2+1iykq8jX9cHZMcElH5KSiATmYtmW2EMENQc7VrvBMe4x/Wi8W
fIVamKN8bvFAhrT0cW4ER7pR6rFTt8soVf3QX47Lsdf4Kd0CUYQj7jJmubxmDXJpgghw
QuvA==
Sender: bitcoindev@googlegroups.com
X-Forwarded-Encrypted: i=2; AJvYcCXNWoElBUljhvEC9/MyjqS6D6A+IRfeaXhk3jmJHEpusitIshuQBf0nXxBCtssolhBRJG2euESkwG3pDwSQLulbmeOlLK0=
X-Gm-Message-State: AOJu0YxaExGQSOkdCkKZv7Ae4on0cGK2zpEGsu0K7ryeqq5h9ec6hxrd
IoIFWadI3mMM+KcAy2bp7uGtF8lHfZhM5woTFrSupYQbcUL74fxz
X-Google-Smtp-Source: AGHT+IGjy/uRW9rNBXwVtHZrjv/2XULm2aVoUb2KtTUdbxSu90Vxmp6hjWKajK01NiHf3y+OD/exzg==
X-Received: by 2002:a0c:df92:0:b0:68f:6e4c:f6dc with SMTP id w18-20020a0cdf92000000b0068f6e4cf6dcmr3635469qvl.61.1708815238311;
Sat, 24 Feb 2024 14:53:58 -0800 (PST)
X-BeenThere: bitcoindev@googlegroups.com
Received: by 2002:ad4:5aa2:0:b0:68c:c65a:40a4 with SMTP id u2-20020ad45aa2000000b0068cc65a40a4ls2870219qvg.1.-pod-prod-05-us;
Sat, 24 Feb 2024 14:53:57 -0800 (PST)
X-Received: by 2002:a05:6214:d0e:b0:68f:f624:dfa3 with SMTP id 14-20020a0562140d0e00b0068ff624dfa3mr83073qvh.11.1708815237395;
Sat, 24 Feb 2024 14:53:57 -0800 (PST)
Received: by 2002:a05:620a:1a08:b0:787:b7fb:889e with SMTP id af79cd13be357-787b7fb8a1ems85a;
Sat, 24 Feb 2024 12:55:31 -0800 (PST)
X-Received: by 2002:a0c:e44b:0:b0:68f:3000:fd98 with SMTP id d11-20020a0ce44b000000b0068f3000fd98mr3025053qvm.45.1708808130532;
Sat, 24 Feb 2024 12:55:30 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1708808130; cv=none;
d=google.com; s=arc-20160816;
b=XPENKNjH8nxyiwUpGKoMdA0RwqH767aVouTKDCSG+66qb4peL03tQ+L2gNB+NRUdbL
pC5b9qECzGmWN77G0jrcu+5hMBuosVM7+bAO29pArwS7KLVju0SQBmOmR7Ez7YYoBMCl
OcDPMkfSsh74zK+F4He72AWYO4ZbsndfozW+CEI/alGgGtEqKImrHRhREhL66bZc/uB3
pEP81PY1pha0ntubrUdSxZwJHi4XqPWXSqqVaW47ZI2OOowNx/u+pzlLvjUW5ioXEEKo
/8pBFQ5k8g33jWE9i0CdqqIlbtddLth3nx2lsX/WEJmkDIJHwJ6b3T+/45jzsxsct9OD
5PTw==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:dkim-signature;
bh=wD6D9DOJz3HmgZg3Qi8LPnDE0ALe+h3vrz6HBOi8vJo=;
fh=psWP3UCtCzzPEOUoUzVM9ZZK8adYsTeWDAKCd6L5Zok=;
b=JvUEUwEiaBpRtltpLA4SstwFZgm5pUG5Tc/w67HGN74xC0uKWH928PqKBaSr8G/Gwc
kxn++UJKb1fkoGE46IJbpv2MXu40LM5YJSyjZy0mVI510K6OZgaiw/TDCffgqZHgVhmC
AJgzLn5cG9LE37NtOncvig0L7CdODKQiKntucU5HNlNE/oAdCUblbUCNrAJ4I14KB+U3
Uu8fdaHERBT5lfJ79eijfqukTV87cDNA/xDV/SxLQOZHhrEUKPtSs6WxcaCfqzlxbx0d
eUfCzL5f8JYijiKWa0CFDv6GPYJVhJMxWRZ8uHvOrS6Jt0HKmVr0PHlSdRCYBkOlydbj
zwpw==;
dara=google.com
ARC-Authentication-Results: i=1; gmr-mx.google.com;
dkim=pass header.i=@gmail.com header.s=20230601 header.b=FWOTu8RN;
spf=pass (google.com: domain of bnagaev@gmail.com designates 2607:f8b0:4864:20::12d as permitted sender) smtp.mailfrom=bnagaev@gmail.com;
dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com
Received: from mail-il1-x12d.google.com (mail-il1-x12d.google.com. [2607:f8b0:4864:20::12d])
by gmr-mx.google.com with ESMTPS id u8-20020a0ce5c8000000b0068f10446451si153398qvm.7.2024.02.24.12.55.30
for <bitcoindev@googlegroups.com>
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Sat, 24 Feb 2024 12:55:30 -0800 (PST)
Received-SPF: pass (google.com: domain of bnagaev@gmail.com designates 2607:f8b0:4864:20::12d as permitted sender) client-ip=2607:f8b0:4864:20::12d;
Received: by mail-il1-x12d.google.com with SMTP id e9e14a558f8ab-3650dcd38a0so4055055ab.1
for <bitcoindev@googlegroups.com>; Sat, 24 Feb 2024 12:55:30 -0800 (PST)
X-Received: by 2002:a92:d24d:0:b0:365:3409:8748 with SMTP id
v13-20020a92d24d000000b0036534098748mr4134706ilg.25.1708808129879; Sat, 24
Feb 2024 12:55:29 -0800 (PST)
MIME-Version: 1.0
References: <ZdoSP+Z/f17TYOD+@petertodd.org> <CAFC_Vt5TSjGVk58o5G8aW4Jt4aJyDQvR9yE4eLvtB1t+m1jrYg@mail.gmail.com>
<Zdo5VZIu3gU5wVQM@petertodd.org>
In-Reply-To: <Zdo5VZIu3gU5wVQM@petertodd.org>
From: Nagaev Boris <bnagaev@gmail.com>
Date: Sat, 24 Feb 2024 17:54:52 -0300
Message-ID: <CAFC_Vt4icK4RMm2UgqsgoV2Qude7e8ThL+3Hm+9DXfB0BgC6ZQ@mail.gmail.com>
Subject: Re: [bitcoindev] Over Half of Replace-by-Fee-Rate Replacements Are Mined
To: Peter Todd <pete@petertodd.org>
Cc: bitcoindev@googlegroups.com
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Original-Sender: bnagaev@gmail.com
X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass
header.i=@gmail.com header.s=20230601 header.b=FWOTu8RN; spf=pass
(google.com: domain of bnagaev@gmail.com designates 2607:f8b0:4864:20::12d as
permitted sender) smtp.mailfrom=bnagaev@gmail.com; dmarc=pass (p=NONE
sp=QUARANTINE dis=NONE) header.from=gmail.com
Precedence: list
Mailing-list: list bitcoindev@googlegroups.com; contact bitcoindev+owners@googlegroups.com
List-ID: <bitcoindev.googlegroups.com>
X-Google-Group-Id: 786775582512
List-Post: <https://groups.google.com/group/bitcoindev/post>, <mailto:bitcoindev@googlegroups.com>
List-Help: <https://groups.google.com/support/>, <mailto:bitcoindev+help@googlegroups.com>
List-Archive: <https://groups.google.com/group/bitcoindev
List-Subscribe: <https://groups.google.com/group/bitcoindev/subscribe>, <mailto:bitcoindev+subscribe@googlegroups.com>
List-Unsubscribe: <mailto:googlegroups-manage+786775582512+unsubscribe@googlegroups.com>,
<https://groups.google.com/group/bitcoindev/subscribe>
X-Spam-Score: -0.5 (/)
On Sat, Feb 24, 2024 at 3:45=E2=80=AFPM Peter Todd <pete@petertodd.org> wro=
te:
>
> On Sat, Feb 24, 2024 at 02:55:26PM -0300, Nagaev Boris wrote:
> > > I recently released a [prototype Libre Relay fork](https://github.com=
/petertodd/bitcoin/tree/libre-relay-v26.0) of Bitcoin Core v26.0, that amon=
g
> > > other things, implements [Pure Replace-By-Fee-Rate](/2024/one-shot-re=
place-by-fee-rate#pure-replace-by-fee-rate) (RBFR)
> > > with a 2x ratio. This means that transactions will be replaced if the=
fee-rate
> > > of the new transaction is at least 2x higher than the old transaction=
(s), even
> > > if the absolute fee is lower.
> >
> > I like the idea of pure replacement by fee rate, but I'm not sure
> > about the 2x coefficient. I'm afraid it can result in overpaying.
> >
> > What is the purpose of the 2x coefficient? Is it needed to prevent DoS
> > by continuously increasing feerate by a fraction of a percent? Isn't
> > 1.1x enough to prevent this DoS vector? A rise from 100 sats/byte to
> > 110 sats/byte is easier to bear, then a rise from 100 to 200,
> > especially if the next block feerate is 105.
>
> The coefficient is a trade-off between overpaying and DoS attack cost. Th=
e
> smaller the coefficient, the more replacements that can be done:
>
> 2^10 =3D 1024
> 1.5^10 =3D 58
> 1.25^10 =3D 9.3
> 1.1^10 =3D 2.6
Very interesting!
To assess the number of DoS replacements, given RBFR is implemented
with coefficient K, we need to know the following two numbers,
available on mempool.space front page:
- Purging feerate (P)
- Next block feerate (N)
For an attacker, to cause the most number of replacements, it is
rational to first introduce a tx with fee rate just above purging
feerate and then increase its feerate by K times until it reaches next
block feerate (N).
So the number of replacements he can successfully cause paying price N
per byte is:
floor(log(K, N/P))
Currently N=3D11, P=3D1.13 (satoshis/byte).
For K=3D2 the number of replacements is 3.
For K=3D1.25 it is 10.
For K=3D1.1 it is 23.
It would be valuable to get access to archival values of Purging
feerate and Next block feerate. Knowing max(N/P) over the whole time
is needed to know the exact number of replacements for an attack in
the worst case in the past.
The strength of a DoS attack is proportional to 1/log(K).
So the price of a DoS attack is proportional to log(K).
The price of RBFR for a legitimate user is proportional to K - 1 - N /
R, where N is the Next block feerate at RBF time and R is the feerate
at which the tx was previously broadcasted (originally or previous
RBF).
Another piece of data which would be very valuable are N and R for
historical RBF events. If K is set to median N / R, then RBFR would
cost nothing to the average legitimate user and cost something to an
attacker, which is a good thing.
> I picked 2x for the prototype because it's:
>
> 1) A safe default that makes DoS attacks _very_ expensive.
> 2) Low enough that the primary purpose of preventing pinning attacks stil=
l
> works.
> 3) High enough to be clearly incentive compatible for miners.
> 4) A ratio that's easy to implement with addition.
>
> The last reason is kinda funny... CFeeRate in Bitcoin Core v26.0 doesn't
> support multiplication or division operations. So I implemented the 2x ra=
tio by
> just adding a fee-rate to itself.
Yeah, it is funny :-)
By the way, K=3D1.25 is also easy to implement using just additions:
bool enough_increase(CFeeRate oldrate, newrate) {
auto oldx2 =3D oldrate + oldrate;
auto oldx5 =3D oldx2 + oldx2 + oldrate;
auto newx2 =3D newrate + newrate;
auto newx4 =3D newx2 + newx2;
return newx4 >=3D oldx5;
}
Also CFeeRate supports integer multiplication, so it can be simplified as:
bool enough_increase(CFeeRate oldrate, newrate) {
return (4 * newrate) >=3D (5 * oldrate);
}
> Personally, I think 1.25 would be a reasonable ratio. But I wanted to rel=
ease a
> conservative version first to minimize the impact of DoS attacks.
>
> --
> https://petertodd.org 'peter'[:-1]@petertodd.org
--=20
Best regards,
Boris Nagaev
--=20
You received this message because you are subscribed to the Google Groups "=
Bitcoin Development Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to bitcoindev+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/=
bitcoindev/CAFC_Vt4icK4RMm2UgqsgoV2Qude7e8ThL%2B3Hm%2B9DXfB0BgC6ZQ%40mail.g=
mail.com.
|