<oembed><type>rich</type><version>1.0</version><title>darosior [ARCHIVE] wrote</title><author_name>darosior [ARCHIVE] (npub1pj…x22xp)</author_name><author_url>https://yabu.me/npub1pj9022f74rzq7d5x7gnxje6wpsgk4r5jgeck8y5awd423ydhan3q7x22xp</author_url><provider_name>njump</provider_name><provider_url>https://yabu.me</provider_url><html>📅 Original date posted:2022-03-12&#xA;📝 Original message:The idea of a soft fork to fix dynamic fee bumping was recently put back on the table. It might&#xA;sound radical, as what prevents today reasonable fee bumping for contracts with presigned&#xA;transactions (pinning) has to do with nodes&#39; relay policy. But the frustration is understandable&#xA;given the complexity of designing fee bumping with today&#39;s primitives. [0]&#xA;Recently too, there was a lot of discussions around covenants. Covenants (conceptually, not talking&#xA;about any specific proposal) seem to open lots of new use cases and to be desired by (some?) Bitcoin&#xA;application developers and users.&#xA;I think that fee bumping using covenants has attractive properties, and it requires a soft fork that&#xA;is already desirable beyond (trying) to fix fee bumping. However i could not come up with a solution&#xA;as neat for other protocols than vaults. I&#39;d like to hear from others about 1) taking this route for&#xA;fee bumping 2) better ideas on applying this to other protocols.&#xA;&#xA;&#xA;In a vault construction you have a UTxO which can only be spent by an Unvaulting transaction, whose&#xA;output triggers a timelock before the expiration of which a revocation transaction may be confirmed.&#xA;The revocation transaction being signed in advance (typically before sharing the signature for the&#xA;Unvault transaction) you need fee bumping in order for the contract to actually be enforceable.&#xA;&#xA;Now, with a covenant you could commit to the revocation tx instead of presigning it. And using a&#xA;Taproot tree you could commit to different versions of it with increasing feerate. Any network&#xA;monitor (the brooadcaster, a watchtower, ..) would be able to RBF the revocation transaction if it&#xA;doesn&#39;t confirm by spending using a leaf with a higher-feerate transaction being committed to.&#xA;&#xA;Of course this makes for a perfect DoS: it would be trivial for a miner to infer that you are using&#xA;a specific vault standard and guess other leaves and replace the witness to use the highest-feerate&#xA;spending path. You could require a signature from any of the participants. Or, at the cost of an&#xA;additional depth, in the tree you could &#34;salt&#34; each leaf by pairing it with -say- an OP_RETURN leaf.&#xA;But this leaves you with a possible internal blackmail for multi-party contracts (although it&#39;s less&#xA;of an issue for vaults, and not one for single-party vaults).&#xA;What you could do instead is attaching an increasing relative timelock to each leaf (as the committed&#xA;revocation feerate increases, so does the timelock). You need to be careful to note wreck miner&#xA;incentives here (see [0], [1], [2] on &#34;miner harvesting&#34;), but this enables the nice property of a&#xA;feerate which &#34;adapts&#34; to the block space market. Another nice property of this approach is the&#xA;integrated anti fee sniping protection if the revocation transaction pays a non-trivial amount of&#xA;fees.&#xA;&#xA;Paying fees from &#34;shared&#34; funds instead of a per-watchtower fee-bumping wallet opened up the&#xA;blackmail from the previous section, but the benefits of paying from internal funds shouldn&#39;t be&#xA;understated.&#xA;No need to decide on an amount to be refilled. No need to bother the user to refill the fee-bumping&#xA;wallet (before they can participate in more contracts, or worse before a deadline at which all&#xA;contracts are closed). No need for a potentially large amount of funds to just sit on a hot wallet&#xA;&#34;just in case&#34;. No need to duplicate this amount as you replicate the number of network monitors&#xA;(which is critical to the security of such contracts).&#xA;In addition, note how modifying the feerate of the revocation transaction in place is less expensive&#xA;than adding a (pair of) new input (and output), let alone adding an entire new transaction to CPFP.&#xA;Aside, and less importantly, it can be made to work with today&#39;s relay rules (just use fee thresholds&#xA;adapted to the current RBF thresholds, potentially with some leeway to account for policy changes).&#xA;Paying from shared funds (in addition to paying from internal funds) also prevents pervert&#xA;incentives for contracts with more than 2 parties. In case one of the parties breaches it, all&#xA;remaining parties have an incentive to enforce the contract.. But only one would otherwise pay for&#xA;it! It would open up the door to some potential sneaky techniques to wait for another party to pay&#xA;for the fees, which is at odd with the reactive security model.&#xA;&#xA;Let&#39;s examine how it could be concretely designed. Say you have a vault wallet software for a setup&#xA;with 5 participants. The revocation delay is 144 blocks. You assume revocation to be infrequent (if&#xA;one happens it&#39;s probably a misconfigured watchtower that needs be fixed before the next&#xA;unvaulting), so you can afford infrequent overpayments and larger fee thresholds. Participants&#xA;assume the vault will be spent within a year and assume a maximum possible feerate for this year of&#xA;10ksat/vb.&#xA;They create a Taproot tree of depth 7. First leaf is the spending path (open to whomever the vault&#xA;pays after the 144 blocks). Then the leaf `i` for `i` in `[1, 127]` is a covenant to the revocation&#xA;transaction with a feerate `i * 79` sats/vb and a relative timelock of `i - 1` blocks.&#xA;Assuming the covenant to the revocation transaction is 33 bytes [3], that&#39;s a witness of:&#xA;    1 + 33     + 1 + 33 + 7 * 32 = 292 WU (73 vb)&#xA;    ^^^^^^       ^^^^^^^^^^^^^^&#xA;    witscript     control block&#xA;for any of the revocation paths. The revocation transaction is 1-input 1-output, so in total it&#39;s&#xA;    10.5 +   41 + 73      + 43    = 167.5 vb&#xA;    ^^^^    ^^^^^^^^^^^    ^^^^&#xA;    header  input|witness  output&#xA;The transaction size is not what you&#39;d necessarily want to optimize for first, still, it is smaller&#xA;in this case than using other feebumping primitives and has a smaller footprint on the UTxO set. For&#xA;instance for adding a feebumping input and change output assuming all Taproot inputs and outputs&#xA;(CPFP is necessarily even larger):&#xA;    5 * 64 +  1 + 5 * (32 + 1) + 1 + 33 = 520 WU (105 vb)&#xA;    ^^^^^^    ^^^^^^^^^^^^^^^    ^^^^^^&#xA;    witness      witscript       control&#xA;    10.5  +  41 + 105      + 41 + 16.5         + 2 * 43  = 300 vb&#xA;    ^^^^     ^^^^^^^^        ^^^^^^^^^           ^^^^^^&#xA;    header   input|witness   fb input|witness    outputs&#xA;&gt;From there, you can afford more depths at the tiny cost of 8 more vbytes each. You might want them&#xA;for:&#xA;- more granularity (if you can afford large enough timelocks)&#xA;- optimizing for the spending path rather than the revocation one&#xA;- adding a hashlock to prevent nuisance (with the above script a third party could malleate a&#xA;  spending path into a revocation one). You can use the OP_RETURN trick from above to prevent that.&#xA;&#xA;Unfortunately, the timelocked-covenant approach to feebumping only applies to bumping the first&#xA;transaction of a chain (you can&#39;t pay for the parent with a timelock) so for instance it&#39;s not&#xA;usable for HTLC transactions in Lightning to bump the parent commitment tx. The same goes for&#xA;bumping the update tx in Coinpool.&#xA;It could be worked around by having a different covenant per participant (paying the fee from either&#xA;of the participants&#39; output) behind a signature check. Of course it requires funds to already be in&#xA;the contract (HTLC, Coinpool leaf) to pay for your own unilateral close, but if you don&#39;t have any&#xA;fund in the contract it doesn&#39;t make sense to try to feebump it in the first place. The same goes&#xA;for small amounts: you&#39;d only allocate up to the value of the contract (minus a dust preference) in&#xA;fees in order to enforce it.&#xA;This is less nice for external monitors as it requires a private key (or another secret) to be&#xA;committed to in advance) to be able to bump [4] and does not get rid of the &#34;who&#39;s gonna pay for the&#xA;enforcement&#34; issue in &gt;2-parties contracts. Still, it&#39;s more optimal and usable than CPFP or adding&#xA;a pair of input/output for all the reasons mentioned above.&#xA;&#xA;&#xA;Thoughts?&#xA;Antoine&#xA;&#xA;&#xA;[0] https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2021-November/019614.html&#xA;[1] https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2021-November/019615.html&#xA;[2] https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2021-December/019627.html&#xA;[3] That&#39;s obviously close to the CTV construction. But using another more flexible (and therefore&#xA;    less optimized) construction would not be a big deal. It might in fact be necessary for more&#xA;    elaborated (realistic?) usecases than the simple one detailed here.&#xA;[4] https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2022-February/019879.html</html></oembed>