Decode transaction note - General - Algorand
Decode transaction note
post by bayuobie on Jan 27, 2021
How do decode an encoded transaction note using the Javascript SDK? For example, to send a note to the chain, the note is encoded as
algosdk.encodeObj(“monthly payment”);
Is there a complementary function to decode this encoded text using the SDKs?
post by fabrice on Jan 27, 2021
A note can contain arbitrary bytes.
The applications can choose to use the format of their choice, such as JSON, msgpack, … or a proprietary format.
However, using algosdk.encodeObj is indeed recommended (which is a canonical version of msgpack).
The reverse operation is algosdk.decodeObj.
post by JasonW on Jan 27, 2021
In addition to what Fabrice said, if you intend to use the indexer to search this note, encoding the note should not be done though, if using the js sdk. You can just convert to uint8 array.