Aviral Srivastava
Aviral Srivastava

Reputation: 4582

What is the equivalent of OP_RETURN <data> from Bitcoin in Substrate?

I want to write transactions where two things matter: i) sender's address ii) SHA 256 hash that I want to write

How can I achieve that?

I looked into Bitcoin's transaction types and found out that OP_RETURN is used to write data like transactions and that it is a non-payment type of transaction. I want to know what is the equivalent of this in the Substrate chain?

Upvotes: 0

Views: 186

Answers (1)

JoshOrndorff
JoshOrndorff

Reputation: 1701

When you say two things matter, I'm guessing you mean those are the input parameters. The sender's address is recoverable using Substrate's ensure_signed function. And the SHA256 hash should be passed as a parameter.

You would likely benefit from following the Proof of Existence tutorial in which the learner builds a dApp that tracks proofs of a file's existence. The proof is merely a hash of the file.

Upvotes: 1

Related Questions