<oembed><type>rich</type><version>1.0</version><author_name>npub1q86n5vtxkwerzwfqza3hwls8pl8764244464talfqy2vpj0qaz6q38qwta</author_name><author_url>https://nostr.ae/npub1q86n5vtxkwerzwfqza3hwls8pl8764244464talfqy2vpj0qaz6q38qwta</author_url><provider_name>njump</provider_name><provider_url>https://nostr.ae</provider_url><html>📅 Original date posted:2022-01-01&#xA;📝 Original message:Happy new years devs,&#xA;&#xA;I figured I would share some thoughts for conceptual review that have been&#xA;bouncing around my head as an opportunity to clean up the fee paying&#xA;semantics in bitcoin &#34;for good&#34;. The design space is very wide on the&#xA;approach I&#39;ll share, so below is just a sketch of how it could work which&#xA;I&#39;m sure could be improved greatly.&#xA;&#xA;Transaction fees are an integral part of bitcoin.&#xA;&#xA;However, due to quirks of Bitcoin&#39;s transaction design, fees are a part of&#xA;the transactions that they occur in.&#xA;&#xA;While this works in a &#34;Bitcoin 1.0&#34; world, where all transactions are&#xA;simple on-chain transfers, real world use of Bitcoin requires support for&#xA;things like Fee Bumping stuck transactions, DoS resistant Payment Channels,&#xA;and other long lived Smart Contracts that can&#39;t predict future fee rates.&#xA;Having the fees paid in band makes writing these contracts much more&#xA;difficult as you can&#39;t merely express the logic you want for the&#xA;transaction, but also the fees.&#xA;&#xA;Previously, I proposed a special type of transaction called a &#34;Sponsor&#34;&#xA;which has some special consensus + mempool rules to allow arbitrarily&#xA;appending fees to a transaction to bump it up in the mempool.&#xA;&#xA;As an alternative, we could establish an account system in Bitcoin as an&#xA;&#34;extension block&#34;.&#xA;&#xA;*Here&#39;s how it might work:*&#xA;&#xA;1. Define a special anyone can spend output type that is a &#34;fee account&#34;&#xA;(e.g. segwit V2). Such outputs have a redeeming key and an amount&#xA;associated with them, but are overall anyone can spend.&#xA;2. All deposits to these outputs get stored in a separate UTXO database for&#xA;fee accounts&#xA;3. Fee accounts can sign only two kinds of transaction: A: a fee amount and&#xA;a TXID (or Outpoint?); B: a withdraw amount, a fee, and an address&#xA;4. These transactions are committed in an extension block merkle tree.&#xA;While the actual signature must cover the TXID/Outpoint, the committed data&#xA;need only cover the index in the block of the transaction. The public key&#xA;for account lookup can be recovered from the message + signature.&#xA;5. In any block, any of the fee account deposits can be: released into fees&#xA;if there is a corresponding tx; consolidated together to reduce the number&#xA;of utxos (this can be just an OP_TRUE no metadata needed); or released into&#xA;fees *and paid back* into the requested withdrawal key (encumbering a 100&#xA;block timeout). Signatures must be unique in a block.&#xA;6. Mempool logic is updated to allow attaching of account fee spends to&#xA;transactions, the mempool can restrict that an account is not allowed more&#xA;spend more than it&#39;s balance.&#xA;&#xA;*But aren&#39;t accounts &#34;bad&#34;?*&#xA;&#xA;Yes, accounts are bad. But these accounts are not bad, because any funds&#xA;withdrawn from the fee extension are fundamentally locked for 100 blocks as&#xA;a coinbase output, so there should be no issues with any series of reorgs.&#xA;Further, since there is no &#34;rich state&#34; for these accounts, the state&#xA;updates can always be applied in a conflict-free way in any order.&#xA;&#xA;&#xA;*Improving the privacy of this design:*&#xA;&#xA;This design could likely be modified to implement something like&#xA;Tornado.cash or something else so that the fee account paying can be&#xA;unlinked from the transaction being paid for, improving privacy at the&#xA;expense of being a bit more expensive.&#xA;&#xA;Other operations could be added to allow a trustless mixing to be done by&#xA;miners automatically where groups of accounts with similar values are&#xA;trustlessly  split into a common denominator and change, and keys are&#xA;derived via a verifiable stealth address like protocol (so fee balances can&#xA;be discovered by tracing the updates posted). These updates could also be&#xA;produced by individuals rather than miners, and miners could simply honor&#xA;them with better privacy. While a miner generating an update would be able&#xA;to deanonymize their mixes, if you have your account mixed several times by&#xA;independent miners that could potentially add sufficient privacy.&#xA;&#xA;The LN can also be used with PTLCs to, in theory, have another individual&#xA;paid to sponsor a transaction on your behalf only if they reveal a valid&#xA;sig from their fee paying account, although under this model it&#39;s hard to&#xA;ensure that the owner doesn&#39;t pay a fee and then &#39;cancel&#39; by withdrawing&#xA;the rest. However, this could be partly solved by using reputable fee&#xA;accounts (reputation could be measured somewhat decentralized-ly by&#xA;longevity of the account and transactions paid for historically).&#xA;&#xA;*Scalability*&#xA;&#xA;This design is fundamentally &#39;decent&#39; for scalability because adding fees&#xA;to a transaction does not require adding inputs or outputs and does not&#xA;require tracking substantial amounts of new state.&#xA;&#xA;Paying someone else to pay for you via the LN also helps make this more&#xA;efficient if the withdrawal issues can be fixed.&#xA;&#xA;*Lightning:*&#xA;&#xA;This type of design works really well for channels because the addition of&#xA;fees to e.g. a channel state does not require any sort of pre-planning&#xA;(e.g. anchors) or transaction flexibility (SIGHASH flags). This sort of&#xA;design is naturally immune to pinning issues since you could offer to pay a&#xA;fee for any TXID and the number of fee adding offers does not need to be&#xA;restricted in the same way the descendant transactions would need to be.&#xA;&#xA;*Without a fork?*&#xA;&#xA;This type of design could be done as a federated network that bribes miners&#xA;-- potentially even retroactively after a block is formed. That might be&#xA;sufficient to prove the concept works before a consensus upgrade is&#xA;deployed, but such an approach does mean there is a centralizing layer&#xA;interfering with normal mining.&#xA;&#xA;&#xA;Happy new year!!&#xA;&#xA;Jeremy&#xA;&#xA;--&#xA;@JeremyRubin &lt;https://twitter.com/JeremyRubin&gt;&#xA;&lt;https://twitter.com/JeremyRubin&gt;&#xA;-------------- next part --------------&#xA;An HTML attachment was scrubbed...&#xA;URL: &lt;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20220101/4cd5c38b/attachment.html&gt;</html></oembed>