6

Is there a size limit on transaction metadata?

If there is a limit, is it varying or fixed size?

2 Answers 2

10

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.


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.


P.S.

During Basho era the size of Tx might be increased up to 512 KB.

4
  • 1
    Clarifying: The 16384 bytes is inclusive of everything in the transaction, not just the metadata correct?
    – Frank C.
    Commented Oct 15, 2021 at 10:20
  • 1
    Yes, exactly....
    – user4023
    Commented Oct 15, 2021 at 10:28
  • 1
    @AndyJazz, I need to buy you a beer! Found your answer after hours of debugging.... Thanks you are awesome!
    – tjacks3
    Commented Dec 10, 2021 at 21:46
  • Thanx @tjacks3, nice drink!
    – user4023
    Commented Dec 10, 2021 at 22:12
2

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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