|
| 1 | +<pre> |
| 2 | + BIP: ? |
| 3 | + Layer: Mempool Policy |
| 4 | + Title: Ephemeral Anchors |
| 5 | + Author: Gregory Sanders <gsanders87@gmail.com> |
| 6 | + Status: Draft |
| 7 | + License: BSD-3-Clause |
| 8 | + Type: Standards Track |
| 9 | + Created: 2023-01-11 |
| 10 | +</pre> |
| 11 | + |
| 12 | +==Introduction== |
| 13 | + |
| 14 | +===Abstract=== |
| 15 | + |
| 16 | +Ephemeral Anchors are a mempool policy carve-out that allows any value utxos, |
| 17 | +even 0-value dust, to be created, provided it is also consumed within the same |
| 18 | +mempool package. This ephemeral anchor is a "mutex lock" for the transaction, |
| 19 | +allowing for robust fee bumping by wallets, not requiring any special key material |
| 20 | +to do so, and avoiding all known transaction pinning vectors. |
| 21 | + |
| 22 | +===Motivation=== |
| 23 | + |
| 24 | +One definition of transaction pinning is the intentional or unintentional blocking |
| 25 | +of a getting a transaction mined that would otherwise be rational for the miner |
| 26 | +to include in the next block without the attacker paying anything in many cases. |
| 27 | +This can result in wallets simply not supporting fee bumping due to complexity, |
| 28 | +or in certain smart contract cases such as Hash Time Locked Contracts, outright theft. |
| 29 | + |
| 30 | +[https://github.com/bitcoin/bitcoin/pull/28948 V3] transactions, which this proposal is built on, greatly mitigates [https://github.com/bitcoin/bips/blob/master/bip-0125.mediawiki BIP125] |
| 31 | +pinning vectors, where an adversary can vastly increase the required fees to replace a |
| 32 | +transaction that will not be mined quickly, or disallow replacement altogether. |
| 33 | +Depending on certain factors, this economic value can reach over 500 times increase |
| 34 | +in required fees to replace the attacker's transaction. V3 transactions end |
| 35 | +up reducing this attack surface by 100 times, resulting in 5 times increase in fees |
| 36 | +using the same running example. This policy can be thought of as a "RBF carve-out". |
| 37 | + |
| 38 | +The major pinning vector left is "package limit pinning", where a counterparty |
| 39 | +either maliciously or accidentally pins a transaction by exhausting the maximum |
| 40 | +descendant limit of a transaction package using their own outputs, and is unwilling |
| 41 | +or unable to get the package mined. This leaves the honest user unable to spend their |
| 42 | +own outputs in the transaction package, as there is no RBF rule in place for evicting |
| 43 | +"sibling" output spends from the same parent transaction. |
| 44 | + |
| 45 | +One existing mitigation for this issue is the [https://github.com/bitcoin/bitcoin/pull/15681 CPFP carve out], which allows |
| 46 | +a "one more" policy these limits, given some restrictions. This carve-out only works for |
| 47 | +transactions with up to two immediately-spendable outputs. This leaves a lot to be |
| 48 | +desired: |
| 49 | + |
| 50 | +* It does not solve many-party contract pinning, such as a three-party payment channel |
| 51 | +* It does not solve batched payments pinning if the service is unable to double-spend its own inputs. For example, an exchange may require strict separation between client funds and fee funds for security reasons. |
| 52 | +* In two-party smart contracts, all but two outputs must be relative-timelocked, which interferes with tooling such as [https://bitcoin.sipa.be/miniscript/ Miniscript] and smart contract composition such as making an output that is directly deposited into another smart contract or any wallet with standard address types. |
| 53 | +
|
| 54 | +This proposal gives a standard way to create a 0-fee "parent" transaction |
| 55 | +which can be fee-bumped by any wallet by introducing a special 0-value anchor output |
| 56 | +which MUST be spent within the same relay package. |
| 57 | + |
| 58 | +===Implications=== |
| 59 | + |
| 60 | +In conjunction with V3 rules of a transaction having up to one child, |
| 61 | +if a "parent" transaction has an ephemeral anchor, any spend of that parent transaction's |
| 62 | +outputs must also include the ephemeral anchor spend in the same transaction, meaning it can |
| 63 | +be double-spent by any other party via existing RBF rules. This "mutex lock" supersedes |
| 64 | +the LN-focused CPFP carve-out, neatly solving the remaining issues with multiparty constructs and Miniscript |
| 65 | +compatibility. |
| 66 | + |
| 67 | +===Expected Use Cases=== |
| 68 | + |
| 69 | +* Batched payments with segregated fee pools: Batched payments that can be fee bumped without access to customer deposit related key material |
| 70 | +* Simplified watchtowers: No requirement for watchtowers to be registered with privileged key material |
| 71 | +* Payment accelerators: Users can submit transactions to transaction accelerators, who can fee bump using their own infrastructure |
| 72 | +* Multiparty smart contracts: LN BOLTs can be revamped to remove `1 CSV` and value-sapping anchors. |
| 73 | +* [https://bitcoin.stackexchange.com/questions/100537/what-is-spacechain Spacechains] |
| 74 | +
|
| 75 | +===Unsolved Pinning Scenarios=== |
| 76 | + |
| 77 | +One major class of pinning vectors yet unsolved is when the pre-signed transaction uses |
| 78 | +SIGHASH_ANYONECANPAY. This mode should be avoided as a pinning DoS is trivial. |
| 79 | + |
| 80 | +Second is any other transaction type such as coinjoins, where the wallet user doesn't |
| 81 | +have "veto" power over all inputs in the transaction. A counterparty can double-spend |
| 82 | +their inputs, and this can still result in a variety of pinning vectors, albeit |
| 83 | +perhaps reduced in severity or chance of success. |
| 84 | + |
| 85 | +===Related Work=== |
| 86 | + |
| 87 | +[https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2020-September/018168.html Transaction Sponsors] is a softfork proposal to allow transactions to |
| 88 | +indirectly sponsor transactions with no explicit relationship in the classical utxo |
| 89 | +model. Ephemeral Anchors can be viewed as a type of opt-in transaction sponsors implemented |
| 90 | +purely in policy. |
| 91 | + |
| 92 | +Using a 0-value CPFP anchor is not a new idea, see: |
| 93 | + |
| 94 | +* [https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2018-May/015931.html LN-dev discussion on 0-value anchors] |
| 95 | +
|
| 96 | +The discussion lacked a solution to the issue of the dust entering into the utxo set |
| 97 | +causing negative externalities, and also was more weakly motivated by not solving package limit pinning. |
| 98 | +Repackaging the idea within the context of ancestor package relay and in light of the latest transaction pinning |
| 99 | +research, we can mitigate the negative externalities while solving substantial problems. |
| 100 | + |
| 101 | +==Definitions== |
| 102 | + |
| 103 | +Ephemeral anchor: An output with the scriptPubKey of exactly <code>OP_1 <0x4e73></code>, which is a non-taproot witness v1 script. |
| 104 | + |
| 105 | +Ephemeral anchor transaction: A transaction that has an ephemeral anchor |
| 106 | + |
| 107 | +==Specification== |
| 108 | + |
| 109 | +A new output script type is made policy standard to spend, known as an ephemeral anchor. |
| 110 | + |
| 111 | +Ephemeral anchors of any satoshi value are standard for relay. |
| 112 | + |
| 113 | +When received by a peer for inclusion to the mempool an ephemeral anchors transaction MUST: |
| 114 | + |
| 115 | +* Be an otherwise valid V3 transaction |
| 116 | +* Be 0-fee |
| 117 | +* Have only one ephemeral anchor |
| 118 | +* Have the ephemeral anchor spent in the same ancestor relay package |
| 119 | +
|
| 120 | +or will be rejected by policy. All other policy checks are left in place. |
| 121 | +If included in an otherwise valid block, these additional constraints do not apply |
| 122 | +as this is a policy-only change. |
| 123 | + |
| 124 | +It is recommended that miners should not mine ephemeral anchor transactions |
| 125 | +without also mining the spend in the same block. This means miners should not |
| 126 | +prioritise transactions that create ephemeral anchors but instead should just prioritise the spend; |
| 127 | +mining software is encouraged to enforce that limitation. |
| 128 | + |
| 129 | +No witness data for ephemeral anchors spends should be allowed, to preclude witness |
| 130 | +stuffing. |
| 131 | + |
| 132 | +== Backward compatibility == |
| 133 | + |
| 134 | +Ephemeral anchor spends were previously non-standard, so there are no known conflicts |
| 135 | +with previous usage. |
| 136 | + |
| 137 | +==Implementation== |
| 138 | + |
| 139 | +https://github.com/bitcoin/bitcoin/pull/29001 |
| 140 | + |
| 141 | +==Acknowledgements== |
| 142 | + |
| 143 | +Thank you to all those listed for foundational work |
| 144 | +and insightful feedback(in last name order): |
| 145 | + |
| 146 | +* Richard Meyers |
| 147 | +* James O'Beirne |
| 148 | +* Antoine Poinsot |
| 149 | +* Antoine Riard |
| 150 | +* Jeremy Rubin |
| 151 | +* Bastien Teinturier |
| 152 | +* Anthony Towns |
| 153 | +* Gloria Zhao |
| 154 | +
|
| 155 | +==References and Rationale== |
| 156 | + |
| 157 | +<references/> |
0 commit comments