From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 10A4CC001A for ; Sat, 26 Feb 2022 05:36:13 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id EC859408DA for ; Sat, 26 Feb 2022 05:36:12 +0000 (UTC) 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 Authentication-Results: smtp4.osuosl.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 25jSUaHiGmGr for ; Sat, 26 Feb 2022 05:36:11 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by smtp4.osuosl.org (Postfix) with ESMTPS id DE0A9408B4 for ; Sat, 26 Feb 2022 05:36:10 +0000 (UTC) Received: by mail-ed1-x529.google.com with SMTP id z22so10146538edd.1 for ; Fri, 25 Feb 2022 21:36:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=6Sc+U9wnFh7r0r+MjyMfJD5rjwUQZshb1DPI2NVj8s0=; b=YhhqfOzdsfQMrsDWI7OeujxQYXHzzvUvwhQSjkJ9Km/GtcGYeSZFQ4X9i5GhyerUfd lXKL/IjrE6V0z7TxNw2caRt5jlDF7eZL7jgff9nuufj9y5WR27fS6rIYxtyyqjVXIOXX 2cO/U/cwOIESPyG3oqAcSMXc7p1PEKVDA1aa0RKro0joe7v9WniYwAzp2wuFcotglD+V /ev6BcDQyb6oATWhOC41+a2yH28JjOg9+do0QWnJjbdK+7EwAMPZzSFmn9z1TF+tQDL+ cycF0b3teKJShOarxxIACib6bSKY6ElF+3/WnO4E639WKUjNO72/HjbpuG60gIRz1FVz uXGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=6Sc+U9wnFh7r0r+MjyMfJD5rjwUQZshb1DPI2NVj8s0=; b=HdBrqkcBfn1llwkg0mNmkHUMxhbejSKFNpsFvubH1Ldrvl8ZM5W7QTwccoF3yepsm8 qqz1xib1Ki73xJdON0iER7/xsCdoP6vqYhkuqfxAuoBYrP5pn8fl8HKXiCUsXRo9/tXD VuOHVTwmSsD9q4lbHBaItcZ4PstT9TpArScl9X433UY932TQeETQgtzjuqqXuyZoLSiN 0okUJ5yBMuYEIDqP3ew2tg+78yBCDl3tJw3Vbo6lLUeZgGdIvC+ULpPGxOjCV3L/wnXr V1dOqQWtFxBY6omZLN5UxOyGmfQlmVGH64BZaYaGuNRHMA2euhaGVtwXmZiGa6GycVw6 T9iw== X-Gm-Message-State: AOAM533nq9R3af6VTqvLYhpjZRbGEInJ6gZATVfRwH6nX4DKxE0R44ta 6T2OLm8rFvTi8ttPDgkaCDjA8HPB8YXmd5rCqS8ihNkU X-Google-Smtp-Source: ABdhPJyUffYY98GdnB0sytSAK33OAMy4JmsWmfhrInq+bY+an+kELIJCqIznGBYaukympN9LzvlYMaeyYWXMPLkEm2g= X-Received: by 2002:a05:6402:35c7:b0:412:f150:420e with SMTP id z7-20020a05640235c700b00412f150420emr10151597edc.63.1645853768695; Fri, 25 Feb 2022 21:36:08 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Billy Tetrud Date: Fri, 25 Feb 2022 23:35:51 -0600 Message-ID: To: Jeremy , Bitcoin Protocol Discussion Content-Type: multipart/alternative; boundary="0000000000003c42c305d8e5315f" X-Mailman-Approved-At: Sat, 26 Feb 2022 08:34:24 +0000 Subject: Re: [bitcoin-dev] Documenting the lifetime of a transaction during mempool congestion from the perspective of a rational user 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: Sat, 26 Feb 2022 05:36:13 -0000 --0000000000003c42c305d8e5315f Content-Type: text/plain; charset="UTF-8" The crux of the type of situation you're talking about is where a source that might revert their payment by rbf double spending sends you money. You mentioned this situation is "not unlikely". What kind of prevalence does this happen with today? Also my question is, if you've been paid by someone like this, what right do you really have to this money? Is the other side buying something from you? No one should be considering something actually bought unless it's got sufficient confirmations. Anyone following that rule isn't losing anything by simply waiting for the transaction to confirm. If the transaction is double spent, who cares? This seems like a situation where adding software and ui complexity is not worth it to reach the maximization you're talking about. It feels more like opportunistic stealing than actual commerce. Maybe it would be a social good to prevent attempted scammers from scamming people, but the only people who would be affected are 0 conf people. And that problem can be solved much more easily and generally (eg by clear messaging around transaction finalization) than by complicating coin selection. On Thu, Jan 13, 2022, 15:07 Jeremy via bitcoin-dev < bitcoin-dev@lists.linuxfoundation.org> wrote: > Devs, > > This email is primarily about existing wallet behaviors and user > preferences, and not about CTV. However, towards the end I will describe > the relevance of CTV, but the email is worth reading even if you have no > interest in CTV as the problems described exist today. > > One point of confusion I've seen while discussing CTV based congestion > control is that it requires a bunch of new wallet software. > > Most of the software requirements that would make CTV work well are things > that either already exist in Bitcoin Core, or are 'bugs' (where bug is > defined as deviation from rational utility maximizing behavior) that should > be fixed *whether or not CTV exists.* > > In this post, I am going to walk through what I expect rational behavior > to be for a not unlikely circumstance. > > First, let's define what rational behavior for a wallet is. A rational > wallet should have a few goals: > > 1) Maximize 'fully trusted' balance (fully confirmed + unconfirmed change > outputs from our own txns) > 2) Process payments requested by the owner within the "urgency budget" > requested by the user. > 3) Maximize "privacy" (this is a vague goal, so we'll largely ignore it > here.). > > Rational wallet behavior may not be possible without metadata. For > example, a rational wallet might prompt the user for things like "how much > do you trust the sender of this payment to not RBF this transaction?", or > "how much do you trust this sender to not double spend you?". For example, > a self-transfer from cold wallet to hot wallet could have a trust score of > 1, whereas a payment from an anonymous source would have a trust score of > 0. Exchanges where you have a legal agreement to not RBF might sit > somewhere in between. Other pieces of exogenous information that could > inform wallet behavior include "has hashrate decreased recently, making > longer reorgs likely". > > In the model above, a user does not request transactions, they request > payments. The rational wallet serves as an agent to assist the user in > completing these payments. For example, if I have a wallet with a single > unconfirmed output, and I spend from it to pay Alice, if the unconfirmed > gets replaced, my wallet should track that it was replaced and prompt me to > re-sign a new transaction. Rational wallets that maximize balance should be > careful to ensure that replaced payments are exclusive, guaranteed either > through sufficient confirmations or 'impossibility proofs' by reusing an > input (preventing double-send behavior). > > ----------------------------- > > Now that we've sketched out a basic framework for what a rational wallet > should be doing, we can describe what the process of receiving a payment is. > > Suppose I have a wallet with a bevy of fully confirmed coins such that for > my future payments I am sufficiently funded. > > Then, I receive a payment from a highly trusted source (e.g., self > transfer) that is unconfirmed. > > I then seek to make an outgoing payment. I should have no preference > towards or against spending the unconfirmed transfer, I should simply > account for it's cost in coin selection of CPFP-ing the parent transaction. > If fees are presently historically low, I may have a preference to spend it > so as to not have a higher fee later (consolidation). > > Later, I receive payment from an untrusted source (e.g., an anonymous > donation to me). I have no reason to trust this won't be double spent. > Perhaps I can even observe that this output has been RBF'd many times > previously. I do not count on this money arriving. The feerate on the > transaction suggests it won't be confirmed immediately. > > In order to maximize balance, I should prioritize spending from this > output (even if I don't have a payment I desire to make) in order to CPFP > it to the top of the mempool and guarantee I am paid. This is inherently > "free" since my cost to CPFP would be checked to be lower than the funds I > am receiving, and I have no expected value to receive the payment if it is > not confirmed. If I do have a transaction I desire to do, I should > prioritize spending this output at that time. If not, I would do a CPFP > just in favor of balance maximizing. Perhaps I can piggyback something > useful, like speculatively opening a lightning channel. > > If I just self-spend to CPFP, it is very simple since the only party set > up for disappointment is myself (note: I patched the behavior in this case > to accurately *not* count this as a trusted balance in > https://github.com/bitcoin/bitcoin/pull/16766, since a parent could > disrupt this). However, if I try to make a payment, my wallet agent must > somehow prompt me to re-sign or automatically sign an alternative payment > once it is proven (e.g. 6 blocks) I won't receive the output, or to re-sign > on a mutually exclusive output (e.g., fee bumping RBF) such that issuing > two payments will not causes a double-send error. This adds complexity to > both the user story and logic, but is still rational. > > Now, suppose that I receive a new payment from a **trusted** source that > is a part of a "long chain". A long chain is a series of transactions that > are all unconfirmed in the mempool. This long-chain is in the bottom of the > mempool, and is not expected to confirm any time soon. > > My wallet should be configured such that it saves not only all ancestors > of the transaction paying me, but also all descendants of the root > unconfirmed transaction paying me. If I do not save all ancestor > transactions, then it would be impossible for me to claim this payment at a > future date, and would violate balance maximization. But why save > descendants, if they do not concern me? Descendant transactions are > critical for balance maximization. Someone else's spend of an output is a > "free" CPFP subsidy for driving my transaction to completion (perhaps > "descendants that increase the feerate of any parent" is the correct thing > to save). Therefore if I want to maximize balance, I would rather keep > these transactions around should I ever need to rebroadcast the > transactions as it should be cheaper than having to CPFP by myself. > > Now, suppose that I receive a similar payment in a longchain from a series > of untrusted sources. The same arguments apply, but now I may have even > higher incentive to prioritize spending this coin since, if sender's trust > scores are independent, my total trust in that payment is decomposed > worst-case geometrically. It may not be a good assumption that trust scores > are independent, since a long chain might be generated as e.g. a series of > batch payments from one service provider. > > Briefly mentioned above is rebroadcasting. This is sort of an orthogonal > behavior to the above, but it is "simple" to explain. Wallet agents should > retransmit txns to the network if they believe other nodes are not aware of > them and they are likely to go into a block. This encapsulates personal > transactions as well as arbitrary transactions from third parties. There > are many privacy implications of rebroadcasting that are out of scope for > this post. > > ----------------- > > All of the behaviors documented above are things that should happen today > if you would like to have a rational wallet that maximizes your balance and > makes payments. > > The reasons we don't do some of these things are, as far as I can tell: > > 1) Engineering Complexity > 2) UX Complexity (simpler to make unconfirmed outputs "unspendable" to > minimize transaction reissuing) > 3) Mempool backlog is low, things are confirmed quickly if a sender pays a > relatively low fee > > Certain wallets already have parts of this functionality baked in to an > extent. For example, in Lightning Channels, you will drive payments to > completion to prevent HTLC timeouts during contested closes (HTLCs == low > trust score payments). > > Should Bitcoin see development of a more robust fee market, it is highly > likely the rational behaviors described above would be emergent among all > bitcoin wallets (who would want to use a Bitcoin wallet that gets you less > money over time?). This email is not just a "Bitcoin Core" thing, hence not > being an issue on Bitcoin Core where there are currently deviations from > the above behaviors. > > ----------------- > > What's CTV got to do with it? > > A common critique of congestion control using CTV is that it complicates > wallet behavior because congestion control is designed to be useful in the > circumstances above. CTV and congestion control do not cause these > conditions. These conditions already exist whether or not we have > congestion control. > > Where congestion control helps is that, in a world with a full mempool, > you have fewer payments that are *actually* unconfirmed because exchanges > that batch can fully confirm a constant sized root transaction and the > sub-trees of transactions locked in by CTV can be treated as fully trusted. > This helps reduce the need for the (rational) behavior of CPFP bumping your > own payments on receipt from lower trust senders. Further, the expansion of > the transaction tree can be done by other users receiving, so you have an > incentive to wait for funds to mature as someone else might pay for > expansion. These two factors mean that CTV congestion control can exert a > dramatic back pressure on transaction urgency by unbundling the blockspace > demand for spending and receiving coins. There are other synergies -- such > as non-interactive channel opens -- that further improve the amount of > reduction of time-preference in full on-chain resolution. > > I hope this email helps clarify why CTV Congestion Control isn't > particularly creating a wallet architecture problem, it's helping to solve > an existing one. > > Best, > > Jeremy > > > > -- > @JeremyRubin > > _______________________________________________ > bitcoin-dev mailing list > bitcoin-dev@lists.linuxfoundation.org > https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev > --0000000000003c42c305d8e5315f Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
The crux of the type of situation you= 9;re talking about is where a source that might revert their payment by rbf= double spending sends you money. You mentioned this situation is "not= unlikely". What kind of prevalence does this happen with today?

Also my question is, if you've = been paid by someone like this, what right do you really have to this money= ? Is the other side buying something from you? No one should be considering= something actually bought unless it's got sufficient confirmations. An= yone following that rule isn't losing anything by simply waiting for th= e transaction to confirm. If the transaction is double spent, who cares?=C2= =A0

This seems like a si= tuation where adding software and ui complexity is not worth it to reach th= e maximization you're talking about. It feels more like opportunistic s= tealing than actual commerce. Maybe it would be a social good to prevent at= tempted scammers from scamming people, but the only people who would be aff= ected are 0 conf people. And that problem can be solved much more easily an= d generally (eg by clear messaging around transaction finalization) than by= complicating coin selection.=C2=A0=C2=A0

On Thu, Jan 13, 2022= , 15:07 Jeremy via bitcoin-dev <bitcoin-dev@lists.linuxfoundation.org> wrote:
Devs,

This em= ail is primarily about existing wallet behaviors and user preferences, and = not about CTV. However, towards the end I will describe the relevance of CT= V, but the email is worth reading even if you have no interest in CTV as th= e problems described exist today.

One point of confusion I= 9;ve seen while discussing CTV based congestion control is that it requires= a bunch of new wallet software.
<= br>
Most of the software requireme= nts that would make CTV work well are things that either already exist in B= itcoin Core, or are 'bugs' (where bug is defined as deviation from = rational utility maximizing behavior) that should be fixed whether or no= t CTV exists.

In this post, I am going to walk throu= gh what I expect rational behavior to be for a not unlikely circumstance.

First, let's define what rational behavior for a wallet is. = A rational wallet should have a few goals:

1) Maximize 'ful= ly trusted' balance (fully confirmed=C2=A0+ unconfirmed change outputs = from our own txns)
2) Process paym= ents requested by the owner within the "urgency budget" requested= by the user.
3) Maximize "pr= ivacy" (this is a vague goal, so we'll largely ignore it here.).

Rational wallet behavior may not be possible without metadata. F= or example, a rational wallet might prompt the user for things like "h= ow much do you trust the sender of this payment to not RBF this transaction= ?", or "how much do you trust this sender to not double=C2=A0spen= d you?". For example, a self-transfer from cold wallet to hot wallet c= ould have a trust score of 1, whereas a payment from an anonymous source wo= uld have a trust score of 0. Exchanges where you have a legal agreement to = not RBF might sit somewhere in between. Other pieces of exogenous informati= on that could inform wallet behavior include "has hashrate decreased r= ecently, making longer reorgs likely".

In the model above,= a user does not request transactions, they request payments. The rational = wallet serves as an agent to assist the user in completing these payments. = For example, if I have a wallet with a single unconfirmed output, and I spe= nd from it to pay Alice, if the unconfirmed gets replaced, my wallet should= track that it was replaced and prompt me to re-sign a new transaction. Rat= ional wallets that maximize balance should be careful to ensure that replac= ed payments are exclusive, guaranteed either through sufficient confirmatio= ns or 'impossibility proofs' by reusing an input (preventing double= -send behavior).

-----------------------------

Now= that we've sketched out a basic framework for what a rational wallet s= hould be doing, we can describe what the process of receiving a payment is.=

Suppose I have a wallet with a bevy of fully confirmed coins s= uch that for my future payments I am sufficiently funded.

The= n, I receive a payment from a highly trusted source (e.g., self transfer) t= hat is unconfirmed.

I then seek to make an outgoing payment. I = should have no preference towards or against spending the unconfirmed trans= fer, I should simply account for it's cost in coin selection of CPFP-in= g the parent transaction. If fees are presently historically low, I may hav= e a preference to spend it so as to not have a higher fee later (consolidat= ion).

Later, I receive=C2=A0payment from an untrusted source (e= .g., an anonymous donation to me). I have no reason to trust this won't= be double spent. Perhaps I can even observe that this output has been RBF&= #39;d many times previously. I do not count on this money arriving. The fee= rate on the transaction suggests it won't be confirmed immediately.

In order to maximize balance, I should prioritize spending from th= is output (even if I don't have a payment I desire to make) in order to= CPFP it to the top of the mempool and guarantee I am paid. This is inheren= tly "free" since my cost to CPFP would be checked to be lower tha= n the funds I am receiving, and I have no expected value to receive the pay= ment if it is not confirmed. If I do have a transaction I desire to do, I s= hould prioritize spending this output at that time. If not, I would do a CP= FP just in favor of balance maximizing. Perhaps I can piggyback something u= seful, like speculatively opening a lightning channel.

If I jus= t self-spend to CPFP, it is very simple since the only party set up for dis= appointment is myself (note: I patched the behavior in this case to accurat= ely *not* count this as a trusted balance in=C2=A0https= ://github.com/bitcoin/bitcoin/pull/16766, since a parent could disrupt = this). However, if I try to make a payment, my wallet agent must somehow pr= ompt me to re-sign or automatically sign an alternative payment once it is = proven (e.g. 6 blocks) I won't receive the output, or to re-sign on a m= utually exclusive output (e.g., fee bumping RBF) such that issuing two paym= ents will not causes a double-send error. This adds complexity to both the = user story and logic, but is still rational.=C2=A0

Now, suppose= that I receive a new payment from =C2=A0a *trusted* source that is = a part of a "long chain". A long chain is a series of transaction= s that are all unconfirmed in the mempool. This long-chain is in the bottom= of the mempool, and is not expected to confirm any time soon.

My wallet should be configured such that it saves not only all ancestors = of the transaction paying me, but also all descendants of the root unconfir= med transaction paying me. If I do not save all ancestor transactions, then= it would be impossible for me to claim this payment at a future date, and = would violate balance maximization. But why save descendants, if they do no= t concern me? Descendant transactions are critical for balance maximization= . Someone else's spend of an output is a "free" CPFP subsidy = for driving my transaction to completion (perhaps "descendants that in= crease the feerate of any parent" is the correct thing to save). There= fore if I want to maximize balance, I would rather keep these transactions = around should I ever need to rebroadcast the transactions as it should be c= heaper than having to CPFP by myself.

Now, suppose that I recei= ve a similar payment in a longchain from a series of untrusted sources. The= same arguments apply, but now I may have even higher incentive to prioriti= ze spending this coin since, if sender's trust scores are independent, = my total trust in that payment is decomposed worst-case geometrically. It m= ay not be a good assumption that trust scores are independent, since a long= chain might be generated as e.g. a series of batch payments from one servi= ce provider.

Briefly mentioned above is rebroadcasting. This i= s sort of an orthogonal behavior to the above, but it is "simple"= to explain. Wallet agents should retransmit txns to the network if they be= lieve other nodes are not aware of them and they are likely to go into a bl= ock. This encapsulates personal transactions as well as arbitrary transacti= ons from third parties. There are many privacy implications of rebroadcasti= ng that are out of scope for this post.

-----------------
=

All of the behaviors documented above are things that should happen = today if you would like to have a rational wallet that maximizes your balan= ce and makes payments.

<= div class=3D"gmail_default" style=3D"font-family:arial,helvetica,sans-serif= ;font-size:small;color:rgb(0,0,0)">The reasons we don't do some of thes= e things are, as far as I can tell:

1) Engineering Complexity
2) UX Complexity (simpler to make u= nconfirmed outputs "unspendable" to minimize transaction reissuin= g)
3) Mempool backlog is low, thin= gs are confirmed quickly if a sender pays a relatively low fee

Certain wallets already have parts of this functionality baked in to an e= xtent. For example, in Lightning Channels, you will drive payments to compl= etion to prevent HTLC timeouts during contested closes (HTLCs =3D=3D low tr= ust score payments).

Should Bitcoin see development of a more r= obust fee market, it is highly likely the rational behaviors described abov= e would be emergent among all bitcoin wallets (who would want to use a Bitc= oin wallet that gets you less money over time?). This email is not just a &= quot;Bitcoin Core" thing, hence not being an issue on Bitcoin Core whe= re there are currently deviations from the above behaviors.

---= --------------

What's CTV got to do with it?

A = common critique of congestion control using CTV is that it complicates wall= et behavior because congestion control is designed to be useful in the circ= umstances above. CTV and congestion control do not cause these conditions. = These conditions already exist whether or not we have congestion control.

Where congestion control helps is that, in a world with a full m= empool, you have fewer payments that are *actually* unconfirmed because exc= hanges that batch can fully confirm a constant sized root transaction and t= he sub-trees of transactions locked in by CTV can be treated as fully trust= ed. This helps reduce the need for the (rational) behavior of CPFP bumping = your own payments on receipt from lower trust senders. Further, the expansi= on of the transaction tree can be done by other users receiving, so you hav= e an incentive to wait for funds to mature as someone else might pay for ex= pansion. These two factors mean that CTV congestion control can exert a dra= matic back pressure on transaction urgency by unbundling the blockspace dem= and for spending and receiving coins. There are other synergies -- such as = non-interactive channel opens -- that further improve the amount of reducti= on of time-preference in full on-chain resolution.

I hope this = email helps clarify why CTV Congestion Control isn't particularly creat= ing a wallet architecture problem, it's helping to solve an existing on= e.

Best,

Jeremy



_______________________________________________
bitcoin-dev mailing list
bitcoin-dev@lists.linuxfoundation.org
https://lists.linuxfoundati= on.org/mailman/listinfo/bitcoin-dev
--0000000000003c42c305d8e5315f--