<oembed><type>rich</type><version>1.0</version><author_name>npub1xqcwcttsyk0a64d63crrwsxp88pa42np37rw87hrfn4uku78g2aqltcnns</author_name><author_url>https://nostr.ae/npub1xqcwcttsyk0a64d63crrwsxp88pa42np37rw87hrfn4uku78g2aqltcnns</author_url><provider_name>njump</provider_name><provider_url>https://nostr.ae</provider_url><html>📅 Original date posted:2022-01-19&#xA;📝 Original message:&gt;  because you make transactions third party malleable it becomes possible&#xA;to bundle and unbundle transactions.&#xA;&#xA;What I was suggesting doesn&#39;t make it possible to malleate someone else&#39;s&#xA;transaction. I guess maybe my proposal of using a sighash flag might have&#xA;been unclear. Imagine it as a script opcode that just says &#34;this&#xA;transaction must be mined with this other transaction&#34; - the only&#xA;difference being that you can use any output with any encumberance as an&#xA;input for fee bumping. It doesn&#39;t prevent the original transaction from&#xA;being mined on its own. So adding junk inputs would be no more of a problem&#xA;than dust attacks already are. It would be used exactly like cpfp, except&#xA;it doesn&#39;t spend the parent.&#xA;&#xA;I don&#39;t think what I was suggesting is as different from your proposal. All&#xA;the problems of fee revenue optimization and feerate rules that you&#xA;mentioned seem like they&#39;d also exist for your proposal, or for cpfp. Let&#xA;me know if I should clarify further.&#xA;&#xA;On Tue, Jan 18, 2022 at 8:51 PM Jeremy &lt;jlrubin at mit.edu&gt; wrote:&#xA;&#xA;&gt; The issue with sighash flags is that because you make transactions third&#xA;&gt; party malleable it becomes possible to bundle and unbundle transactions.&#xA;&gt;&#xA;&gt; This means there are circumstances where an attacker could e.g. see your&#xA;&gt; txn, and then add a lot of junk change/inputs + 25 descendants and strongly&#xA;&gt; anchor your transaction to the bottom of the mempool.&#xA;&gt;&#xA;&gt; because of rbf rules requiring more fee and feerate, this means you have&#xA;&gt; to bump across the whole package and that can get really messy.&#xA;&gt;&#xA;&gt; more generally speaking, you could imagine a future where mempools track&#xA;&gt; many alternative things that might want to be in a transaction.&#xA;&gt;&#xA;&gt; suppose there are N inputs each with a weight and an amount of fee being&#xA;&gt; added and the sighash flags let me pick any subset of them. However, for a&#xA;&gt; txn to be standard it must be &lt; 100k bytes and for it to be consensus &lt;&#xA;&gt; 1mb. Now it is possible you have to solve a knapsack problem in order to&#xA;&gt; rationally bundle this transaction out of all possibilities.&#xA;&gt;&#xA;&gt; This problem can get even thornier, suppose that the inputs I&#39;m adding&#xA;&gt; themselves are the outputs of another txn in the mempool, now i have to&#xA;&gt; track and propagate the feerates of that child back up to the parent txn&#xA;&gt; and track all these dependencies.&#xA;&gt;&#xA;&gt; perhaps with very careful engineering these issues can be tamed. however&#xA;&gt; it seems with sponsors or fee accounts, by separating the pays-for from the&#xA;&gt; participates-in concerns we can greatly simplify it to something like:&#xA;&gt; compute effective feerate for a txn, including all sponsors that pay more&#xA;&gt; than the feerate of the base txn. Mine that txn and it&#39;s subsidies using&#xA;&gt; the normal algo. If you run out of space, all subsidies are same-sized so&#xA;&gt; just take the ones that pay the highest amount up until the added marginal&#xA;&gt; feerate is less than the next eligible txn.&#xA;&gt;&#xA;&gt;&#xA;&gt; --&#xA;&gt; @JeremyRubin &lt;https://twitter.com/JeremyRubin&gt;&#xA;&gt; &lt;https://twitter.com/JeremyRubin&gt;&#xA;&gt;&#xA;&gt;&#xA;&gt; On Tue, Jan 18, 2022 at 6:38 PM Billy Tetrud &lt;billy.tetrud at gmail.com&gt;&#xA;&gt; wrote:&#xA;&gt;&#xA;&gt;&gt; I see, its not primarily to make it cheaper to append fees, but also&#xA;&gt;&gt; allows appending fees in cases that aren&#39;t possible now. Is that right? I&#xA;&gt;&gt; can certainly see the benefit of a more general way to add a fee to any&#xA;&gt;&gt; transaction, regardless of whether you&#39;re related to that transaction or&#xA;&gt;&gt; not.&#xA;&gt;&gt;&#xA;&gt;&gt; How would you compare the pros and cons of your account-based approach to&#xA;&gt;&gt; something like a new sighash flag? Eg a sighash flag that says &#34;I&#39;m signing&#xA;&gt;&gt; this transaction, but the signature is only valid if mined in the same&#xA;&gt;&gt; block as transaction X (or maybe transactions LIST)&#34;. This could be named&#xA;&gt;&gt; SIGHASH_EXTERNAL. Doing this would be a lot more similar to other bitcoin&#xA;&gt;&gt; transactions, and no special account would need to be created. Any&#xA;&gt;&gt; transaction could specify this. At least that&#39;s the first thought I would&#xA;&gt;&gt; have in designing a way to arbitrarily bump fees. Have you compared your&#xA;&gt;&gt; solution to something more familiar like that?&#xA;&gt;&gt;&#xA;&gt;&gt; On Tue, Jan 18, 2022 at 11:43 AM Jeremy &lt;jlrubin at mit.edu&gt; wrote:&#xA;&gt;&gt;&#xA;&gt;&gt;&gt; Can you clarify what you mean by &#34;improve the situation&#34;?&#xA;&gt;&gt;&gt;&#xA;&gt;&gt;&gt; There&#39;s a potential mild bytes savings, but the bigger deal is that the&#xA;&gt;&gt;&gt; API should be much less vulnerable to pinning issues, fix dust leakage for&#xA;&gt;&gt;&gt; eltoo like protocols, and just generally allow protocol designs to be fully&#xA;&gt;&gt;&gt; abstracted from paying fees. You can&#39;t easily mathematically quantify API&#xA;&gt;&gt;&gt; improvements like that.&#xA;&gt;&gt;&gt; --&#xA;&gt;&gt;&gt; @JeremyRubin &lt;https://twitter.com/JeremyRubin&gt;&#xA;&gt;&gt;&gt; &lt;https://twitter.com/JeremyRubin&gt;&#xA;&gt;&gt;&gt;&#xA;&gt;&gt;&gt;&#xA;&gt;&gt;&gt; On Tue, Jan 18, 2022 at 8:13 AM Billy Tetrud &lt;billy.tetrud at gmail.com&gt;&#xA;&gt;&gt;&gt; wrote:&#xA;&gt;&gt;&gt;&#xA;&gt;&gt;&gt;&gt; Do you have any back-of-the-napkin math on quantifying how much this&#xA;&gt;&gt;&gt;&gt; would improve the situation vs existing methods (eg cpfp)?&#xA;&gt;&gt;&gt;&gt;&#xA;&gt;&gt;&gt;&gt;&#xA;&gt;&gt;&gt;&gt;&#xA;&gt;&gt;&gt;&gt; On Sat, Jan 1, 2022 at 2:04 PM Jeremy via bitcoin-dev &lt;&#xA;&gt;&gt;&gt;&gt; bitcoin-dev at lists.linuxfoundation.org&gt; wrote:&#xA;&gt;&gt;&gt;&gt;&#xA;&gt;&gt;&gt;&gt;&gt; Happy new years devs,&#xA;&gt;&gt;&gt;&gt;&gt;&#xA;&gt;&gt;&gt;&gt;&gt; I figured I would share some thoughts for conceptual review that have&#xA;&gt;&gt;&gt;&gt;&gt; been bouncing around my head as an opportunity to clean up the fee paying&#xA;&gt;&gt;&gt;&gt;&gt; semantics in bitcoin &#34;for good&#34;. The design space is very wide on the&#xA;&gt;&gt;&gt;&gt;&gt; approach I&#39;ll share, so below is just a sketch of how it could work which&#xA;&gt;&gt;&gt;&gt;&gt; I&#39;m sure could be improved greatly.&#xA;&gt;&gt;&gt;&gt;&gt;&#xA;&gt;&gt;&gt;&gt;&gt; Transaction fees are an integral part of bitcoin.&#xA;&gt;&gt;&gt;&gt;&gt;&#xA;&gt;&gt;&gt;&gt;&gt; However, due to quirks of Bitcoin&#39;s transaction design, fees are a&#xA;&gt;&gt;&gt;&gt;&gt; part of the transactions that they occur in.&#xA;&gt;&gt;&gt;&gt;&gt;&#xA;&gt;&gt;&gt;&gt;&gt; While this works in a &#34;Bitcoin 1.0&#34; world, where all transactions are&#xA;&gt;&gt;&gt;&gt;&gt; simple on-chain transfers, real world use of Bitcoin requires support for&#xA;&gt;&gt;&gt;&gt;&gt; things like Fee Bumping stuck transactions, DoS resistant Payment Channels,&#xA;&gt;&gt;&gt;&gt;&gt; and other long lived Smart Contracts that can&#39;t predict future fee rates.&#xA;&gt;&gt;&gt;&gt;&gt; Having the fees paid in band makes writing these contracts much more&#xA;&gt;&gt;&gt;&gt;&gt; difficult as you can&#39;t merely express the logic you want for the&#xA;&gt;&gt;&gt;&gt;&gt; transaction, but also the fees.&#xA;&gt;&gt;&gt;&gt;&gt;&#xA;&gt;&gt;&gt;&gt;&gt; Previously, I proposed a special type of transaction called a&#xA;&gt;&gt;&gt;&gt;&gt; &#34;Sponsor&#34; which has some special consensus + mempool rules to allow&#xA;&gt;&gt;&gt;&gt;&gt; arbitrarily appending fees to a transaction to bump it up in the mempool.&#xA;&gt;&gt;&gt;&gt;&gt;&#xA;&gt;&gt;&gt;&gt;&gt; As an alternative, we could establish an account system in Bitcoin as&#xA;&gt;&gt;&gt;&gt;&gt; an &#34;extension block&#34;.&#xA;&gt;&gt;&gt;&gt;&gt;&#xA;&gt;&gt;&gt;&gt;&gt; *Here&#39;s how it might work:*&#xA;&gt;&gt;&gt;&gt;&gt;&#xA;&gt;&gt;&gt;&gt;&gt; 1. Define a special anyone can spend output type that is a &#34;fee&#xA;&gt;&gt;&gt;&gt;&gt; account&#34; (e.g. segwit V2). Such outputs have a redeeming key and an amount&#xA;&gt;&gt;&gt;&gt;&gt; associated with them, but are overall anyone can spend.&#xA;&gt;&gt;&gt;&gt;&gt; 2. All deposits to these outputs get stored in a separate UTXO&#xA;&gt;&gt;&gt;&gt;&gt; database for fee accounts&#xA;&gt;&gt;&gt;&gt;&gt; 3. Fee accounts can sign only two kinds of transaction: A: a fee&#xA;&gt;&gt;&gt;&gt;&gt; amount and a TXID (or Outpoint?); B: a withdraw amount, a fee, and&#xA;&gt;&gt;&gt;&gt;&gt; an address&#xA;&gt;&gt;&gt;&gt;&gt; 4. These transactions are committed in an extension block merkle tree.&#xA;&gt;&gt;&gt;&gt;&gt; While the actual signature must cover the TXID/Outpoint, the committed data&#xA;&gt;&gt;&gt;&gt;&gt; need only cover the index in the block of the transaction. The public key&#xA;&gt;&gt;&gt;&gt;&gt; for account lookup can be recovered from the message + signature.&#xA;&gt;&gt;&gt;&gt;&gt; 5. In any block, any of the fee account deposits can be: released into&#xA;&gt;&gt;&gt;&gt;&gt; fees if there is a corresponding tx; consolidated together to reduce the&#xA;&gt;&gt;&gt;&gt;&gt; number of utxos (this can be just an OP_TRUE no metadata needed); or&#xA;&gt;&gt;&gt;&gt;&gt; released into fees *and paid back* into the requested withdrawal key&#xA;&gt;&gt;&gt;&gt;&gt; (encumbering a 100 block timeout). Signatures must be unique in a block.&#xA;&gt;&gt;&gt;&gt;&gt; 6. Mempool logic is updated to allow attaching of account fee spends&#xA;&gt;&gt;&gt;&gt;&gt; to transactions, the mempool can restrict that an account is not allowed&#xA;&gt;&gt;&gt;&gt;&gt; more spend more than it&#39;s balance.&#xA;&gt;&gt;&gt;&gt;&gt;&#xA;&gt;&gt;&gt;&gt;&gt; *But aren&#39;t accounts &#34;bad&#34;?*&#xA;&gt;&gt;&gt;&gt;&gt;&#xA;&gt;&gt;&gt;&gt;&gt; Yes, accounts are bad. But these accounts are not bad, because any&#xA;&gt;&gt;&gt;&gt;&gt; funds withdrawn from the fee extension are fundamentally locked for 100&#xA;&gt;&gt;&gt;&gt;&gt; blocks as a coinbase output, so there should be no issues with any series&#xA;&gt;&gt;&gt;&gt;&gt; of reorgs. Further, since there is no &#34;rich state&#34; for these accounts, the&#xA;&gt;&gt;&gt;&gt;&gt; state updates can always be applied in a conflict-free way in any order.&#xA;&gt;&gt;&gt;&gt;&gt;&#xA;&gt;&gt;&gt;&gt;&gt;&#xA;&gt;&gt;&gt;&gt;&gt; *Improving the privacy of this design:*&#xA;&gt;&gt;&gt;&gt;&gt;&#xA;&gt;&gt;&gt;&gt;&gt; This design could likely be modified to implement something like&#xA;&gt;&gt;&gt;&gt;&gt; Tornado.cash or something else so that the fee account paying can be&#xA;&gt;&gt;&gt;&gt;&gt; unlinked from the transaction being paid for, improving privacy at the&#xA;&gt;&gt;&gt;&gt;&gt; expense of being a bit more expensive.&#xA;&gt;&gt;&gt;&gt;&gt;&#xA;&gt;&gt;&gt;&gt;&gt; Other operations could be added to allow a trustless mixing to be done&#xA;&gt;&gt;&gt;&gt;&gt; by miners automatically where groups of accounts with similar values are&#xA;&gt;&gt;&gt;&gt;&gt; trustlessly  split into a common denominator and change, and keys are&#xA;&gt;&gt;&gt;&gt;&gt; derived via a verifiable stealth address like protocol (so fee balances can&#xA;&gt;&gt;&gt;&gt;&gt; be discovered by tracing the updates posted). These updates could also be&#xA;&gt;&gt;&gt;&gt;&gt; produced by individuals rather than miners, and miners could simply honor&#xA;&gt;&gt;&gt;&gt;&gt; them with better privacy. While a miner generating an update would be able&#xA;&gt;&gt;&gt;&gt;&gt; to deanonymize their mixes, if you have your account mixed several times by&#xA;&gt;&gt;&gt;&gt;&gt; independent miners that could potentially add sufficient privacy.&#xA;&gt;&gt;&gt;&gt;&gt;&#xA;&gt;&gt;&gt;&gt;&gt; The LN can also be used with PTLCs to, in theory, have another&#xA;&gt;&gt;&gt;&gt;&gt; individual paid to sponsor a transaction on your behalf only if they reveal&#xA;&gt;&gt;&gt;&gt;&gt; a valid sig from their fee paying account, although under this model it&#39;s&#xA;&gt;&gt;&gt;&gt;&gt; hard to ensure that the owner doesn&#39;t pay a fee and then &#39;cancel&#39; by&#xA;&gt;&gt;&gt;&gt;&gt; withdrawing the rest. However, this could be partly solved by using&#xA;&gt;&gt;&gt;&gt;&gt; reputable fee accounts (reputation could be measured somewhat&#xA;&gt;&gt;&gt;&gt;&gt; decentralized-ly by longevity of the account and transactions paid for&#xA;&gt;&gt;&gt;&gt;&gt; historically).&#xA;&gt;&gt;&gt;&gt;&gt;&#xA;&gt;&gt;&gt;&gt;&gt; *Scalability*&#xA;&gt;&gt;&gt;&gt;&gt;&#xA;&gt;&gt;&gt;&gt;&gt; This design is fundamentally &#39;decent&#39; for scalability because adding&#xA;&gt;&gt;&gt;&gt;&gt; fees to a transaction does not require adding inputs or outputs and does&#xA;&gt;&gt;&gt;&gt;&gt; not require tracking substantial amounts of new state.&#xA;&gt;&gt;&gt;&gt;&gt;&#xA;&gt;&gt;&gt;&gt;&gt; Paying someone else to pay for you via the LN also helps make this&#xA;&gt;&gt;&gt;&gt;&gt; more efficient if the withdrawal issues can be fixed.&#xA;&gt;&gt;&gt;&gt;&gt;&#xA;&gt;&gt;&gt;&gt;&gt; *Lightning:*&#xA;&gt;&gt;&gt;&gt;&gt;&#xA;&gt;&gt;&gt;&gt;&gt; This type of design works really well for channels because the&#xA;&gt;&gt;&gt;&gt;&gt; addition of fees to e.g. a channel state does not require any sort of&#xA;&gt;&gt;&gt;&gt;&gt; pre-planning (e.g. anchors) or transaction flexibility (SIGHASH flags).&#xA;&gt;&gt;&gt;&gt;&gt; This sort of design is naturally immune to pinning issues since you could&#xA;&gt;&gt;&gt;&gt;&gt; offer to pay a fee for any TXID and the number of fee adding offers does&#xA;&gt;&gt;&gt;&gt;&gt; not need to be restricted in the same way the descendant transactions would&#xA;&gt;&gt;&gt;&gt;&gt; need to be.&#xA;&gt;&gt;&gt;&gt;&gt;&#xA;&gt;&gt;&gt;&gt;&gt; *Without a fork?*&#xA;&gt;&gt;&gt;&gt;&gt;&#xA;&gt;&gt;&gt;&gt;&gt; This type of design could be done as a federated network that bribes&#xA;&gt;&gt;&gt;&gt;&gt; miners -- potentially even retroactively after a block is formed. That&#xA;&gt;&gt;&gt;&gt;&gt; might be sufficient to prove the concept works before a consensus upgrade&#xA;&gt;&gt;&gt;&gt;&gt; is deployed, but such an approach does mean there is a centralizing layer&#xA;&gt;&gt;&gt;&gt;&gt; interfering with normal mining.&#xA;&gt;&gt;&gt;&gt;&gt;&#xA;&gt;&gt;&gt;&gt;&gt;&#xA;&gt;&gt;&gt;&gt;&gt; Happy new year!!&#xA;&gt;&gt;&gt;&gt;&gt;&#xA;&gt;&gt;&gt;&gt;&gt; Jeremy&#xA;&gt;&gt;&gt;&gt;&gt;&#xA;&gt;&gt;&gt;&gt;&gt; --&#xA;&gt;&gt;&gt;&gt;&gt; @JeremyRubin &lt;https://twitter.com/JeremyRubin&gt;&#xA;&gt;&gt;&gt;&gt;&gt; &lt;https://twitter.com/JeremyRubin&gt;&#xA;&gt;&gt;&gt;&gt;&gt; _______________________________________________&#xA;&gt;&gt;&gt;&gt;&gt; bitcoin-dev mailing list&#xA;&gt;&gt;&gt;&gt;&gt; bitcoin-dev at lists.linuxfoundation.org&#xA;&gt;&gt;&gt;&gt;&gt; https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev&#xA;&gt;&gt;&gt;&gt;&gt;&#xA;&gt;&gt;&gt;&gt;&#xA;-------------- next part --------------&#xA;An HTML attachment was scrubbed...&#xA;URL: &lt;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20220118/59a75bc9/attachment-0001.html&gt;</html></oembed>