Skip to content

Instantly share code, notes, and snippets.

@EyeOfPython
Last active October 8, 2020 15:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EyeOfPython/6da1e2be740666c4e6c85f76c29a5a6a to your computer and use it in GitHub Desktop.
Save EyeOfPython/6da1e2be740666c4e6c85f76c29a5a6a to your computer and use it in GitHub Desktop.

OP_RETURN Metaprotocol

Motivation

This protocol aims to solve the problem that multiple OP_RETURN outputs would solve but without changing the BCH standardness rules.

One aim is to be compatible with SLP such that existing SLP UTXOs will not be burned by un-upgraded wallets.

Specification

  1. Each sub-protocol is one PUSHDATA operation after the OP_RETURN. PUSHDATA operations don’t have to be minimally encoded, i.e. the minimal encoding rules that apply in a scriptSig don’t apply here. This simplifies interaction with Script.
  2. Each sub-protocol must be at least four bytes, which encode the LOKAD ID. All following bytes encode arbitrary payload, which are sub-protocol specific.
  3. Any PUSHDATA operation that is less than four bytes will be ignored and discarded.

Notes

If a sub-protocol with no payload appears as the first sub-protocol, this could be problematic for existing infrastructure which could confuse it with an existing LOKAD ID encoding and should therefore be avoided. However, it is still valid encoding and should be regarded as valid by implementations of this protocol.

SLP Compatibility

The SLP encoding will change:

OP_RETURN 0x04 SLP\0 0x01 <SLP version BITOR 0x10> PUSH_N <SLP payload>

The first SLP push op plus version byte will be detected by existing wallets, thus preventing burns.

The SLP payload will have its own LOKAD ID (perhaps SLP\1) to be compatible with the Metaprotocol, and then contain the same data as the original SLP protocol after the version byte(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment