<p>Yes, you can commit to data this way, but there is nothing special about Taproot here.</p>
<p>The Pay-to-Contract construction used to tweak the root key in Taproot is generally usable, and has in fact been used for exactly this purpose. In fact, it is one of the mechanisms used in OpenTimestamps to commit to timestamped data (including a variant <a href="https://blog.eternitywall.com/2018/04/13/sign-to-contract/" rel="noreferrer">sign-to-contract</a> which makes a signature commit to data rather than a public key). It is also used in Blockstream's Liquid pegin mechanism, where transfers from Bitcoin to Liquid pay to an address derived using a tweaked key of the federation, which commits to the transfer information.</p>
<p>In fact, using an additional leaf in Taproot for this is overkill, and would inevitably increase the depth in the Merkle tree for at least one other leaf - resulting in increased spending cost. Just using pay-to-contract or sign-to-contract directly on one of the public keys involved can be done with zero cost to on-chain spending policies.</p>
<blockquote>
<p>Would this not significantly reduce the cost of services like colored coins, timestamping services, etc, which commit their data directly onto the chain?</p>
</blockquote>
<p>Decent timestamping services already use better techniques.</p>
<p>For colored coins it depends whether they just need timestamping or actual publication of data. My understanding is that it's generally the latter (as otherwise, they need another censorship-resistant channel to transfer the actual data, which could then probably be used directly).</p>

CC BY-SA 4.0
2021-04-11T17:54:07.710Z
2021-04-11T17:54:07.710Z
Pieter Wuille
<p>A common way of committing some data to the chain is through an OP_RETURN with some hash. Doing this marks an output unspendable, but the output still requires some footprint (and cost) on the chain as it contributes to the TX hash.</p>
<p>So I'm wondering if it is possible to embed some data in an OP_RETURN in a script of a TapLeaf which is never intended to be part of a spend. If we assume that the Taproot output is spent using the key path, and it has already confirmed, it should be possible to later reveal the paths and scripts containing the OP_RETURNs, and it could be proven that the TapTweak hash did indeed commit to these hashes via the TapBranch hashes.</p>
<p>A single transaction could commit to a large number of OP_RETURNs which have no on-chain outputs, but whose hashes are indirectly committed to the chain. These could be revealed individually to whatever parties they concern. The paths and scripts would have no presence on the blockchain.</p>
<p>Maybe this doesn't even require the OP_RETURN as you could just use the TapBranch/TapLeaf hash itself as the data you wish to commit.</p>
<p>Would this not significantly reduce the cost of services like colored coins, timestamping services, etc, which commit their data directly onto the chain?</p>

<timestamp><op-return><taproot><colored-coins>
Can Taproot be used to commit arbitrary data to chain without any additional footprint?
Mark H
# Can Taproot be used to commit arbitrary data to chain without any additional footprint?

(Asked by: username_0 on 2021-04-11)

A common way of committing some data to the chain is through an OP\_RETURN with some hash. Doing this marks an output unspendable, but the output still requires some footprint (and cost) on the chain as it contributes to the TX hash.

So I'm wondering if it is possible to embed some data in an OP\_RETURN in a script of a TapLeaf which is never intended to be part of a spend. If we assume that the Taproot output is spent using the key path, and it has already confirmed, it should be possible to later reveal the paths and scripts containing the OP\_RETURNs, and it could be proven that the TapTweak hash did indeed commit to these hashes via the TapBranch hashes.

A single transaction could commit to a large number of OP\_RETURNs which have no on-chain outputs, but whose hashes are indirectly committed to the chain. These could be revealed individually to whatever parties they concern. The paths and scripts would have no presence on the blockchain.

Maybe this doesn't even require the OP\_RETURN as you could just use the TapBranch/TapLeaf hash itself as the data you wish to commit.

Would this not significantly reduce the cost of services like colored coins, timestamping services, etc, which commit their data directly onto the chain?

**Tags:** timestamp, op-return, taproot, colored-coins


---

## 1 answers

### Answer by username_1 on 2021-04-11. Score: 6 | Accepted answer

Yes, you can commit to data this way, but there is nothing special about Taproot here.

The Pay-to-Contract construction used to tweak the root key in Taproot is generally usable, and has in fact been used for exactly this purpose. In fact, it is one of the mechanisms used in OpenTimestamps to commit to timestamped data (including a variant [sign-to-contract](https://blog.eternitywall.com/2018/04/13/sign-to-contract/) which makes a signature commit to data rather than a public key). It is also used in Blockstream's Liquid pegin mechanism, where transfers from Bitcoin to Liquid pay to an address derived using a tweaked key of the federation, which commits to the transfer information.

In fact, using an additional leaf in Taproot for this is overkill, and would inevitably increase the depth in the Merkle tree for at least one other leaf - resulting in increased spending cost. Just using pay-to-contract or sign-to-contract directly on one of the public keys involved can be done with zero cost to on-chain spending policies.

> Would this not significantly reduce the cost of services like colored coins, timestamping services, etc, which commit their data directly onto the chain?

Decent timestamping services already use better techniques.

For colored coins it depends whether they just need timestamping or actual publication of data. My understanding is that it's generally the latter (as otherwise, they need another censorship-resistant channel to transfer the actual data, which could then probably be used directly).


---

