feat: add OP_RETURN output support for PSET creation #41
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Add support for creating OP_RETURN outputs in PSETs using the
data:<hex>address format.Motivation
When working with Simplicity transactions on Liquid, there are use cases where you need to embed arbitrary data in a transaction output, such as:
Currently,
simplicity pset createonly supports regular addresses and the specialfeekeyword. This PR adds support for OP_RETURN outputs.Usage
To create an OP_RETURN output, use the
data:prefix followed by hex-encoded data:{ "address": "data:534149440101deadbeef", "asset": "6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d", "amount": 0 }This will create a transaction output with the script:
Implementation
OpReturnHexParseerror variant for invalid hex datadata:elements::script::Builderto construct the OP_RETURN scriptTesting
Tested on Liquid Testnet for creating transactions with embedded SAID Protocol identifiers.