This forum is a read-only archive. Posting, replying and signing in are disabled.

Write readable note in message pack

Leonidas

Hi guys,
I tried to write the “notes” field following this tutorial (py)
https://developer.algorand.org/tutorials/v2-read-and-write-transaction-note-field-python/

Everything works fine, but the message is readable in Editor View (divided into 16-byte blocks).

Then I saw this transaction
https://algoexplorer.io/tx/44S5DIVZCEWSULBN47CMSDKPV2JXNAO5OGXIGCTJVJF6LTSTMTXA

where a clear message is readable in “Message Pack”.
How do I get this result in a normal transaction?

Sorry if the question is trivial, I’ve searched around, but I can’t figure it out.

Thanks :slight_smile:

✔ Solved by fabrice in post #2
fabrice

To get it readable in “Message Pack”, you need to encode your object in MessagePack format.
In Python:

import base64
import algosdk

note = base64.b64decode(algosdk.encoding.msgpack_encode({
    "firstName": "John",
    "lastName": "Doe"}
))
✔ Solution
Leonidas

Oh my. I was so close, now I feel dumb. Thank you very much mate! :slight_smile:

Tim

Don’t feel bad, how to encode and decode and puzzle out what was done to some value will haunt you everywhere in your journal into cryptocurrencies… I’ve spent days poking at it.