OP_RETURN inside TapScript



Summary:

The bitcoin-dev mailing list recently discussed reducing the footprint of storing data on-chain by supporting raw data storage without creating a transaction. Currently, data is stored within an OP_RETURN in a transaction structure, which is deemed wasteful. However, if raw data can be stored without creating a transaction, waste can be reduced. It is expected that storing data this way will only be marginally cheaper per on-chain byte than the current method. This is done to disincentivize the use of OP_RETURN and achieve a smaller footprint for on-chain data without making it cheaper. Taproot has eliminated the need for separate OP_RETURN outputs to be pushed on-chain, and instead, it allows for "OP_RETURN" as a branch in the TapScript. This enables the storage of data off-chain while proving that it is connected with some taproot address that was pushed on-chain. There is currently a "data" field in "createrawtransaction" in Bitcoin Core, but the implementation may need to be changed to place that data in a TapScript instead of creating a separate OP_RETURN output.


Updated on: 2023-06-15T17:14:39.537734+00:00