user15378: According to
Understanding how ordinals work with the Bitcoin blockchain. What is exactly stored on the blockchain?
you can add data to the unexecuted branch of a taproot input like so:
OP_0
OP_IF
(embedded data comes here)
OP_ENDIF

How would I go about creating such transaction using bcoin or btcwallet?

user3667: You can create any kind of script spend with bcoin but for taproot you will need to use the taproot branch which has not yet been sufficiently reviewed or released. You can follow along with this test to learn how to add a script to a taproot tree, derive the address, send BTC to it and then spend it, revealing the witness

15378: <p>According to</p>
<p><a href="https://bitcoin.stackexchange.com/questions/117018/understanding-how-ordinals-work-with-the-bitcoin-blockchain-what-is-exactly-sto">Understanding how ordinals work with the Bitcoin blockchain. What is exactly stored on the blockchain?</a></p>
<p>you can add data to the unexecuted branch of a taproot input like so:</p>
<pre><code>OP_0
OP_IF
(embedded data comes here)
OP_ENDIF
</code></pre>
<p>How would I go about creating such transaction using bcoin or btcwallet?</p>
 3667: <p>You can create any kind of script spend with bcoin but for taproot you will need to use the <a href="https://github.com/bcoin-org/bcoin/tree/taproot" rel="nofollow noreferrer">taproot branch</a> which has not yet been sufficiently reviewed or released. You can follow along with <a href="https://github.com/bcoin-org/bcoin/blob/taproot/test/taproot-check-test.js#L110" rel="nofollow noreferrer">this test</a> to learn how to add a script to a taproot tree, derive the address, send BTC to it and then spend it, revealing the witness</p>
