public inbox for bitcoindev@googlegroups.com
 help / color / mirror / Atom feed
* [bitcoin-dev] Preventing/detecting pinning of jointly funded txs
@ 2022-11-02  3:52 Anthony Towns
  2022-11-02 13:46 ` Greg Sanders
  2022-11-06 23:22 ` Antoine Riard
  0 siblings, 2 replies; 4+ messages in thread
From: Anthony Towns @ 2022-11-02  3:52 UTC (permalink / raw)
  To: Bitcoin Protocol Discussion; +Cc: John Carvalho

On Fri, Oct 28, 2022 at 03:21:53AM +1000, Anthony Towns via bitcoin-dev wrote:
> What should folks wanting to do coinjoins/dualfunding/dlcs/etc do to
> solve that problem if they have only opt-in RBF available?

ref: https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2022-October/021124.html

So, having a go at answering my own question.

I think ultimately the scenario here is:

 * you have a joint funding protocol, where everyone says "here's
   an unspent utxo that will be my contribution", collaborates on signing
   a transaction spending all those utxos, and then broadcasts it

 * everyone jointly agrees to pay some amount in fees for that
   transaction, targeting confirmation within N blocks

 * the goal is to have the transaction confirm, obviously; but it's also
   acceptable to discover a conflicting transaction, as that will
   demonstrate that a particular participant has been dishonest (their
   utxo was not "unspent"), allowing the overall protocol to make progress

The question then is how much effort do you have to go to to make such a
protocol work?

As an extreme example, you could always have each participant maintain
a dedicated amount of hashpower: eg, if each participant individually
controls 0.5% of hashpower, then having two honest participants would
give you a 75% chance of confirmation within 137 blocks (roughly a day),
even if your transaction failed to relay at all, and the only way to
prevent confirmation is for a conflicting transaction to be confirmed
earlier. Of course, needing to have 0.5% of hashpower would mean fewer
than 200 people globally could participate in such a protocol, and
requires something like $10M in capital investment just for ASICs in
order to participate.

I think the next step from that pretty much requires introducing the
assumption that the vast majority of the bitcoin p2p network (both nodes
and hashrate) will accept your transaction, at least in a world where all
your collaborators are honest and don't create conflicting transactions.
You can limit that assumption a little bit, but without most p2p peers
being willing to relay your tx, you start having privacy issues; and
without most miners being willing to mine your tx, you start getting
problems with predicting fees. And in any event, I don't think anyone's
trying to make weird transactions here, just get their otherwise normal
transactions to actually confirm.

I think the same approach used to detect double spend races by people
accepting zeroconf would work here too. That is setup a couple of
anonymous bitcoin nodes, let them sit for a couple of weeks so their
mempools are realistic, then when you broadcast a jointly funded
transaction, query their mempools: if your new tx made it there, it
likely made it to mining pools too, and you're fine; if it didn't, then
the transaction that's blocking it almost certainly did, so you can find
out what that is and can go from there.

(If you don't see either your tx, or a conflicting one, then it likely
means the nodes that broadcasted your tx are being sybil attacked, either
because their peers are directly controlled by an attacker, or they've
been identified by an attacker and attacked in some other way; presumably
you could pick a couple of node that have been confirmed by both your
anonymous nodes' as valid and reachable, and connect to them to break
out of the sybil attack; if that doesn't work either, you probably need
to change ISPs or put your active node via a (different) VPN provider...)

Your capital expenses are much lower that way: perhaps on the order of
$20/month to run a couple of nodes on AWS or linode or similar.

But, you might say, what if I don't even want to run multiple bitcoin
nodes 24/7 indefinitely? Can we outsource that, like we outsource mining
by paying tx fees?

That seems harder, particularly if you want to avoid whoever you're
outsourcing too from associating you with the jointly funded transaction
you're interested in.

If you're *not* worried about that association, it's probably easy:
just find some public explorers, and see if they list any conflicts in
their mempool, or use the "broadcast tx" feature and see if it gives an
error identifying the conflicting transaction.

I think it's probably hard to make that behaviour a normal part of p2p tx
relay though: if someone's trying to relay tx T but you reject it
because of a conflicting tx C; then it's easy to tell the node that
first relayed T to you about C -- but how does that information get back
to the original broadcaster?

One way would be to broadcast "C" back to whoever announced T to you,
and let C propogate all the way back to whoever originally proposed T --
but that only works if everyone's running a mempool policy where there's
a total ordering for tx replacement, ie for any conflicting txs, either
T replaces C or C replaces T, and that's not something we have now or
would have even with full RBF, and seems pretty hard to actually achieve.
(And if it was achieved, you could just keep replacing T with a more
attractive T' so that it did eventually replace C)

Another way might be to have the original broadcaster retry the broadcast:
connect to new peers, reannounce T, and see what happens.  Then eventually
they'll connect to a peer that has C in their mempool, and just needs a
"reject" message of some kind that can identify C.  But in that case,
the peer that's going to send the reject message needs to be able to
efficiently associate T back to C, even though it doesn't have T in
the mempool -- it won't want to redownload T each time, because that's
a waste of bandwidth, and it can't re-validate T to find the conflict
fresh without having a copy of T.

Using BIP 37 mempool filters or something might be an approach if there
are plenty of nodes around that _are_ willing to dedicate extra resources
to helping people find potentially conflicting txs.  Unfortunately that
probably is pretty bad for privacy: if your adversary is blocking your
coinjoin T with a pinned tx C, then the fact that you've asked for a
filter that happens to match C is probably a good indication that you're
involved in the coinjoin T; and there's a decent chance that the only
people will to dedicate the extra resources to offer those services to
the public will be people who want to invade your privacy...

A problem with mempool filters (or telling other nodes what's in your
mempool in general) is that that can provide a way for attackers to
identify who your peers are: if you create a bunch of conflicting txs,
and give a different one to many nodes other than you, then see which
tx you end up with, that identifies which peers are close to you, and
that information could be used to attack those peers, which in turn may
allow more effective sybil attacks against you.

So I think my best answer is:

 - if you really want to do things with untrusted peers in bitcoin,
   investing in hashpower maybe isn't that unreasonable a thing to
   do. $10M in capital giving you the ability to usually make progress
   within a day even if everyone else dislikes you? surprisingly
   reasonable, especially if more progress is made on stratumv2...

 - if you don't care about privacy (eg, you're funding a lightning
   channel that's going to be gossiped anyway), just query an explorer
   (or some other centralised service) to find out the conflicting tx
   and go from there.

 - if you do care about privacy, run a few "anonymous" bitcoind nodes
   that don't announce transactions, and see what their mempool
   contains.

 - we can probably make it easier to run anonymous bitcoind nodes
   by making transaction broadcasts more private (tor/i2p? dandelion? have
   lightning nodes send channel open/close txs to another lightning
   node to announce to bitcoin p2p?) -- for cases where you're already
   running a bitcoin node 24/7 (or trusting someone else that does), I
   think that gives you a pretty good method of either being confident
   your tx made it to a decent percentage of hashrate, or spotting a
   conflicting tx to be able to assign blame

Anyone got any improvements on the above?

Cheers,
aj


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [bitcoin-dev] Preventing/detecting pinning of jointly funded txs
  2022-11-02  3:52 [bitcoin-dev] Preventing/detecting pinning of jointly funded txs Anthony Towns
@ 2022-11-02 13:46 ` Greg Sanders
  2022-11-06 23:22 ` Antoine Riard
  1 sibling, 0 replies; 4+ messages in thread
From: Greg Sanders @ 2022-11-02 13:46 UTC (permalink / raw)
  To: Anthony Towns, Bitcoin Protocol Discussion; +Cc: John Carvalho

[-- Attachment #1: Type: text/plain, Size: 9582 bytes --]

Assigning blame here seems to be the paramount concern here. If we can
assign blame, most coinjoin-like protocols can terminate in bounded block
time, assuming fees are properly set.

It's also worth noting that in coinjoin cases, they're obviously coinjoins,
so pinging explorers over Tor HS seems purely additive to me. The use-cases
that can't use it are other privacy methods like coinswap and similar,
where there's no blockchain indication anything different is happening. The
larger the coinjoin, the more potential honest users, the more potential
for a duplicitous double-spend to be gossiped among those peers.

For dual funding LN channels, that number is pretty small(2), so I suspect
the DoS concerns are fairly subtle. Might be worth talking to
CLN/Eclair/Other LN teams that are working through those subtleties as we
speak.

Greg

On Tue, Nov 1, 2022 at 11:52 PM Anthony Towns via bitcoin-dev <
bitcoin-dev@lists•linuxfoundation.org> wrote:

> On Fri, Oct 28, 2022 at 03:21:53AM +1000, Anthony Towns via bitcoin-dev
> wrote:
> > What should folks wanting to do coinjoins/dualfunding/dlcs/etc do to
> > solve that problem if they have only opt-in RBF available?
>
> ref:
> https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2022-October/021124.html
>
> So, having a go at answering my own question.
>
> I think ultimately the scenario here is:
>
>  * you have a joint funding protocol, where everyone says "here's
>    an unspent utxo that will be my contribution", collaborates on signing
>    a transaction spending all those utxos, and then broadcasts it
>
>  * everyone jointly agrees to pay some amount in fees for that
>    transaction, targeting confirmation within N blocks
>
>  * the goal is to have the transaction confirm, obviously; but it's also
>    acceptable to discover a conflicting transaction, as that will
>    demonstrate that a particular participant has been dishonest (their
>    utxo was not "unspent"), allowing the overall protocol to make progress
>
> The question then is how much effort do you have to go to to make such a
> protocol work?
>
> As an extreme example, you could always have each participant maintain
> a dedicated amount of hashpower: eg, if each participant individually
> controls 0.5% of hashpower, then having two honest participants would
> give you a 75% chance of confirmation within 137 blocks (roughly a day),
> even if your transaction failed to relay at all, and the only way to
> prevent confirmation is for a conflicting transaction to be confirmed
> earlier. Of course, needing to have 0.5% of hashpower would mean fewer
> than 200 people globally could participate in such a protocol, and
> requires something like $10M in capital investment just for ASICs in
> order to participate.
>
> I think the next step from that pretty much requires introducing the
> assumption that the vast majority of the bitcoin p2p network (both nodes
> and hashrate) will accept your transaction, at least in a world where all
> your collaborators are honest and don't create conflicting transactions.
> You can limit that assumption a little bit, but without most p2p peers
> being willing to relay your tx, you start having privacy issues; and
> without most miners being willing to mine your tx, you start getting
> problems with predicting fees. And in any event, I don't think anyone's
> trying to make weird transactions here, just get their otherwise normal
> transactions to actually confirm.
>
> I think the same approach used to detect double spend races by people
> accepting zeroconf would work here too. That is setup a couple of
> anonymous bitcoin nodes, let them sit for a couple of weeks so their
> mempools are realistic, then when you broadcast a jointly funded
> transaction, query their mempools: if your new tx made it there, it
> likely made it to mining pools too, and you're fine; if it didn't, then
> the transaction that's blocking it almost certainly did, so you can find
> out what that is and can go from there.
>
> (If you don't see either your tx, or a conflicting one, then it likely
> means the nodes that broadcasted your tx are being sybil attacked, either
> because their peers are directly controlled by an attacker, or they've
> been identified by an attacker and attacked in some other way; presumably
> you could pick a couple of node that have been confirmed by both your
> anonymous nodes' as valid and reachable, and connect to them to break
> out of the sybil attack; if that doesn't work either, you probably need
> to change ISPs or put your active node via a (different) VPN provider...)
>
> Your capital expenses are much lower that way: perhaps on the order of
> $20/month to run a couple of nodes on AWS or linode or similar.
>
> But, you might say, what if I don't even want to run multiple bitcoin
> nodes 24/7 indefinitely? Can we outsource that, like we outsource mining
> by paying tx fees?
>
> That seems harder, particularly if you want to avoid whoever you're
> outsourcing too from associating you with the jointly funded transaction
> you're interested in.
>
> If you're *not* worried about that association, it's probably easy:
> just find some public explorers, and see if they list any conflicts in
> their mempool, or use the "broadcast tx" feature and see if it gives an
> error identifying the conflicting transaction.
>
> I think it's probably hard to make that behaviour a normal part of p2p tx
> relay though: if someone's trying to relay tx T but you reject it
> because of a conflicting tx C; then it's easy to tell the node that
> first relayed T to you about C -- but how does that information get back
> to the original broadcaster?
>
> One way would be to broadcast "C" back to whoever announced T to you,
> and let C propogate all the way back to whoever originally proposed T --
> but that only works if everyone's running a mempool policy where there's
> a total ordering for tx replacement, ie for any conflicting txs, either
> T replaces C or C replaces T, and that's not something we have now or
> would have even with full RBF, and seems pretty hard to actually achieve.
> (And if it was achieved, you could just keep replacing T with a more
> attractive T' so that it did eventually replace C)
>
> Another way might be to have the original broadcaster retry the broadcast:
> connect to new peers, reannounce T, and see what happens.  Then eventually
> they'll connect to a peer that has C in their mempool, and just needs a
> "reject" message of some kind that can identify C.  But in that case,
> the peer that's going to send the reject message needs to be able to
> efficiently associate T back to C, even though it doesn't have T in
> the mempool -- it won't want to redownload T each time, because that's
> a waste of bandwidth, and it can't re-validate T to find the conflict
> fresh without having a copy of T.
>
> Using BIP 37 mempool filters or something might be an approach if there
> are plenty of nodes around that _are_ willing to dedicate extra resources
> to helping people find potentially conflicting txs.  Unfortunately that
> probably is pretty bad for privacy: if your adversary is blocking your
> coinjoin T with a pinned tx C, then the fact that you've asked for a
> filter that happens to match C is probably a good indication that you're
> involved in the coinjoin T; and there's a decent chance that the only
> people will to dedicate the extra resources to offer those services to
> the public will be people who want to invade your privacy...
>
> A problem with mempool filters (or telling other nodes what's in your
> mempool in general) is that that can provide a way for attackers to
> identify who your peers are: if you create a bunch of conflicting txs,
> and give a different one to many nodes other than you, then see which
> tx you end up with, that identifies which peers are close to you, and
> that information could be used to attack those peers, which in turn may
> allow more effective sybil attacks against you.
>
> So I think my best answer is:
>
>  - if you really want to do things with untrusted peers in bitcoin,
>    investing in hashpower maybe isn't that unreasonable a thing to
>    do. $10M in capital giving you the ability to usually make progress
>    within a day even if everyone else dislikes you? surprisingly
>    reasonable, especially if more progress is made on stratumv2...
>
>  - if you don't care about privacy (eg, you're funding a lightning
>    channel that's going to be gossiped anyway), just query an explorer
>    (or some other centralised service) to find out the conflicting tx
>    and go from there.
>
>  - if you do care about privacy, run a few "anonymous" bitcoind nodes
>    that don't announce transactions, and see what their mempool
>    contains.
>
>  - we can probably make it easier to run anonymous bitcoind nodes
>    by making transaction broadcasts more private (tor/i2p? dandelion? have
>    lightning nodes send channel open/close txs to another lightning
>    node to announce to bitcoin p2p?) -- for cases where you're already
>    running a bitcoin node 24/7 (or trusting someone else that does), I
>    think that gives you a pretty good method of either being confident
>    your tx made it to a decent percentage of hashrate, or spotting a
>    conflicting tx to be able to assign blame
>
> Anyone got any improvements on the above?
>
> Cheers,
> aj
> _______________________________________________
> bitcoin-dev mailing list
> bitcoin-dev@lists•linuxfoundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev
>

[-- Attachment #2: Type: text/html, Size: 11055 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [bitcoin-dev] Preventing/detecting pinning of jointly funded txs
  2022-11-02  3:52 [bitcoin-dev] Preventing/detecting pinning of jointly funded txs Anthony Towns
  2022-11-02 13:46 ` Greg Sanders
@ 2022-11-06 23:22 ` Antoine Riard
  2022-11-07 11:46   ` Anthony Towns
  1 sibling, 1 reply; 4+ messages in thread
From: Antoine Riard @ 2022-11-06 23:22 UTC (permalink / raw)
  To: Anthony Towns, Bitcoin Protocol Discussion; +Cc: John Carvalho

[-- Attachment #1: Type: text/plain, Size: 14715 bytes --]

Hi AJ,

Adding a few more thoughts here on what coinjoins/splicing/dual-funded
folks can do to solve this DoS isse in an opt-in RBF world only.

I'm converging that deploying a distributed monitoring of the network
mempools in the same fashion as zeroconf people is one solution, as you can
detect a conflicting spend of your multi-party transaction. Let's say you
have a web of well-connected full-nodes, each reporting all their incoming
mempool transactions to some reconciliation layer.

This "mempools watchdog" infrastructure isn't exempt from mempools
partitioning attacks by an adversary, where the goal is to control your
local node mempool view. A partitioning trick is somehow as simple as
policy changes across versions (e.g allowing Taproot Segwit v0.1 spends) or
two same-feerate transactions. The partitioning attack can target at least
two meaningful subsets. Either the miner mempools only, by conflicting all
the reachable nodes in as many subsets with a "tainted" transaction (e.g
set a special nSequence value for each), and looking on corresponding
issued block. Or targeting the "watchdog" mempools only, where the
adversary observation mechanism is the multi-party blame assignment round
itself. There is an open question on how many "divide-and-conquer" rounds
from an adversary viewpoint you need to efficiently identify all the
complete set of "mempools watchdog". If the transaction-relay topology is
highly dynamic thanks to outbound transaction-relay peers rotation, the
hardness bar is increased.

Though ultimately, the rough mental model I'm thinking on, this is a
"cat-and-mouse" game between the victims and the attacker, where the latter
try to find the blind spots of the former. I would say there is a strong
advantage to the attacker, in mapping the mempools can be batched against
multiple sets of victims. While the victims have no entry barriers to
deploy "mempools watchdog" there is a scarce resource in contest, namely
the inbound connection slots (at least the miners ones).

Victims could batch their defense costs, in outsourcing the monitoring to
dedicated entities (akin to LN watchtower). However, there is a belief in
lack of a compensation mechanism, you will have only a low number of public
ones (see number of BIP157 signaling nodes, or even Electrum ones).
Outsource mempools monitoring will hit the same issue of bounded public
resources, and as such be a "single-point-of-censorship" vector. Reminder,
we would like LN mobile clients from low-budget users to access those fancy
joint funding protocols (or at least I).

So as a first partial conclusion, not only the security efficiency but also
the economic scalability of such defensive "mempools watchdog"
infrastructure remains an open question to me.

Assuming we can solve them, there is still the issue of assigning blame
reliably among a set of trust-minimized joint funding protocol
participating UTXOs. Indeed, you're running quickly into issues like *two*
double-spend from two sybilling participants, aiming to halt the assignment
process. There is likely a need to introduce some "UTXO-satoshi-weight"
vote to efficiently converge towards assignment. At the very least it would
require the attacker to control more than 51% of the contributed UTXO to
manipulate the outcome of the blame assignment process. Assuming an
economically honest majority, you still have the timevalue cost inflicted
for each round of blame assignment. Assuming 255 inputs (current LN's
interactive construction protocol limit) and a transaction propagation
delay of 2min (30s ?) on the p2p network, an attacker controlling all the
inputs minus 1 might be able to DoS for ~50 blocks (do we have other
factors to think of in the design of the blame assignment process ?). In a
future where the timevalue of circulating coins is priced in (IMO when we
have competitive LN routing markets), this is probably a significant damage.

On the other hand, you have a full-rbf world, where instead to deploy or
gain access to "mempools watchdog" and proceed to a timevalue-expensive
blame assignment protocol, any participant should be able to fee-bump the
joint transaction (assuming multiple pre-signed feerate version of the
transactions, or ephemeral, nversion=3 and package-relay to do unilateral
CPFP). Ideally, this would be a reduction to a "flood-and-loot" attack, i.e
the attacker is constrained to buy the blockspace. A situation with a lot
of visibility for the joint funding protocol victims, I think.

Side-note: this alternative resolution process of relying on full-rbf,
still assumes solving RBF pinning rule 3, I think a fact I underscored in
my original full-rbf proposal of last year [0]. All that said, I think it's
good to think more of the end-of-pipeline economic trade-offs of the two
main directions to solve this DoS affecting joint funding protocol.
Transaction signature withhold DoS should be defended on a different layer,
and I think there are far more easy to deal with in  a set of participant
with at least stable temporary pseudonyms ("all participants should produce
a signature before X, laziness due to buggy Internet connection is treated
the same as a DoS" ?).

Best,
Antoine

[0] "Of course, even assuming full-rbf, propagation of the multi-party
funded
transactions can still be interfered with by an attacker, simply
broadcasting a double-spend with a feerate equivalent to the honest
transaction. However, it tightens the attack scenario to a scorched earth
approach, where the attacker has to commit equivalent fee-bumping reserve
to maintain the pinning and might lose the "competing" fees to miners."

https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2021-June/019074.html

Le mar. 1 nov. 2022 à 23:52, Anthony Towns via bitcoin-dev <
bitcoin-dev@lists•linuxfoundation.org> a écrit :

> On Fri, Oct 28, 2022 at 03:21:53AM +1000, Anthony Towns via bitcoin-dev
> wrote:
> > What should folks wanting to do coinjoins/dualfunding/dlcs/etc do to
> > solve that problem if they have only opt-in RBF available?
>
> ref:
> https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2022-October/021124.html
>
> So, having a go at answering my own question.
>
> I think ultimately the scenario here is:
>
>  * you have a joint funding protocol, where everyone says "here's
>    an unspent utxo that will be my contribution", collaborates on signing
>    a transaction spending all those utxos, and then broadcasts it
>
>  * everyone jointly agrees to pay some amount in fees for that
>    transaction, targeting confirmation within N blocks
>
>  * the goal is to have the transaction confirm, obviously; but it's also
>    acceptable to discover a conflicting transaction, as that will
>    demonstrate that a particular participant has been dishonest (their
>    utxo was not "unspent"), allowing the overall protocol to make progress
>
> The question then is how much effort do you have to go to to make such a
> protocol work?
>
> As an extreme example, you could always have each participant maintain
> a dedicated amount of hashpower: eg, if each participant individually
> controls 0.5% of hashpower, then having two honest participants would
> give you a 75% chance of confirmation within 137 blocks (roughly a day),
> even if your transaction failed to relay at all, and the only way to
> prevent confirmation is for a conflicting transaction to be confirmed
> earlier. Of course, needing to have 0.5% of hashpower would mean fewer
> than 200 people globally could participate in such a protocol, and
> requires something like $10M in capital investment just for ASICs in
> order to participate.
>
> I think the next step from that pretty much requires introducing the
> assumption that the vast majority of the bitcoin p2p network (both nodes
> and hashrate) will accept your transaction, at least in a world where all
> your collaborators are honest and don't create conflicting transactions.
> You can limit that assumption a little bit, but without most p2p peers
> being willing to relay your tx, you start having privacy issues; and
> without most miners being willing to mine your tx, you start getting
> problems with predicting fees. And in any event, I don't think anyone's
> trying to make weird transactions here, just get their otherwise normal
> transactions to actually confirm.
>
> I think the same approach used to detect double spend races by people
> accepting zeroconf would work here too. That is setup a couple of
> anonymous bitcoin nodes, let them sit for a couple of weeks so their
> mempools are realistic, then when you broadcast a jointly funded
> transaction, query their mempools: if your new tx made it there, it
> likely made it to mining pools too, and you're fine; if it didn't, then
> the transaction that's blocking it almost certainly did, so you can find
> out what that is and can go from there.
>
> (If you don't see either your tx, or a conflicting one, then it likely
> means the nodes that broadcasted your tx are being sybil attacked, either
> because their peers are directly controlled by an attacker, or they've
> been identified by an attacker and attacked in some other way; presumably
> you could pick a couple of node that have been confirmed by both your
> anonymous nodes' as valid and reachable, and connect to them to break
> out of the sybil attack; if that doesn't work either, you probably need
> to change ISPs or put your active node via a (different) VPN provider...)
>
> Your capital expenses are much lower that way: perhaps on the order of
> $20/month to run a couple of nodes on AWS or linode or similar.
>
> But, you might say, what if I don't even want to run multiple bitcoin
> nodes 24/7 indefinitely? Can we outsource that, like we outsource mining
> by paying tx fees?
>
> That seems harder, particularly if you want to avoid whoever you're
> outsourcing too from associating you with the jointly funded transaction
> you're interested in.
>
> If you're *not* worried about that association, it's probably easy:
> just find some public explorers, and see if they list any conflicts in
> their mempool, or use the "broadcast tx" feature and see if it gives an
> error identifying the conflicting transaction.
>
> I think it's probably hard to make that behaviour a normal part of p2p tx
> relay though: if someone's trying to relay tx T but you reject it
> because of a conflicting tx C; then it's easy to tell the node that
> first relayed T to you about C -- but how does that information get back
> to the original broadcaster?
>
> One way would be to broadcast "C" back to whoever announced T to you,
> and let C propogate all the way back to whoever originally proposed T --
> but that only works if everyone's running a mempool policy where there's
> a total ordering for tx replacement, ie for any conflicting txs, either
> T replaces C or C replaces T, and that's not something we have now or
> would have even with full RBF, and seems pretty hard to actually achieve.
> (And if it was achieved, you could just keep replacing T with a more
> attractive T' so that it did eventually replace C)
>
> Another way might be to have the original broadcaster retry the broadcast:
> connect to new peers, reannounce T, and see what happens.  Then eventually
> they'll connect to a peer that has C in their mempool, and just needs a
> "reject" message of some kind that can identify C.  But in that case,
> the peer that's going to send the reject message needs to be able to
> efficiently associate T back to C, even though it doesn't have T in
> the mempool -- it won't want to redownload T each time, because that's
> a waste of bandwidth, and it can't re-validate T to find the conflict
> fresh without having a copy of T.
>
> Using BIP 37 mempool filters or something might be an approach if there
> are plenty of nodes around that _are_ willing to dedicate extra resources
> to helping people find potentially conflicting txs.  Unfortunately that
> probably is pretty bad for privacy: if your adversary is blocking your
> coinjoin T with a pinned tx C, then the fact that you've asked for a
> filter that happens to match C is probably a good indication that you're
> involved in the coinjoin T; and there's a decent chance that the only
> people will to dedicate the extra resources to offer those services to
> the public will be people who want to invade your privacy...
>
> A problem with mempool filters (or telling other nodes what's in your
> mempool in general) is that that can provide a way for attackers to
> identify who your peers are: if you create a bunch of conflicting txs,
> and give a different one to many nodes other than you, then see which
> tx you end up with, that identifies which peers are close to you, and
> that information could be used to attack those peers, which in turn may
> allow more effective sybil attacks against you.
>
> So I think my best answer is:
>
>  - if you really want to do things with untrusted peers in bitcoin,
>    investing in hashpower maybe isn't that unreasonable a thing to
>    do. $10M in capital giving you the ability to usually make progress
>    within a day even if everyone else dislikes you? surprisingly
>    reasonable, especially if more progress is made on stratumv2...
>
>  - if you don't care about privacy (eg, you're funding a lightning
>    channel that's going to be gossiped anyway), just query an explorer
>    (or some other centralised service) to find out the conflicting tx
>    and go from there.
>
>  - if you do care about privacy, run a few "anonymous" bitcoind nodes
>    that don't announce transactions, and see what their mempool
>    contains.
>
>  - we can probably make it easier to run anonymous bitcoind nodes
>    by making transaction broadcasts more private (tor/i2p? dandelion? have
>    lightning nodes send channel open/close txs to another lightning
>    node to announce to bitcoin p2p?) -- for cases where you're already
>    running a bitcoin node 24/7 (or trusting someone else that does), I
>    think that gives you a pretty good method of either being confident
>    your tx made it to a decent percentage of hashrate, or spotting a
>    conflicting tx to be able to assign blame
>
> Anyone got any improvements on the above?
>
> Cheers,
> aj
> _______________________________________________
> bitcoin-dev mailing list
> bitcoin-dev@lists•linuxfoundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev
>

[-- Attachment #2: Type: text/html, Size: 16205 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [bitcoin-dev] Preventing/detecting pinning of jointly funded txs
  2022-11-06 23:22 ` Antoine Riard
@ 2022-11-07 11:46   ` Anthony Towns
  0 siblings, 0 replies; 4+ messages in thread
From: Anthony Towns @ 2022-11-07 11:46 UTC (permalink / raw)
  To: Antoine Riard, Bitcoin Protocol Discussion

On Sun, Nov 06, 2022 at 06:22:08PM -0500, Antoine Riard via bitcoin-dev wrote:
> Adding a few more thoughts here on what coinjoins/splicing/dual-funded
> folks can do to solve this DoS issue in an opt-in RBF world only.
> 
> I'm converging that deploying a distributed monitoring of the network
> mempools in the same fashion as zeroconf people is one solution, as you can
> detect a conflicting spend of your multi-party transaction.

> Let's say you
> have a web of well-connected full-nodes, each reporting all their incoming
> mempool transactions to some reconciliation layer.
> 
> This "mempools watchdog" infrastructure isn't exempt from mempools
> partitioning attacks by an adversary,

A mempool partitioning attack requires the adversary to identify your
nodes. If they're just monitoring and not being used as the initial
broadcaster of your txs, that should be difficult. (And I think it would
make sense to do things that make it more difficult to successfully
partition a node for tx relay, even if you can identify it)

> where the goal is to control your
> local node mempool view. A partitioning trick is somehow as simple as
> policy changes across versions (e.g allowing Taproot Segwit v0.1 spends) or
> two same-feerate transactions. The partitioning attack can target at least
> two meaningful subsets.

An even easier way to partition the network is to create two conflicting
txs at the same fee/fee rate and to announce them to many peers
simultaneously. That way neither will replace the other, and you can
build from there.

In order to attack you, the partition would need to be broad enough
to capture all your monitoring nodes on one side (to avoid detection),
and all the mining nodes on the other side (to prevent your target tx
from being confirmed). If that seems likely, maybe it indicates that
it's too easy to identify nodes that feed txs to mining pools...

> Either the miner mempools only, by conflicting all
> the reachable nodes in as many subsets with a "tainted" transaction (e.g
> set a special nSequence value for each), and looking on corresponding
> issued block. Or targeting the "watchdog" mempools only, where the
> adversary observation mechanism is the multi-party blame assignment round
> itself.

I think there's a few cases like that: you can find out what txs mining
pools have seen by looking at their blocks, what explorers have seen by
looking at their website...

Being able to use that information to identify your node(s) -- rather
than just your standardness policy, which you hopefully share with many
other nodes -- seems like something we should be working to fix...

> There is an open question on how many "divide-and-conquer" rounds
> from an adversary viewpoint you need to efficiently identify all the
> complete set of "mempools watchdog". If the transaction-relay topology is
> highly dynamic thanks to outbound transaction-relay peers rotation, the
> hardness bar is increased.

I'm not sure outbound rotation is sufficient? In today's world, if
you're a listening node, an attacker can just connect directly, announce
the conflicting tx to you, and other txs to everyone else.

For a non-listening node, outbound rotation might be more harmful than
helpful, as it increases the chances a node will peer with a given
attacker at some point.

> Though ultimately, the rough mental model I'm thinking on, this is a
> "cat-and-mouse" game between the victims and the attacker, where the latter
> try to find the blind spots of the former. I would say there is a strong
> advantage to the attacker, in mapping the mempools can be batched against
> multiple sets of victims. While the victims have no entry barriers to
> deploy "mempools watchdog" there is a scarce resource in contest, namely
> the inbound connection slots (at least the miners ones).

Anytime you deploy a new listening node, you use up 10 inbound
connections, but provide capacity for 115 new ones. Worst case (if
it's too hard to prevent identifying a listening node if you use it for
monitoring), you setup all your monitoring nodes as non-listening nodes,
and also set enough listening nodes in different IP ranges to compenasate
for the number of outbound connections your monitoring nodes are making,
and just ignore the mempools of those listening nodes.

> Victims could batch their defense costs, in outsourcing the monitoring to
> dedicated entities (akin to LN watchtower). However, there is a belief in
> lack of a compensation mechanism, you will have only a low number of public
> ones (see number of BIP157 signaling nodes, or even Electrum ones).

Seems like a pretty simple service to pay for, if there's real demand:
costs are pretty trivial, and if it's a LN service, you can pay for
it over lightning... Fairly easy to test if you're getting what you're
paying for too, by simultaneously announcing two conflicting txs paying
yourself, and checking you get an appropriate alert.

> Assuming we can solve them, there is still the issue of assigning blame
> reliably among a set of trust-minimized joint funding protocol
> participating UTXOs. Indeed, you're running quickly into issues like *two*
> double-spend from two sybilling participants, aiming to halt the assignment
> process.

I don't see how that's a problem: anyone who wants to continue as part of
the group never signs a conflicting tx; anyone who does sign a conflicting
tx is saying "I don't want to be part of this group anymore", whether
that conflicting tx arrives via normal channels or p2p. If you want a way
of saying "I want to abort this coinjoin, but stay a part of the group",
you need to get 51% of the rest of the group to sign off on that claim
(outside of the blockchain/mempool), before getting control of your
utxo back. If you can't get 51% of the group to sign off on that in a
reasonable time, then you should just exit the group.

I don't think it makes much sense for "group A said Bob's a cheater,
so therefore we won't let Bob into group C either".

> for each round of blame assignment. Assuming 255 inputs (current LN's
> interactive construction protocol limit) and a transaction propagation
> delay of 2min (30s ?) on the p2p network, an attacker controlling all the
> inputs minus 1 might be able to DoS for ~50 blocks (do we have other
> factors to think of in the design of the blame assignment process ?).

Hmm, in messing around with dandelion simulations, I've found 10s to 30s
seems more reasonable for propagation to 95% of the network, though that's
modelled without delays due to latency/low bandwidth, block propagation,
or competition with large/higher value txs.

Shouldn't be hard to estimate that actually: if you setup a node with
-debug=net and -datacarrier=0, then check for blocks with txs with
OP_RETURN outputs, figure out the w/txid and grep your logs for how
far apart. Because you set -datacarrier=0 you won't accept those txs
into your mempool, or announce them to your peers, but your peers will
announce them to you when they receive them, so the time difference
between first and last announcement should give you a decent sampling
of info that you could use to estimate the overall time it takes a tx
to flood through the network.

> On the other hand, you have a full-rbf world, where instead to deploy or
> gain access to "mempools watchdog" and proceed to a timevalue-expensive
> blame assignment protocol, any participant should be able to fee-bump the
> joint transaction (assuming multiple pre-signed feerate version of the
> transactions, or ephemeral, nversion=3 and package-relay to do unilateral
> CPFP).

A full-rbf world doesn't get you that: you can do low fee rate pinning
via other mechanisms than the opt-out flag. In a world where nodes don't
mostly have a consistent mempool policy you introduce new pinning vectors
too; eg, if one of your coinjoin outputs is bare multisig, then that
will pass core's standardness checks, but be rejected by fullrbf knots
nodes that haven't specifically enabled that configuration option.

Even if you assume the attacker doesn't know about those other methods,
or we somehow come up with an eventually consistent mempool/relay policy,
where pinning isn't possible that gets near universal adoption; if you're
only monitoring the blockchain and not the mempool, your hypothetical
attacker can immediately RBF your tx with a higher fee spend of one of
their inputs -- you'll find out about that in the next block, but at one
input per block, that's going to allow you to keep thinking that maybe
one of your peers is honest for 254 blocks instead of 50.

This seems like an argument not to do coinjoins with a ridiculously
large number of untrusted counterparties...

If you really want to salvage the opportunity to have really large
anonymous groups, seems better to quickly say "oops, someone cheated,
let's exclude them, and split the remainder into two groups" until you
either succeed or are down to a more reasonable group size of perhaps
10 or 20.

> [0] "Of course, even assuming full-rbf, propagation of the multi-party
> funded
> transactions can still be interfered with by an attacker, simply
> broadcasting a double-spend with a feerate equivalent to the honest
> transaction. However, it tightens the attack scenario to a scorched earth
> approach, where the attacker has to commit equivalent fee-bumping reserve
> to maintain the pinning and might lose the "competing" fees to miners."

We now know that that isn't correct though: if it really did tighten
the attack scenario like that, that would be great -- but it doesn't:
the attacker can still do low feerate pinning that's not recoverable by
fee bumping the alternative, as Suhas explained elsewhere.

Cheers,
aj



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-11-07 11:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-02  3:52 [bitcoin-dev] Preventing/detecting pinning of jointly funded txs Anthony Towns
2022-11-02 13:46 ` Greg Sanders
2022-11-06 23:22 ` Antoine Riard
2022-11-07 11:46   ` Anthony Towns

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox