From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 683D4C0037 for ; Wed, 20 Dec 2023 19:13:37 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 3A44640A74 for ; Wed, 20 Dec 2023 19:13:37 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 3A44640A74 Authentication-Results: smtp2.osuosl.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=e0Ehu0EQ X-Virus-Scanned: amavisd-new at osuosl.org X-Spam-Flag: NO X-Spam-Score: -2.098 X-Spam-Level: X-Spam-Status: No, score=-2.098 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id JxXWxUJ9xov5 for ; Wed, 20 Dec 2023 19:13:34 +0000 (UTC) Received: from mail-il1-x135.google.com (mail-il1-x135.google.com [IPv6:2607:f8b0:4864:20::135]) by smtp2.osuosl.org (Postfix) with ESMTPS id 29EF5400A4 for ; Wed, 20 Dec 2023 19:13:34 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 29EF5400A4 Received: by mail-il1-x135.google.com with SMTP id e9e14a558f8ab-35fc1a1b52bso7511885ab.2 for ; Wed, 20 Dec 2023 11:13:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703099613; x=1703704413; darn=lists.linuxfoundation.org; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=6GDkTp+s9ttWMuwh4axCCvULmIdXkJ3V3YluWX0g0F0=; b=e0Ehu0EQ/LxeVhosKiHrCy6DcHnLO7w3U4ch1Jwm/ZHe0Pe4gVaccB+K4+ldJb1+6f ylOY+an+uzOcMjrHDH5PnFI9/IzthR2ZFGS71tl0aPK/JP5QNsR6KUSxOAHnINCf1MKZ hNEOsUO0spjLr6X49IGmXhOZbadJ7bnwLjWC4xUxDvhfRWkQhEYC7uxJRLPC8YOxvBD/ tCYjSOo+7tPonpIkbAKYQYwgfb6vZOC0jl4wuvsnF119uVcfN8cDeteTQSCkU3rNAS9+ SH1CRUWZ7nkKn/qyATcEOFJUHPpA0JCnO1GBV+rBxynI9/cel4rL2HrhBs38DfAhJVHs 8bZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703099613; x=1703704413; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=6GDkTp+s9ttWMuwh4axCCvULmIdXkJ3V3YluWX0g0F0=; b=Pt9Y9oMB3o7to683vo3Af9tMHb5v0AG8chcgrlWI0NS5prQLnSrsStGrSEUYy+C2Ec nv0ThrB8rO065BR4oBezgNGEnSG4U/quS02vEGEbTBJZmNqHy/QArfCe82mStDRn3ZXD JdwXxi6BaxSYO7p8Bo4LcCXygQZt0vyQ3m243/C+4nNkfTboZqp0cbzcQddjI00S4MxQ qMr3XFNfGVW0zVO0k1+dABlhD36aZJkKcaw626j/M/6gDZOx13n3Ce7Z2sYEsSnc5NA6 kmC8mJGXGQcFUqfYJTQGRFHkiI70zu+iuCy5MJGZTbd61JSkdFGsJRmnjx4koBSg3zpu MVjA== X-Gm-Message-State: AOJu0Yz2+W9KV8F7RUTThVBcu5/x7ojpoRjhCg2nHJ1TxOkIj8x2LqTH gSP5+LWCcKD6Cd5IOAAzGLJbcei0BcN3VdKFBB0= X-Google-Smtp-Source: AGHT+IEfXeb4gt5NMzj+rW/A4GVZsIZOsNQH1UANudXI7mcORkxunEhBtU8rdcFTgbCQ8McKuD9JUeytU/3DDmQiSao= X-Received: by 2002:a05:6e02:339c:b0:35f:ca3f:fa67 with SMTP id bn28-20020a056e02339c00b0035fca3ffa67mr1996938ilb.43.1703099612976; Wed, 20 Dec 2023 11:13:32 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Gloria Zhao Date: Wed, 20 Dec 2023 19:13:22 +0000 Message-ID: To: Peter Todd , Bitcoin Protocol Discussion Content-Type: multipart/alternative; boundary="00000000000072dc68060cf5c763" X-Mailman-Approved-At: Fri, 22 Dec 2023 01:02:16 +0000 Subject: Re: [bitcoin-dev] V3 Transactions are still vulnerable to significant tx pinning griefing attacks 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, 20 Dec 2023 19:13:37 -0000 --00000000000072dc68060cf5c763 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Peter, Thanks for spending time thinking about RBF pinning and v3. > Enter Mallory. His goal is to grief Alice by forcing her to spend more money than she intended... > ...Thus the total fee of Mallory's package would have > been 6.6 * 1/2.5 =3D 2.6x more than Alice's total fee, and to get her transaction > mined prior to her deadline, Alice would have had to pay a 2.6x higher fee than > expected. I think this is a good understanding of the goal of Rule #3, but I'm not sure how you're getting these numbers without specifying the size and fees of the commitment transaction. We should also quantify the severity of the "damage" of this pin in a meaningful way; the issue of "Alice may need to pay to replace descendant(s) she isn't aware of" is just a property of allowing unconfirmed descendants. Let's use some concrete numbers with your example. As you describe, we need 80-162sat/vB to get into the next block, and Alice can fund a CPFP with a 152vB CPFP. Let's say the commitment transaction has size N, and pays 0 fees. The lower number of 80sat/vB describes what Mallory needs to shoot below in order to "pay nothing" for the attack (i.e. otherwise it's a CPFP and gets the tx confirmed). Mallory can maximize the cost of replacement according to Rule #3 by keeping a low feerate while maximizing the size of the tx. The higher number of 162sat/vB describes the reasonable upper bound of what Alice should pay to get the transactions confirmed. As in: If Alice pays exactly 162sat/vB * (N + 152vB) satoshis to get her tx confirmed, nothing went wrong. She hopes to not pay more than that, but she'll keep broadcasting higher bumps until it confirms. The "damage" of the pin can quantified by the extra fees Alice has to pay. For a v3 transaction, Mallory can attach 1000vB at 80sat/vB. This can increase the cost of replacement to 80,000sat. For a non-v3 transaction, Mallory can attach (101KvB - N) before maxing out the descendant limit. Rule #4 is pretty negligible here, but since you've already specified Alice's child as 152vB, she'll need to pay Rule #3 + 152sats for a replacement. Let's say N is 1000vB. AFAIK commitment transactions aren't usually smaller than this: - Alice is happy to pay 162sat/vB * (1000 + 152vB) =3D 186,624sat - In a v3 world, Mallory can make the cost to replace 80sat/vB * (1000vB) + 152 =3D 80,152sat - Mallory doesn't succeed, Alice's CPFP easily pays for the replacement - In a non-v3 world, Mallory can make the cost to replace 80sat/vB * (100,000vB) + 152 =3D 8,000,152sat - Mallory does succeed, Alice would need to pay ~7 million sats extra Let's say N is 10,000vB: - Alice is happy to pay 162sat/vB * (10,000 + 152vB) =3D 1,644,624 - In a v3 world, Mallory can make the cost to replace 80sat/vB * (1000vB) + 152 =3D 80,152sat - Mallory doesn't succeed, Alice's CPFP easily pays for the replacement - In a non-v3 world, Mallory can make the cost to replace 80sat/vB * (91,000vB) + 152 =3D 7,280,152sat - Mallory does succeed Alice would need to pay ~5 million sats extra Let's say N is 50,000vB: - Alice is happy to pay 162sat/vB * (50,000 + 152vB) =3D 8,124,624 - In a v3 world, Mallory can make the cost to replace 80sat/vB * (1000vB) + 152 =3D 80,152sat - Mallory doesn't succeed, Alice's CPFP easily pays for the replacement - In a non-v3 world, Mallory can make the cost to replace 80sat/vB * (51,000vB) + 152 =3D 4,080,152sat - Mallory doesn't succeed, Alice's CPFP easily pays for the replacement - The key idea here is that there isn't much room for descendants and the cost to CPFP is very high These numbers change if you tweak more variables - the fees paid by the commitment tx, the feerate range, etc. But the point here is to reduce the potential "damage" by 100x by restricting the allowed child size. > If V3 children are restricted to, say, 200vB, the attack is much less effective as the ratio of Alice vs Mallory size is so small. This is exactly the idea; note that we've come from 100KvB to 1000vB. > Mallory can improve the efficiency of his griefing attack by attacking multiple > targets at once. Assuming Mallory uses 1 taproot input and 1 taproot output for > his own funds, he can spend 21 ephemeral anchors in a single 1000vB > transaction. Note that v3 does not allow more than 1 unconfirmed parent per tx. Let me know if I've made an arithmetic error, but hopefully the general idea is clear. Best, Gloria On Wed, Dec 20, 2023 at 5:16=E2=80=AFPM Peter Todd via bitcoin-dev < bitcoin-dev@lists.linuxfoundation.org> wrote: > V3 transactions(1) is a set of transaction relay policies intended to aim > L2/contracting protocols, namely Lightning. The main aim of V3 > transactions is > to solve Rule 3 transaction pinning(2), allowing the use of ephemeral > anchors(3) that do not contain a signature check; anchor outputs that _do= _ > contain a signature check are not vulnerable to pinning attacks, as only > the > intended party is able to spend them while unconfirmed. > > The main way that V3 transactions aims to mitigate transaction pinning is > with > the following rule: > > A V3 transaction that has an unconfirmed V3 ancestor cannot be larger > than > 1000 virtual bytes. > > Unfortunately, this rule - and thus V3 transactions - is insufficient to > substantially mitigate transaction pinning attacks. > > > # The Scenario > > To understand why, let's consider the following scenario: Alice has a > Lightning > channel with Bob, who has become unresponsive. Alice is using a Lightning > protocol where using V3 commitment transactions with a single OP_TRUE > ephemeral > anchor of zero value. The commitment transaction must be broadcast in a > package, containing both the commitment transaction, and a transaction > spending > the anchor output; regardless of the fee of the commitment transaction, > this is > a hard requirement, as the zero-valued output is considered non-standard > by V3 > rules unless spent in the same package. > > To pay for the transaction fee of the commitment transaction, Alice spend= s > the > ephemeral output in a 2 input, 1 output, taproot transaction of 152vB in > size, > with sufficient feerate Ra to get the transaction mined in what Alice > considers to be a reasonable amount of time. > > > # The Attack > > Enter Mallory. His goal is to grief Alice by forcing her to spend more > money > than she intended, at minimum cost. He also maintains well connected node= s, > giving him the opportunity to both learn about new transactions, and > quickly > broadcast transactions to a large number of nodes at once. > > When Mallory learns about Alice's commitment+anchor spend package, he > signs a > replacement anchor spend transaction, 1000vB in size, with a lower feerat= e > Rm > such that the total fee of Alice's anchor spend is <=3D Mallory's anchor > spend > (in fact, the total fee can be even less due to BIP-125 RBF Rule #4, but > for > sake of a simple argument we'll ignore this). Next, Mallory broadcast's > that > package widely, using his well-connected nodes. > > Due to Rule #3, Alice's higher feerate transaction package does not repla= ce > Mallory's lower fee rate, higher absolute fee, transaction package. Alice= 's > options are now: > > 1. Wait for Mallory's low feerate transaction to be mined (mempool > expiration > does not help here, as Mallory can rebroadcast it indefinitely). > 2. Hope her transaction got to a miner, and wait for it to get mined. > 3. Replace it with an even higher fee transaction, spending at least as > much > money as Mallory allocated. > > In option #1 and #3, Mallory paid no transaction fees to do the attack. > > Unfortunately for Alice, feerates are often quite stable. For example, as= I > write this, the feerate required to get into the next block is 162sat/vB, > while > the *lowest* feerate transaction to get mined in the past 24 hours is > approximately 80sat/vB, a difference of just 2x. > > Suppose that in this circumstance Alice needs to get her commitment > transaction > mined within 24 hours. If Mallory used a feerate of 1/2.5th that of Alice= , > Mallory's transaction would not have gotten mined in the 24 hour period, > with a > reasonable safety margin. Thus the total fee of Mallory's package would > have > been 6.6 * 1/2.5 =3D 2.6x more than Alice's total fee, and to get her > transaction > mined prior to her deadline, Alice would have had to pay a 2.6x higher fe= e > than > expected. > > > ## Multi-Party Attack > > Mallory can improve the efficiency of his griefing attack by attacking > multiple > targets at once. Assuming Mallory uses 1 taproot input and 1 taproot > output for > his own funds, he can spend 21 ephemeral anchors in a single 1000vB > transaction. > > Provided that the RBF Rule #4 feerate delta is negligible relative to > current > feerates, Mallory can build up the attack against multiple targets by > broadcasting replacements with slightly higher feerates as needed to add > and > remove Alice's. > > The cost of the attack to Mallory is estimating fees incorrectly, and > using a > sufficiently high feerate that his transaction does in fact get mined. In > that > circumstance, if he's attacking multiple targets, it is likely that all h= is > transactions would get mined at once. Thus having only a single attack > transaction reduces that worst case cost. Since Mallory can adding and > remove > Alice's, he can still force multiple Alice's to spend funds bumping their > transactions. > > > # Solutions > > ## Replace-by-Feerate > > Obviously, this attack does not work if Rule #3 is removed for small > transactions, allowing Alice's transaction to replace Mallory via > replace-by-feerate. In the common situation where mempools are deep, this > is > arguably miner incentive compatible as other transactions at essentially > the > same feerate will simply replace the "space" taken up by the griefing > transaction. > > > ## Restrict V3 Children Even Further > > If V3 children are restricted to, say, 200vB, the attack is much less > effective > as the ratio of Alice vs Mallory size is so small. Of course, this has th= e > disadvantage of making it more difficult in some cases to find sufficient > UTXO's to pay for fees, and increasing the number of UTXO's needed to fee > bump > large numbers of transactions. > > > # References > > 1) > https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2022-September/02= 0937.html > , > "[bitcoin-dev] New transaction policies (nVersion=3D3) for contracting > protocols", > Gloria Zhao, Sep 23 2022 > > 2) > https://github.com/bitcoin/bips/blob/master/bip-0125.mediawiki#implementa= tion-details > , > "The replacement transaction pays an absolute fee of at least the sum > paid by the original transactions." > > 3) > https://github.com/instagibbs/bips/blob/ephemeral_anchor/bip-ephemeralanc= hors.mediawiki > > -- > https://petertodd.org 'peter'[:-1]@petertodd.org > _______________________________________________ > bitcoin-dev mailing list > bitcoin-dev@lists.linuxfoundation.org > https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev > --00000000000072dc68060cf5c763 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Peter,

T= hanks for spending time thinking about RBF pinning and v3.

> Enter Mallory. His goal is to grief Alice by forcing her to s= pend more money
than she intended...
> ...Thus the total fee of Mallory= 9;s package would have
> been 6.6 * 1/2.5 =3D 2.6x more than Alice's total fee, and to get = her transaction
> mined prior to her deadline, Alice would have had t= o pay a 2.6x higher fee than
> expected.

I think this is a good under= standing of the goal of Rule #3, but I'm not sure how you're gettin= g these numbers without specifying the size and fees of the commitment tran= saction. We should also quantify the severity of the "damage" of = this pin in a meaningful way; the issue of "Alice may need to pay to r= eplace descendant(s) she=20 isn't aware of" is just a property of allowing unconfirmed descend= ants.

Let's use some concrete numbers with your = example. As you describe, we need 80-162sat/vB to get into the next block, = and Alice can fund a CPFP with a 152vB CPFP. Let's say the commitment t= ransaction has size N, and pays 0 fees.

The lo= wer number of 80sat/vB describes what Mallory needs to shoot below in order= to "pay nothing" for the attack (i.e. otherwise it's a CPFP = and gets the tx confirmed). Mallory can maximize the cost of replacement ac= cording to Rule #3 by keeping a low feerate while maximizing the size of th= e tx.

The higher number of 162sat/vB describes= the reasonable upper bound of what Alice should pay to get the transaction= s confirmed. As in: If Alice pays exactly 162sat/vB * (N + 152vB) satoshis = to get her tx=20 confirmed, nothing went wrong. She hopes to not pay more than that, but=20 she'll keep broadcasting higher bumps until it confirms.

=
The "damage" of the pin can quantified by the extra fe= es Alice has to pay.

For a v3 transaction, Mal= lory can attach 1000vB at 80sat/vB. This can increase the cost of replaceme= nt to 80,000sat.
For a non-v3 transaction, Mallory can attach (10= 1KvB - N) before maxing out the descendant limit.
Rule #4 is pret= ty negligible here, but since you've already specified Alice's chil= d as 152vB, she'll need to pay Rule #3 + 152sats for a replacement.
=

Let's say N is 1000vB. AFAIK commitment trans= actions aren't usually smaller than this:
- Alice is happ= y to pay 162sat/vB * (1000 + 152vB) =3D 186,624sat
- In a v3 worl= d, Mallory can make the cost to replace 80sat/vB * (1000vB)=C2=A0+ 152 =3D = 80,152sat
=C2=A0=C2=A0=C2=A0 - Mallory doesn't succeed, Alice= 's CPFP easily pays for the replacement
- In a non-v3 world, = Mallory can make the cost to replace 80sat/vB * (100,000vB)=C2=A0+ 152 =3D = 8,000,152sat
=C2=A0=C2=A0=C2=A0 - Mallory does succeed, Alice= would need to pay ~7 millio= n sats extra

Let's say N is 10,000v= B:
- Alice is happy to pay 162sat/vB * (10,000 + 152vB) =3D = 1,644,624
= - In a v3 world, Mallory can make the cost to replace 80sat/vB * (1000vB)= =C2=A0+ 152 =3D 80,152sat
=C2=A0=C2=A0=C2=A0 - Mallory doesn'= t succeed, Alice's CPFP easily pays for the replacement
-= In a non-v3 world, Mallory can make the cost to replace 80sat/vB * (91,000= vB)=C2=A0+ 152 =3D 7,280,152sat
=C2=A0=C2=A0=C2=A0 - Mallory = does succeed Alice would need to pay ~5 million sats extra

Let's sa= y N is 50,000vB:
- Alice is happy to pay 162sat/vB * (50,000 + 15= 2vB) =3D 8,124,624 <= /div>
- In a v3 world, Mallory can make the cost to replace 80sat/vB * = (1000vB)=C2=A0+ 152 =3D 80,152sat
=C2=A0=C2=A0=C2=A0 - Mallory do= esn't succeed, Alice's CPFP easily pays for the replacement
- In a non-v3 world, Mallory can make the cost to replace 80sat/vB * (51= ,000vB)=C2=A0+ 152 =3D 4,080,152sat
=C2=A0=C2=A0=C2=A0 - Mall= ory doesn't succeed, Alice's CPFP easily pays for the replacement
=C2=A0=C2=A0=C2=A0 - The key idea here is that there isn't muc= h room for descendants and the cost to CPFP is very high

=
These numbers change if you tweak more variables - the fee= s paid by the commitment tx, the feerate range, etc. But the point here is = to reduce the potential "damage" by 100x by restricting the allow= ed child size.

> If V3 children are restricted = to, say, 200vB, the attack is much less effective
as the ratio of Alice vs Mallory size is so small.

This is exactly the idea; note that we've come from 100KvB to 100= 0vB.

> Mallory can improve the efficiency o= f his griefing attack by attacking multiple
> targets at once. Assuming Mallory uses 1 taproot input and 1 taproot o= utput for
> his own funds, he can spend 21 ephemeral anchors in a single 1000vB > transaction.

Note that v3 does not allow more= than 1 unconfirmed parent per tx.

Let me know if = I've made an arithmetic error, but hopefully the general idea is clear.=

Best,
Gloria

<= div class=3D"gmail_quote">
On Wed, Dec= 20, 2023 at 5:16=E2=80=AFPM Peter Todd via bitcoin-dev <bitcoin-dev@lists.linuxfoundation= .org> wrote:
V3 transactions(1) is a set of transaction relay policies intended to a= im
L2/contracting protocols, namely Lightning. The main aim of V3 transactions= is
to solve Rule 3 transaction pinning(2), allowing the use of ephemeral
anchors(3) that do not contain a signature check; anchor outputs that _do_<= br> contain a signature check are not vulnerable to pinning attacks, as only th= e
intended party is able to spend them while unconfirmed.

The main way that V3 transactions aims to mitigate transaction pinning is w= ith
the following rule:

=C2=A0 =C2=A0 A V3 transaction that has an unconfirmed V3 ancestor cannot b= e larger than
=C2=A0 =C2=A0 1000 virtual bytes.

Unfortunately, this rule - and thus V3 transactions - is insufficient to substantially mitigate transaction pinning attacks.


# The Scenario

To understand why, let's consider the following scenario: Alice has a L= ightning
channel with Bob, who has become unresponsive. Alice is using a Lightning protocol where using V3 commitment transactions with a single OP_TRUE ephem= eral
anchor of zero value.=C2=A0 The commitment transaction must be broadcast in= a
package, containing both the commitment transaction, and a transaction spen= ding
the anchor output; regardless of the fee of the commitment transaction, thi= s is
a hard requirement, as the zero-valued output is considered non-standard by= V3
rules unless spent in the same package.

To pay for the transaction fee of the commitment transaction, Alice spends = the
ephemeral output in a 2 input, 1 output, taproot transaction of 152vB in si= ze,
with sufficient feerate Ra to get the transaction mined in what Alice
considers to be a reasonable amount of time.


# The Attack

Enter Mallory. His goal is to grief Alice by forcing her to spend more mone= y
than she intended, at minimum cost. He also maintains well connected nodes,=
giving him the opportunity to both learn about new transactions, and quickl= y
broadcast transactions to a large number of nodes at once.

When Mallory learns about Alice's commitment+anchor spend package, he s= igns a
replacement anchor spend transaction, 1000vB in size, with a lower feerate = Rm
such that the total fee of Alice's anchor spend is <=3D Mallory'= s anchor spend
(in fact, the total fee can be even less due to BIP-125 RBF Rule #4, but fo= r
sake of a simple argument we'll ignore this). Next, Mallory broadcast&#= 39;s that
package widely, using his well-connected nodes.

Due to Rule #3, Alice's higher feerate transaction package does not rep= lace
Mallory's lower fee rate, higher absolute fee, transaction package. Ali= ce's
options are now:

1. Wait for Mallory's low feerate transaction to be mined (mempool expi= ration
=C2=A0 =C2=A0does not help here, as Mallory can rebroadcast it indefinitely= ).
2. Hope her transaction got to a miner, and wait for it to get mined.
3. Replace it with an even higher fee transaction, spending at least as muc= h
=C2=A0 =C2=A0money as Mallory allocated.

In option #1 and #3, Mallory paid no transaction fees to do the attack.

Unfortunately for Alice, feerates are often quite stable. For example, as I=
write this, the feerate required to get into the next block is 162sat/vB, w= hile
the *lowest* feerate transaction to get mined in the past 24 hours is
approximately 80sat/vB, a difference of just 2x.

Suppose that in this circumstance Alice needs to get her commitment transac= tion
mined within 24 hours. If Mallory used a feerate of 1/2.5th that of Alice,<= br> Mallory's transaction would not have gotten mined in the 24 hour period= , with a
reasonable safety margin. Thus the total fee of Mallory's package would= have
been 6.6 * 1/2.5 =3D 2.6x more than Alice's total fee, and to get her t= ransaction
mined prior to her deadline, Alice would have had to pay a 2.6x higher fee = than
expected.


## Multi-Party Attack

Mallory can improve the efficiency of his griefing attack by attacking mult= iple
targets at once. Assuming Mallory uses 1 taproot input and 1 taproot output= for
his own funds, he can spend 21 ephemeral anchors in a single 1000vB
transaction.

Provided that the RBF Rule #4 feerate delta is negligible relative to curre= nt
feerates, Mallory can build up the attack against multiple targets by
broadcasting replacements with slightly higher feerates as needed to add an= d
remove Alice's.

The cost of the attack to Mallory is estimating fees incorrectly, and using= a
sufficiently high feerate that his transaction does in fact get mined. In t= hat
circumstance, if he's attacking multiple targets, it is likely that all= his
transactions would get mined at once. Thus having only a single attack
transaction reduces that worst case cost. Since Mallory can adding and remo= ve
Alice's, he can still force multiple Alice's to spend funds bumping= their
transactions.


# Solutions

## Replace-by-Feerate

Obviously, this attack does not work if Rule #3 is removed for small
transactions, allowing Alice's transaction to replace Mallory via
replace-by-feerate. In the common situation where mempools are deep, this i= s
arguably miner incentive compatible as other transactions at essentially th= e
same feerate will simply replace the "space" taken up by the grie= fing
transaction.


## Restrict V3 Children Even Further

If V3 children are restricted to, say, 200vB, the attack is much less effec= tive
as the ratio of Alice vs Mallory size is so small. Of course, this has the<= br> disadvantage of making it more difficult in some cases to find sufficient UTXO's to pay for fees, and increasing the number of UTXO's needed = to fee bump
large numbers of transactions.


# References

1) https://lists.l= inuxfoundation.org/pipermail/bitcoin-dev/2022-September/020937.html, =C2=A0 =C2=A0"[bitcoin-dev] New transaction policies (nVersion=3D3) fo= r contracting protocols",
=C2=A0 =C2=A0Gloria Zhao, Sep 23 2022

2) https://gith= ub.com/bitcoin/bips/blob/master/bip-0125.mediawiki#implementation-details,
=C2=A0 =C2=A0"The replacement transaction pays an absolute fee of at l= east the sum paid by the original transactions."

3)
https://gi= thub.com/instagibbs/bips/blob/ephemeral_anchor/bip-ephemeralanchors.mediawi= ki

--
http= s://petertodd.org 'peter'[:-1]@petertodd.org
_______________________________________________
bitcoin-dev mailing list
= bitcoin-dev@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mail= man/listinfo/bitcoin-dev
--00000000000072dc68060cf5c763--