3

I'm looking for a way to store information (few bytes) in a Tezos transaction, on BTC I'm using OP_RETURN field but is there a similar field in Tezos transactions ?

3

It depends on what you're trying to do. Are you sending these transactions to anyone? To a specific address?

In the most general case, you could take advantage of the fact that Tezos transactions are batches by default. Whenever you create a transaction, you would add another transaction to the operation that passes a bit of information to a smart-contract. The smart-contract itself need not do anything with that information, it can just drop it and return, for example:

parameter bytes;
storage unit;
code {CDR; NIL operation; PAIR};

Support for batch operations is currently lacking in the command-line interface, but here's a blog post explaining how you can create them with RPC calls

https://medium.com/@bakenrolls/sending-multiple-transactions-in-one-batch-using-tezos-rpc-6cab3a21f254


This will do the job but it wouldn't be a bad idea to add native support for a memo field in transactions in future protocol versions.

3
  • I'm trying to send these transactions to a specific address in order to keep a trace of the memo content. Currently I'm evaluating two possibilities, either adding this memo in a transaction or record it into a dedicated smart contract
    – tiamat
    May 5 '20 at 6:36
  • As a rule of thumb, it's a good idea not to record any data on the chain unless the validity of a future transaction will depend on that data. If all you need is to track that it happened, you may just as well pass that data as a parameter to your transactions but not store it.
    – Arthur B
    May 5 '20 at 7:03
  • indeed, this is the reason why I'm looking for the best way to pass data as parameter ;-)
    – tiamat
    May 5 '20 at 8:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.