Is there a size limit on transaction metadata?
If there is a limit, is it varying or fixed size?
Cardano Stack Exchange is a question and answer site for users and developers of the Cardano cryptocurrency ecosystem. It only takes a minute to sign up.Sign up to join this community
Here is an important note regarding Tx metadata:
There is no limit on the number of key-value pairs (except the overall transaction size limit) or on individual structured values. However, there is a limit on the size of text strings and byte strings within the structured values, which is implemented to mitigate the problem of unpleasant or illegal content being posted to the blockchain.
At the moment maxTxSize = 16384 bytes (including metadata).
If we talk about the max number of characters in a 16 KB text file with UTF-8 encoding (8-bit), then this is 16384 characters, since each character weighs exactly 1 byte. This is more than enough, to describe transaction's body and add a reach metadata to it.
During Basho era the size of Tx might be increased up to 512 KB.
Values change, so this is safe for the current parameters:
$ cardano-cli query protocol-parameters --mainnet | jq .maxTxSize 16384
But these are in flux, so you can try to be mindful of upcoming changes. Metadata is so versatile that if it didn't get larger there would probably be a way to deal with this, but it's in as much flux as many of the other pool parameters.
I don't know the best way to stay on top of these changes.