Size of metadatahash

Hello everyone :blush:

After consulting the documentation, I realize that “metadatahash” field is designed to receive 32 bytes… or 64 characters I guess… the result of a SHA-256 hash for example.

What happens if I try to send more than 64 characters in this field ? Does the transaction work ? Is my string truncated ?

I could of course do some tests in testnet mode but I prefer to ask the question directly.

I thank you in advance and wish you a good day :yum:

Welcome to Algorand!

The network will only accept 32-byte metadata field. If you force more bytes or fewer bytes, it will just reject the transaction. I’m not completely sure what the SDK is doing in this case though.

Note that 32 bytes correspond to 32 UTF-8 or ASCII characters.

PS: I’ve moved the post to a new topic as it’s a slightly different question

1 Like

Hello, I’m back ! :sweat_smile:

It’s OK, my huge SHA is now stored in metadatahash field :smiling_imp:

Although the displayed value is base64 formatted, do you know if the blockchain stores the sent value or this base64 formatted variation?

Relevant question as I would like to know how to search/display assets that contain a specific value in the MetaDataHash field.

The web interface of Algoexplorer.io (for example) does not search in this field and their API does not seem to offer much more possibilities at this level… difficult to be sure of what I say.

Here are my questions of the moment… if a charitable soul could inform me on these few points… I would be infinitely grateful… probably for centuries and centuries :pray:

Thanks again and have a nice day!

The blockchain always store raw data (that is raw 32-byte string).
Base64 is just for display/API output.

To my knowledge, the official indexer does not support this either.
So you would most likely need to either query the indexer DB directly (most likely adding the right index) or use conduit (https://github.com/algorand/indexer/blob/develop/docs/Conduit.md).

1 Like