Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using OP_DROP to identify data to pass to Stacks #4

Open
whoabuddy opened this issue Feb 16, 2023 · 0 comments
Open

Using OP_DROP to identify data to pass to Stacks #4

whoabuddy opened this issue Feb 16, 2023 · 0 comments

Comments

@whoabuddy
Copy link
Contributor

The idea here is similar to the generic data import proposal from Jude/Pavi, where a specially crafted OP_RETURN would result in miner's putting data into a clarity smart contract. (GitHub issue)

Miners would be the only ones who can write to it, and it would be available to Stacks contracts similar to how the boot contracts are now. The design would be simple: a preamble to identify the tx and a blob of data.

This sounds very similar to how Ordinal Theory defines their Bitcoin scripts with OP_PUSH, e.g.

OP_FALSE
OP_IF
  OP_PUSH "ord"
  OP_1
  OP_PUSH "application/json"
  OP_0
  OP_PUSH ...data...
OP_ENDIF

Instead of using OP_RETURN, Hank recommended OP_DROP in the Stacks forum and a few conversations, which allows the data to be appended to a valid transaction.

One example was including a SIP-018 signed message, which the user could implicitly sign by sending dust to it.

# metadata:
${sip18MessageHash} OP_DROP
# allow sending the bitcoin back:
${temporarySenderPubKey} OP_CHECKSIGVERIFY

Another example from the Magic protocol:

OP_PUSHBYTES_4 ${swapperId}
OP_DROP
OP_IF
  OP_SHA256 OP_PUSHBYTES_32 ${hash}
  OP_EQUALVERIFY
  OP_PUSHBYTES_33 ${supplierPublicKey}
OP_ELSE
  OP_PUSHBYTES_2 f401
  OP_CSV
  OP_DROP
  OP_PUSHBYTES_33 ${swapperPublicKey}
OP_ENDIF
OP_CHECKSIG

What if we used an approach that combined the use of OP_DROP for our purposes and the standard inscription script?

This could be done manually at first and interpreted by a client, and if fed directly into a Clarity contract by miners, would create a valid index on both networks where data would be accessible directly to Clarity contracts without having to query Bitcoin transactions or state.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant