[CHIP] Unforgeable Groups V6.0 Decentralized Applications on Bitcoin Cash
<!-- SC_OFF --><div class="md"><p>About a week ago Jason had pinged me and gave me a heads up that he&#39;s working on something, and today he has <a href="https://old.reddit.com/r/btc/comments/sz0q1g/chip_cashtokens_v2_token_primitives_for_bitcoin/">announced that something</a>, and it resembles Group Tokens quite a bit, which is great! Great because he built it from scratch and independently arrived to something very similar, and to me it&#39;s a validation of the Group approach :)</p> <p>I am also thankful to him, because his ping prompted me to revisit <a href="https://gitlab.com/0353F40E/group-tokenization/-/issues/19">Thomas Zander&#39;s idea</a> of using the TXID as the groupID (or categoryID), and looking at that part of &quot;idea space&quot; again, I discovered something better than I could have imagined, a facility that could seamlessly let us transition from contract to contract from commitment to commitment from token to token.</p> <p>I held off broadly announcing V6.0 because I was waiting to see what Jason&#39;s been working on, and I find it cool that it&#39;s so similar, because its an independent validation of the Group approach :)</p> <p>I&#39;ve been bouncing Group for months now, and we really worked hard to making the consensus layer as simple as possible, and I think that with V6.0 we can implement everything CT2.0 promises while keeping consensus layer simple and using Script for the flexibility it provides.</p> <p>Without furder ado, copying the <a href="https://bitcoincashresearch.org/t/chip-2021-02-group-tokenization-for-bitcoin-cash/311/53">announcement</a> from research forum.</p> <p><a href="https://gitlab.com/0353F40E/group-tokenization/-/merge_requests/18">MAJOR UPDATE - 6.0</a></p> <p>This was prompted by exchanging notes with @bitjson and revisiting @tom &#39;s idea of <a href="https://gitlab.com/0353F40E/group-tokenization/-/issues/19">declaring the genesis</a>, and it enables group tokens to interact so much better with Script!</p> <p>Changes:</p> <ul> <li>Whole new approach to group genesis: instead of inferring it from the TX, it will be explicitly declared as an input prefix that can use the same byte because it will be exclusive to input context.</li> <li>One more introspection opcode to access the genesis input&#39;s generated <code>groupID</code> preimage.</li> <li>Change group amount format from VarInt to fixed width uint.</li> </ul> <p>Instead of inferring genesis from orphan outputs and allowing orphans only if the groupID matches the hash, we require the genesis to be declared on the inputs, conceptually similar to a coinbase input. A new introspection opcode is added to access the input&#39;s genesis preimage. Advantages:</p> <ul> <li>enables flexibility in deciding which input will be a genesis input</li> <li>enables flexibility in deciding which input&#39;s prevout will be committed to for later use in smart contracts</li> <li>enables better interaction with contracts requiring or verifying the genesis operation</li> <li>removes malleability from group genesis (outputs are signed, and orphans disallowed)</li> <li>more consistent with Bitcoin design (coinbase input)</li> <li>enables versioning the genesis preimage construction without having to spend scarce group type bits which will be reserved for potential &quot;super-contract&quot; optimizations in the future</li> <li>opens the path to a future upgrade where user-defined parts of the genesis TX could be appended to the preimage</li> <li>enables a dedicated genesis nonce field which simplifies grinding the group type, making the group type encoding time-space trade-off more convenient</li> <li>opens the path to synergies with detached proofs and signatures, where hash of the real unlocking script could be appended to the groupID preimage</li> </ul> <p>Example - &quot;Jason&#39;s Challenge&quot; Contract - <a href="https://ide.bitauth.com/import-template/eJzVWgtv2zgS_iuE94BrgTQl9aCkogig2HKTazb22U6vxe3BoCQq1sWWfJKcBxb7329ISrIedpruXW976cMyORzODGeG34zy6-BPebDiGzZ4N1gVxTZ_9_atHxdsV6xOg3TzVk3mb8UAT4o4YEWcJm8KvtmuWcHf3ONTRXL6zzxNBieDkOdBFm8FFbBcrDja5TxDW_aUI4JPMMYoZ0War-IcFSm65QVi8HDHk1ME1E8oYAkqMpbkESwrVqxQs4IYOCHtTRq90U-QEAf5LLgTE3mc3K45fNyWEyHfpnlciC_lcpaEcjO1ZMXjrCdOlKUbuWLLMtAVBek9T1hSnIJaCdtw0OcvDLT8c46GK7Ze8-SWw5QwSxHzfPDu199OBkp78WVQCpFmT8sgzbZpxpRVfq24jbzpZH65mMy-oOFkNp3M3MXl5HpQMQGKt2_RT-gmWafBHaiI5nL8lwSGF1Irf5clKN0V212B4iTkj78k7_EjJmeSZsqyAumnKI3QbZbutpcjtM14vGG3HL265QnPQes4EYtBZZCp4Fn-WrGofgjGdkiI-Gz-NDYgRzZYsXwlZ5obge2A4h5ERhmPTtVmnDq-jUPTCCxs-Bo2iKFj2wkMjjHnNo2YyYzIdiz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BKbbbjv9LSyAR1DdrPA5UHv8CGvTrx2ZD-b-WVcvMWbu547uKzPLvhwUAnhxhozzDQuo5_iIH-DAO9w0A_lJMPHEVtuuNnMfhN_FbWbrtNM6hxB-_-PjgfXiw1rOElNgf_OBmUDaPBO_zbvwFJIRAf">Link to Bitauth IDE Template</a></p> <blockquote> <p>The user pays 10,000 satoshis to get a token. They can transfer that token to use 2-of-3, then back to single sig, then deposit the token and get back their 10,000 satoshis from the parent covenant.</p> </blockquote> <p>There are 2 contracts:</p> <ol> <li><p>NFT, placed on the prevout which will be spent as group genesis input and generate the NFT. The prevout script will require that 10,000 sats are paid into a fixed P2SH address (depository corporation covenant). Only the 1st spend is from a P2SH, the genesis input spend: the NFT can then be moved to an ordinary P2PKH and still be able to reclaim the 10,000 by burning itself in the same TX as <em>any</em> covenant UTXO.</p></li> <li><p>The depository corporation covenant is an anyone-can-spend kind of thing, but it requires <em>any</em> NFT that can satisfy the proof of payment at genesis to be burned to an OP_RETURN. The NFT&#39;s genesis script is verified to match the template hardcoded in the P2SH covenant.</p></li> </ol> <p>Not only does this create a BCH-backed NFT, it also lets NFT holders reclaim the BCH from <em>any</em> covenant UTXO :) I suspect there&#39;s a way to make some kind of BCH mixer based on this.</p> <p>PS, for comparing the 2 proposals, consider how CT2.0 and Group map to each other:</p> <p><code>&lt;category_id&gt; -&gt; groupID</code> <code>&lt;has_nonfungible&gt; -&gt; groupType</code> <code>commitment_length, commitment -&gt; subGroup (dropped feature)</code> <code>amount -&gt; groupAmount</code></p> <p>and we worked for months on simplifying group, so we have only 1 groupType and any custom behavior should be done by Script</p> <p>and now this proposal introduces 5 types on the consensus layer...</p> <p>PPS We can have &quot;standard&quot; tokens, a P2SH covenant can require a particular genesis setup, and indexers could scan that one P2SH address and auto-magically add tokens to their database whenever someone spends from the covenant</p> <p>Preview: <a href="https://ide.bitauth.com/import-gist/e81d32df9fa36c4fa961e8065e5a01a1">https://ide.bitauth.com/import-gist/e81d32df9fa36c4fa961e8065e5a01a1</a></p> </div><!-- SC_ON --> &#32; submitted by &#32; <a href="https://www.reddit.com/user/bitcoincashautist"> /u/bitcoincashautist </a> <br/> <span><a href="https://www.reddit.com/r/btc/comments/szdf7c/chip_unforgeable_groups_v60_decentralized/">[link]</a></span> &#32; <span><a href="https://www.reddit.com/r/btc/comments/szdf7c/chip_unforgeable_groups_v60_decentralized/">[comments]</a></span>