<oembed><type>rich</type><version>1.0</version><title>Jeremy Rubin [ARCHIVE] wrote</title><author_name>Jeremy Rubin [ARCHIVE] (npub1xu…fzef0)</author_name><author_url>https://yabu.me/npub1xukrzempxc95ags094lgrfvnvwm7gkuwj3d98qwrzgsynskyhp9qkfzef0</author_url><provider_name>njump</provider_name><provider_url>https://yabu.me</provider_url><html>📅 Original date posted:2022-03-13&#xA;📝 Original message:Hi Antoine,&#xA;&#xA;I have a few high level thoughts on your post comparing these types of&#xA;primitive to an explicit soft fork approach:&#xA;&#xA;1) Transaction sponsors *is* a type of covenant. Precisely, it is very&#xA;similar to an &#34;Impossible Input&#34; covenant in conjunction with a &#34;IUTXO&#34; I&#xA;defined in my 2017 workshop&#xA;https://rubin.io/public/pdfs/multi-txn-contracts.pdf (I know, I know...&#xA;self citation, not cool, but helps with context).&#xA;&#xA;However, for Sponsors itself we optimize the properties of how it works &amp;&#xA;is represented, as well as &#34;tighten the hatches&#34; on binding to specific TX&#xA;vs merely spend of the outputs (which wouldn&#39;t work as well with APO).&#xA;&#xA;Perhaps thinking of something like sponsors as a form of covenant, rather&#xA;than a special purpose thing, is helpful?&#xA;&#xA;There&#39;s a lot you could do with a general &#34;observe other txns in {this&#xA;block, the chain}&#34; primitive. The catch is that for sponsors we don&#39;t&#xA;*care* to enable people to use this as a &#34;smart contracting primitive&#34;, we&#xA;want to use it for fee bumping. So we don&#39;t care about programmability, we&#xA;care about being able to use the covenant to bump fees.&#xA;&#xA;2) On Chain Efficiency.&#xA;&#xA;&#xA;A) Precommitted Levels&#xA;As you&#39;ve noted, an approach like precomitted different fee levels might&#xA;work, but has substantial costs.&#xA;&#xA;However, with sponsors, the minimum viable version of this (not quite what&#xA;is spec&#39;d in my prior email, but it could be done this way if we care to&#xA;optimize for bytes) would require 1 in and 1 out with only 32 bytes extra.&#xA;So that&#39;s around 40 bytes outpoint + 64 bytes signature + 40 bytes output +&#xA;32 bytes metadata = 174 bytes per bump. Bumps in this way can also&#xA;amortize, so bumping &gt;1 txn at the same time would hit the limit of 32&#xA;bytes + 144/n  bytes to bump more than one thing. You can imagine cases&#xA;where this might be popular, like &#34;close &gt;1 of my LN channels&#34; or &#34;start&#xA;withdrawals for 5 of my JamesOB vaulted coins&#34;&#xA;&#xA;B) Fancy(er) Covenants&#xA;&#xA;We might also have something with OP_CAT and CSFS where bumps are done as&#xA;some sort of covenant-y thing that lets you arbitrarily rewrite&#xA;transactions.&#xA;&#xA;Not too much to say other than that it is difficult to get these down in&#xA;size as the scripts become more complex, not to mention the (hotly&#xA;discussed of late) ramifications of those covenants more generally.&#xA;&#xA;Absent a concrete fancy covenant with fee bumping, I can&#39;t comment.&#xA;&#xA;3) On Capital Efficiency&#xA;&#xA;Something like a precommitted or covenant fee bump requires the fee capital&#xA;to be pre-committed inside the UTXO, whereas for something like Sponsors&#xA;you can use capital you get sometime later. In certain models -- e.g.,&#xA;channels -- where you might expect only log(N) of your channels to fail in&#xA;a given epoch, you don&#39;t need to allocate as much capital as if you were to&#xA;have to do it in-band. This is also true for vaults where you know you only&#xA;want to open 1 per month let&#39;s say, and not &lt;all of your vaults&gt; per month,&#xA;which pre-committing requires.&#xA;&#xA;4) On Protocol Design&#xA;&#xA;It&#39;s nice that you can abstract away your protocol design concerns as a&#xA;&#34;second tier composition check&#34; v.s. having to modify your protocol to work&#xA;with a fee bumping thing.&#xA;&#xA;There are a myriad of ways dynamic txns (e.g. for Eltoo) can lead to RBF&#xA;pinning and similar, Sponsor type things allow you to design such protocols&#xA;to not have any native way of paying for fees inside the actual&#xA;&#34;Transaction Intents&#34; and use an external system to create the intended&#xA;effect. It seems (to me) more robust that we can prove that a Sponsors&#xA;mechanism allows any transaction -- regardless of covenant stuff, bugs,&#xA;pinning, etc -- to move forward.&#xA;&#xA;Still... careful protocol design may permit the use of optimized&#xA;constructions! For example, in a vault rather than assigning *no fee* maybe&#xA;you can have a single branch with a reasonable estimated fee. If you are&#xA;correct or overshot (let&#39;s say 50% chance?) then you don&#39;t need to add a&#xA;sponsor. If you undershot, not to worry, just add a sponsor. Adopted&#xA;broadly, this would cut the expected value of using sponsors by &lt;however&#xA;good you are at estimating future fees&gt;. This basically enables all&#xA;protocols to try to be more efficient, but backstop that with a guaranteed&#xA;to work safe mechanism.&#xA;&#xA;&#xA;&#xA;There was something else I was going to say but I forgot about it... if it&#xA;comes to me I&#39;ll send a follow up email.&#xA;&#xA;Cheers,&#xA;&#xA;Jeremy&#xA;&#xA;p.s.&#xA;&#xA;&gt;&#xA;&#xA;&#xA;&gt; *Of course this makes for a perfect DoS: it would be trivial for a miner&#xA;&gt; to infer that you are using*&#xA;&gt; *a specific vault standard and guess other leaves and replace the witness&#xA;&gt; to use the highest-feerate*&#xA;&gt; *spending path. You could require a signature from any of the&#xA;&gt; participants. Or, at the cost of an**additional depth, in the tree you&#xA;&gt; could &#34;salt&#34; each leaf by pairing it with -say- an OP_RETURN leaf.*&#xA;&#xA;&#xA;&#xA;you don&#39;t need a salt, you just need a unique payout addr (e.g. hardened&#xA;derivation) per revocation txn and you cannot guess the branch.&#xA;&#xA;--&#xA;@JeremyRubin &lt;https://twitter.com/JeremyRubin&gt;&#xA;&#xA;On Sat, Mar 12, 2022 at 10:34 AM darosior via bitcoin-dev &lt;&#xA;bitcoin-dev at lists.linuxfoundation.org&gt; wrote:&#xA;&#xA;&gt; The idea of a soft fork to fix dynamic fee bumping was recently put back&#xA;&gt; on the table. It might&#xA;&gt; sound radical, as what prevents today reasonable fee bumping for contracts&#xA;&gt; with presigned&#xA;&gt; transactions (pinning) has to do with nodes&#39; relay policy. But the&#xA;&gt; frustration is understandable&#xA;&gt; given the complexity of designing fee bumping with today&#39;s primitives. [0]&#xA;&gt; Recently too, there was a lot of discussions around covenants. Covenants&#xA;&gt; (conceptually, not talking&#xA;&gt; about any specific proposal) seem to open lots of new use cases and to be&#xA;&gt; desired by (some?) Bitcoin&#xA;&gt; application developers and users.&#xA;&gt; I think that fee bumping using covenants has attractive properties, and it&#xA;&gt; requires a soft fork that&#xA;&gt; is already desirable beyond (trying) to fix fee bumping. However i could&#xA;&gt; not come up with a solution&#xA;&gt; as neat for other protocols than vaults. I&#39;d like to hear from others&#xA;&gt; about 1) taking this route for&#xA;&gt; fee bumping 2) better ideas on applying this to other protocols.&#xA;&gt;&#xA;&gt;&#xA;&gt; In a vault construction you have a UTxO which can only be spent by an&#xA;&gt; Unvaulting transaction, whose&#xA;&gt; output triggers a timelock before the expiration of which a revocation&#xA;&gt; transaction may be confirmed.&#xA;&gt; The revocation transaction being signed in advance (typically before&#xA;&gt; sharing the signature for the&#xA;&gt; Unvault transaction) you need fee bumping in order for the contract to&#xA;&gt; actually be enforceable.&#xA;&gt;&#xA;&gt; Now, with a covenant you could commit to the revocation tx instead of&#xA;&gt; presigning it. And using a&#xA;&gt; Taproot tree you could commit to different versions of it with increasing&#xA;&gt; feerate. Any network&#xA;&gt; monitor (the brooadcaster, a watchtower, ..) would be able to RBF the&#xA;&gt; revocation transaction if it&#xA;&gt; doesn&#39;t confirm by spending using a leaf with a higher-feerate transaction&#xA;&gt; being committed to.&#xA;&gt;&#xA;&gt; Of course this makes for a perfect DoS: it would be trivial for a miner to&#xA;&gt; infer that you are using&#xA;&gt; a specific vault standard and guess other leaves and replace the witness&#xA;&gt; to use the highest-feerate&#xA;&gt; spending path. You could require a signature from any of the participants.&#xA;&gt; Or, at the cost of an&#xA;&gt; additional depth, in the tree you could &#34;salt&#34; each leaf by pairing it&#xA;&gt; with -say- an OP_RETURN leaf.&#xA;&gt; But this leaves you with a possible internal blackmail for multi-party&#xA;&gt; contracts (although it&#39;s less&#xA;&gt; of an issue for vaults, and not one for single-party vaults).&#xA;&gt; What you could do instead is attaching an increasing relative timelock to&#xA;&gt; each leaf (as the committed&#xA;&gt; revocation feerate increases, so does the timelock). You need to be&#xA;&gt; careful to note wreck miner&#xA;&gt; incentives here (see [0], [1], [2] on &#34;miner harvesting&#34;), but this&#xA;&gt; enables the nice property of a&#xA;&gt; feerate which &#34;adapts&#34; to the block space market. Another nice property of&#xA;&gt; this approach is the&#xA;&gt; integrated anti fee sniping protection if the revocation transaction pays&#xA;&gt; a non-trivial amount of&#xA;&gt; fees.&#xA;&gt;&#xA;&gt; Paying fees from &#34;shared&#34; funds instead of a per-watchtower fee-bumping&#xA;&gt; wallet opened up the&#xA;&gt; blackmail from the previous section, but the benefits of paying from&#xA;&gt; internal funds shouldn&#39;t be&#xA;&gt; understated.&#xA;&gt; No need to decide on an amount to be refilled. No need to bother the user&#xA;&gt; to refill the fee-bumping&#xA;&gt; wallet (before they can participate in more contracts, or worse before a&#xA;&gt; deadline at which all&#xA;&gt; contracts are closed). No need for a potentially large amount of funds to&#xA;&gt; just sit on a hot wallet&#xA;&gt; &#34;just in case&#34;. No need to duplicate this amount as you replicate the&#xA;&gt; number of network monitors&#xA;&gt; (which is critical to the security of such contracts).&#xA;&gt; In addition, note how modifying the feerate of the revocation transaction&#xA;&gt; in place is less expensive&#xA;&gt; than adding a (pair of) new input (and output), let alone adding an entire&#xA;&gt; new transaction to CPFP.&#xA;&gt; Aside, and less importantly, it can be made to work with today&#39;s relay&#xA;&gt; rules (just use fee thresholds&#xA;&gt; adapted to the current RBF thresholds, potentially with some leeway to&#xA;&gt; account for policy changes).&#xA;&gt; Paying from shared funds (in addition to paying from internal funds) also&#xA;&gt; prevents pervert&#xA;&gt; incentives for contracts with more than 2 parties. In case one of the&#xA;&gt; parties breaches it, all&#xA;&gt; remaining parties have an incentive to enforce the contract.. But only one&#xA;&gt; would otherwise pay for&#xA;&gt; it! It would open up the door to some potential sneaky techniques to wait&#xA;&gt; for another party to pay&#xA;&gt; for the fees, which is at odd with the reactive security model.&#xA;&gt;&#xA;&gt; Let&#39;s examine how it could be concretely designed. Say you have a vault&#xA;&gt; wallet software for a setup&#xA;&gt; with 5 participants. The revocation delay is 144 blocks. You assume&#xA;&gt; revocation to be infrequent (if&#xA;&gt; one happens it&#39;s probably a misconfigured watchtower that needs be fixed&#xA;&gt; before the next&#xA;&gt; unvaulting), so you can afford infrequent overpayments and larger fee&#xA;&gt; thresholds. Participants&#xA;&gt; assume the vault will be spent within a year and assume a maximum possible&#xA;&gt; feerate for this year of&#xA;&gt; 10ksat/vb.&#xA;&gt; They create a Taproot tree of depth 7. First leaf is the spending path&#xA;&gt; (open to whomever the vault&#xA;&gt; pays after the 144 blocks). Then the leaf `i` for `i` in `[1, 127]` is a&#xA;&gt; covenant to the revocation&#xA;&gt; transaction with a feerate `i * 79` sats/vb and a relative timelock of `i&#xA;&gt; - 1` blocks.&#xA;&gt; Assuming the covenant to the revocation transaction is 33 bytes [3],&#xA;&gt; that&#39;s a witness of:&#xA;&gt;     1 + 33     + 1 + 33 + 7 * 32 = 292 WU (73 vb)&#xA;&gt;     ^^^^^^       ^^^^^^^^^^^^^^&#xA;&gt;     witscript     control block&#xA;&gt; for any of the revocation paths. The revocation transaction is 1-input&#xA;&gt; 1-output, so in total it&#39;s&#xA;&gt;     10.5 +   41 + 73      + 43    = 167.5 vb&#xA;&gt;     ^^^^    ^^^^^^^^^^^    ^^^^&#xA;&gt;     header  input|witness  output&#xA;&gt; The transaction size is not what you&#39;d necessarily want to optimize for&#xA;&gt; first, still, it is smaller&#xA;&gt; in this case than using other feebumping primitives and has a smaller&#xA;&gt; footprint on the UTxO set. For&#xA;&gt; instance for adding a feebumping input and change output assuming all&#xA;&gt; Taproot inputs and outputs&#xA;&gt; (CPFP is necessarily even larger):&#xA;&gt;     5 * 64 +  1 + 5 * (32 + 1) + 1 + 33 = 520 WU (105 vb)&#xA;&gt;     ^^^^^^    ^^^^^^^^^^^^^^^    ^^^^^^&#xA;&gt;     witness      witscript       control&#xA;&gt;     10.5  +  41 + 105      + 41 + 16.5         + 2 * 43  = 300 vb&#xA;&gt;     ^^^^     ^^^^^^^^        ^^^^^^^^^           ^^^^^^&#xA;&gt;     header   input|witness   fb input|witness    outputs&#xA;&gt; From there, you can afford more depths at the tiny cost of 8 more vbytes&#xA;&gt; each. You might want them&#xA;&gt; for:&#xA;&gt; - more granularity (if you can afford large enough timelocks)&#xA;&gt; - optimizing for the spending path rather than the revocation one&#xA;&gt; - adding a hashlock to prevent nuisance (with the above script a third&#xA;&gt; party could malleate a&#xA;&gt;   spending path into a revocation one). You can use the OP_RETURN trick&#xA;&gt; from above to prevent that.&#xA;&gt;&#xA;&gt; Unfortunately, the timelocked-covenant approach to feebumping only applies&#xA;&gt; to bumping the first&#xA;&gt; transaction of a chain (you can&#39;t pay for the parent with a timelock) so&#xA;&gt; for instance it&#39;s not&#xA;&gt; usable for HTLC transactions in Lightning to bump the parent commitment&#xA;&gt; tx. The same goes for&#xA;&gt; bumping the update tx in Coinpool.&#xA;&gt; It could be worked around by having a different covenant per participant&#xA;&gt; (paying the fee from either&#xA;&gt; of the participants&#39; output) behind a signature check. Of course it&#xA;&gt; requires funds to already be in&#xA;&gt; the contract (HTLC, Coinpool leaf) to pay for your own unilateral close,&#xA;&gt; but if you don&#39;t have any&#xA;&gt; fund in the contract it doesn&#39;t make sense to try to feebump it in the&#xA;&gt; first place. The same goes&#xA;&gt; for small amounts: you&#39;d only allocate up to the value of the contract&#xA;&gt; (minus a dust preference) in&#xA;&gt; fees in order to enforce it.&#xA;&gt; This is less nice for external monitors as it requires a private key (or&#xA;&gt; another secret) to be&#xA;&gt; committed to in advance) to be able to bump [4] and does not get rid of&#xA;&gt; the &#34;who&#39;s gonna pay for the&#xA;&gt; enforcement&#34; issue in &gt;2-parties contracts. Still, it&#39;s more optimal and&#xA;&gt; usable than CPFP or adding&#xA;&gt; a pair of input/output for all the reasons mentioned above.&#xA;&gt;&#xA;&gt;&#xA;&gt; Thoughts?&#xA;&gt; Antoine&#xA;&gt;&#xA;&gt;&#xA;&gt; [0]&#xA;&gt; https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2021-November/019614.html&#xA;&gt; [1]&#xA;&gt; https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2021-November/019615.html&#xA;&gt; [2]&#xA;&gt; https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2021-December/019627.html&#xA;&gt; [3] That&#39;s obviously close to the CTV construction. But using another more&#xA;&gt; flexible (and therefore&#xA;&gt;     less optimized) construction would not be a big deal. It might in fact&#xA;&gt; be necessary for more&#xA;&gt;     elaborated (realistic?) usecases than the simple one detailed here.&#xA;&gt; [4]&#xA;&gt; https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2022-February/019879.html&#xA;&gt; _______________________________________________&#xA;&gt; bitcoin-dev mailing list&#xA;&gt; bitcoin-dev at lists.linuxfoundation.org&#xA;&gt; https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev&#xA;&gt;&#xA;-------------- next part --------------&#xA;An HTML attachment was scrubbed...&#xA;URL: &lt;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20220312/980f7dcc/attachment-0001.html&gt;</html></oembed>