Return-Path: Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 695F6C002D for ; Wed, 2 Nov 2022 13:46:39 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 51BE160A7E for ; Wed, 2 Nov 2022 13:46:39 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 51BE160A7E Authentication-Results: smtp3.osuosl.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=OdWc+xxF X-Virus-Scanned: amavisd-new at osuosl.org X-Spam-Flag: NO X-Spam-Score: -1.847 X-Spam-Level: X-Spam-Status: No, score=-1.847 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_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, LOTS_OF_MONEY=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id k-RqhqmC8oQF for ; Wed, 2 Nov 2022 13:46:37 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 5A87A607B0 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by smtp3.osuosl.org (Postfix) with ESMTPS id 5A87A607B0 for ; Wed, 2 Nov 2022 13:46:37 +0000 (UTC) Received: by mail-ed1-x529.google.com with SMTP id r14so26528067edc.7 for ; Wed, 02 Nov 2022 06:46:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=PdMO9oZilJggrkv3CYONW3lCGMI7o5OOTtSxBdhXcwY=; b=OdWc+xxFuEZROyxYy/W5yeV3sXampjltdeAUmVOzkZBJOt9/cLW+jaiF0eQstOzcYj fjSvPtLyldQ/aIPOB+sVuEhj/w+3eViVWcmbMOGZh3IC/OtVEi+BT1poyhsrRqFNvQzP 0vY5b/6C3HYwl0xol6pwYbkz0odGJMT89IsnxwIvLUMBWvEFpZ+LB5nT74S5Rl9Yh9lB THqrTTy/DyOymS7By8hpjJ/ROH0OiJ1p+I5Ih0pLFYSW+NrZFVaZfenlvnf5aOJRDoV6 XvdfNoJUSWinxJ6OBfxo7telPHHYHGZ71vgl+qT1GY/b5UW76uG7KhgnIBXQYCQjRj4I mGwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc: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=PdMO9oZilJggrkv3CYONW3lCGMI7o5OOTtSxBdhXcwY=; b=AY6i8nKaGQOhJrBw1HoWegq18iUgnYtZ/rcHC6VoqBwsl12YhXQqDNj1EIJCaLyObk R+C2Dnx8Z9CACgQcFRWBNZwNpoXvEpDiH/YKmjRhI3Ykr92N5faYaSxDLIxDta9C0PeH v+pJgGUUhGGuTjTCAiSKsuWYfiot1VvdQj1e9wOc2Sa6EqFdy947jFOls9YCjV/UN/9w oVG45KVduPRaTeLz/RKuNQtyDrXPDsvChfxQMP7MdmnuJUSlNpZkAa0GhPPrw/hDMwdH Je3FHTdSJf/3b3WKyaOxWOSgf8jcKuWhPtWvHGXgv/pz+L71qQF34fmxCL2H+F0vZphy W2ww== X-Gm-Message-State: ACrzQf1JSOMMFE9AWXCj23SO5yHrKkbyWgiL7ZT0Ljhm66M5jrtpuEW6 +re8rL1CNqFHXn009YFajK0LbiOp6paNAj9Bi2Q= X-Google-Smtp-Source: AMsMyM4Us18ExR8rz+R3XFU75+cE9nPHoo3CqDwalvyxt3YegR8YyUBeF/TubyRX8in54KyrC4FK035VVNQdJqJYAEg= X-Received: by 2002:a50:cd07:0:b0:464:63b:1017 with SMTP id z7-20020a50cd07000000b00464063b1017mr2639164edi.364.1667396795307; Wed, 02 Nov 2022 06:46:35 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Greg Sanders Date: Wed, 2 Nov 2022 09:46:24 -0400 Message-ID: To: Anthony Towns , Bitcoin Protocol Discussion Content-Type: multipart/alternative; boundary="000000000000af1b4b05ec7d115c" Cc: John Carvalho Subject: Re: [bitcoin-dev] Preventing/detecting pinning of jointly funded txs 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, 02 Nov 2022 13:46:39 -0000 --000000000000af1b4b05ec7d115c Content-Type: text/plain; charset="UTF-8" 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 > --000000000000af1b4b05ec7d115c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Assigning blame here seems to be the paramount concern her= e. If we can assign blame, most coinjoin-like protocols can terminate in bo= unded block time, assuming fees are properly set.

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

For dual funding LN channels, that number is pre= tty small(2), so I suspect the DoS concerns are fairly subtle. Might be wor= th talking to CLN/Eclair/Other LN teams that are working through those subt= leties as we speak.

Greg

On Tue, Nov 1, 2022 = at 11:52 PM Anthony Towns via bitcoin-dev <bitcoin-dev@lists.linuxfoundation.org> w= rote:
On Fri, Oc= t 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.l= inuxfoundation.org/pipermail/bitcoin-dev/2022-October/021124.html

So, having a go at answering my own question.

I think ultimately the scenario here is:

=C2=A0* you have a joint funding protocol, where everyone says "here&#= 39;s
=C2=A0 =C2=A0an unspent utxo that will be my contribution", collaborat= es on signing
=C2=A0 =C2=A0a transaction spending all those utxos, and then broadcasts it=

=C2=A0* everyone jointly agrees to pay some amount in fees for that
=C2=A0 =C2=A0transaction, targeting confirmation within N blocks

=C2=A0* the goal is to have the transaction confirm, obviously; but it'= s also
=C2=A0 =C2=A0acceptable to discover a conflicting transaction, as that will=
=C2=A0 =C2=A0demonstrate that a particular participant has been dishonest (= their
=C2=A0 =C2=A0utxo was not "unspent"), allowing the overall protoc= ol 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&#= 39;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 fin= d
out what that is and can go from there.

(If you don't see either your tx, or a conflicting one, then it likely<= br> means the nodes that broadcasted your tx are being sybil attacked, either because their peers are directly controlled by an attacker, or they've<= br> 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 gi= ves 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&= #39;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:<= br> connect to new peers, reannounce T, and see what happens.=C2=A0 Then eventu= ally
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.=C2=A0 But in t= hat 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= 9;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.=C2=A0 Unfortunately tha= t
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'r= e
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:

=C2=A0- if you really want to do things with untrusted peers in bitcoin, =C2=A0 =C2=A0investing in hashpower maybe isn't that unreasonable a thi= ng to
=C2=A0 =C2=A0do. $10M in capital giving you the ability to usually make pro= gress
=C2=A0 =C2=A0within a day even if everyone else dislikes you? surprisingly<= br> =C2=A0 =C2=A0reasonable, especially if more progress is made on stratumv2..= .

=C2=A0- if you don't care about privacy (eg, you're funding a light= ning
=C2=A0 =C2=A0channel that's going to be gossiped anyway), just query an= explorer
=C2=A0 =C2=A0(or some other centralised service) to find out the conflictin= g tx
=C2=A0 =C2=A0and go from there.

=C2=A0- if you do care about privacy, run a few "anonymous" bitco= ind nodes
=C2=A0 =C2=A0that don't announce transactions, and see what their mempo= ol
=C2=A0 =C2=A0contains.

=C2=A0- we can probably make it easier to run anonymous bitcoind nodes
=C2=A0 =C2=A0by making transaction broadcasts more private (tor/i2p? dandel= ion? have
=C2=A0 =C2=A0lightning nodes send channel open/close txs to another lightni= ng
=C2=A0 =C2=A0node to announce to bitcoin p2p?) -- for cases where you'r= e already
=C2=A0 =C2=A0running a bitcoin node 24/7 (or trusting someone else that doe= s), I
=C2=A0 =C2=A0think that gives you a pretty good method of either being conf= ident
=C2=A0 =C2=A0your tx made it to a decent percentage of hashrate, or spottin= g a
=C2=A0 =C2=A0conflicting 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/mail= man/listinfo/bitcoin-dev
--000000000000af1b4b05ec7d115c--