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 ) 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 ; 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 (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 ; 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: In-Reply-To: From: Nagaev Boris Date: Sat, 24 Feb 2024 17:54:52 -0300 Message-ID: Subject: Re: [bitcoindev] Over Half of Replace-by-Fee-Rate Replacements Are Mined To: Peter Todd 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: X-Google-Group-Id: 786775582512 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , X-Spam-Score: -0.5 (/) On Sat, Feb 24, 2024 at 3:45=E2=80=AFPM Peter Todd 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.