OP_RETURN inside TapScript [combined summary]



Individual post summaries: Click here to read the original discussion on the bitcoin-dev mailing list

Published on: 2022-03-21T11:00:38+00:00


Summary:

With the activation of Taproot, it is now possible to attach data to a transaction by creating an "OP_RETURN" branch in the TapScript. This eliminates the need for separate OP_RETURN outputs and allows for more than 80 bytes of data to be stored for free. The data can be stored off-chain but will always be connected to a taproot address that was pushed on-chain. It's important to note that this capability has always existed and is not specific to tapscript.Committing to an ECC point enables data to be stored inside it, including P2PK and P2PKH. It is also possible to commit to large amounts of data, such as 1.5GB, using OP_RETURN or even an entire merkle tree of hashes. However, altering an ECC point, including tapscript, in non-deterministic ways can make it more difficult to recover from backup because the key cannot be recovered without knowing the full commitment.While "OP_RETURN" in TapScript allows for data attachment, it differs from OP_RETURN as the user must communicate out-of-band to reveal the commitment. In contrast, with OP_RETURN, the data is immediately visible. The immediate visibility of data is utilized by various colored coin protocols and BIP47.The question arises whether the implementation should be changed to place the "data" field in "createrawtransaction" into a TapScript instead of creating a separate OP_RETURN output. Currently, Bitcoin Core has a "data" field in "createrawtransaction". By placing this data in a TapScript, it would be possible to eliminate the need for a separate OP_RETURN output and simplify the process of attaching data to a transaction.In summary, Taproot allows for the attachment of data to a transaction by creating an "OP_RETURN" branch in the TapScript. This eliminates the need for separate OP_RETURN outputs and enables more than 80 bytes of data to be stored for free. The implementation may need to be changed to place the "data" field in "createrawtransaction" into a TapScript, streamlining the process of attaching data to a transaction.


Updated on: 2023-08-02T05:43:57.141649+00:00