Skip to content

Taproot OP_RETURN commitments #895

@dr-orlovsky

Description

@dr-orlovsky

Taproot OP_RETURN script leaf, added at specific position to the script merkle tree, may act as an efficient way of committing to certain off-chain (client-side-validated) data. It does not require tweaking of public keys to spend the output (like in other P2C schemes), which simplifies wallet creation.

The use case for adding taproot OP_RETURN commitment is to insert an additional leaf to an already-defined Merkle tree taken from a certain wallet descriptor with all keys derived. This means adding additional branch to TaprootSpendInfo without using TaprootBuilder or miniscript. Currently, TaprootSpendInfo does not allow that: all fields are private and modification of the ScriptMerkleProofMap in it is not possible.

The use case I have with client-side-validation (RGB) requires the commitment to be present in a well-defined place, such that it can be proven that no alternative commitment may exist in the same output. The optimal is to put the commitment as the last leaf in the Mekrle tree. I propose to add a dedicated method TaprootSpendInfo::push_script_leaf that allows to do that modification. After discussion here I will work on the PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    minor API ChangeThis PR should get a minor version bump

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions