joelube.xyz

Cardano Transaction Metadata: What Are the Limits, Encoding Rules, and How Long Does It Stay On-Chain?

Cardano transaction metadata is limited to 64 bytes per entry when using the standard transaction format, supports CBOR encoding for structured data, and is stored permanently on the blockchain as part of the ledger history. Every full node retains the metadata indefinitely, and it is never pruned or deleted.

Metadata Size Limits

A single Cardano transaction can include up to 64 bytes of metadata when submitted as a plain text field. However, this limit applies per metadata entry, not per transaction. If you need to attach more data, you can include multiple metadata entries within one transaction, but each entry must stay under 64 bytes.

The practical limit for a single transaction's total metadata payload depends on the number of entries and the transaction's overall size. Cardano transactions have a maximum size of 16 KB (16,384 bytes) as of the current protocol parameters. Metadata is one component of this limit, alongside inputs, outputs, and any script data. If your metadata entries plus the rest of the transaction exceed 16 KB, the transaction will be rejected.

For structured data, the 64-byte limit applies to the encoded CBOR representation, not the raw human-readable data. A simple key-value pair like {"note": "hello"} might take 15-20 bytes in CBOR, leaving room for additional fields. Complex nested structures will consume the limit quickly.

Encoding Requirements

Metadata on Cardano must be encoded in CBOR (Concise Binary Object Representation). This is a binary format, not JSON or plain text, though many wallets and SDKs handle the conversion automatically.

The CBOR metadata must conform to the Cardano metadata specification, which restricts the allowed CBOR data types. You can use:

Nested structures are allowed, but each level adds to the encoded size. The total encoded CBOR must not exceed 64 bytes per metadata entry.

Most wallet interfaces and development libraries (such as the Cardano CLI, cardano-serialization-lib, or Blockfrost) accept metadata as JSON and convert it to CBOR automatically. If you are building a transaction manually, you must encode the metadata yourself using a CBOR library.

Permanent storage and retrieval

Once a transaction with metadata is included in a block and that block is confirmed, the metadata is part of the permanent blockchain history. Every full node that has synced the chain from genesis retains the metadata in its local database. There is no mechanism to delete or redact metadata from a confirmed transaction.

This permanence has practical consequences:

How to Add Metadata to a Transaction

The process depends on your wallet or development tool. General steps:

  1. Prepare your data in the format you want to attach. Ensure it fits within the 64-byte CBOR limit per entry. If your data is larger, split it across multiple metadata entries or multiple transactions.

  2. Encode the data as CBOR. If using a wallet like Daedalus or Eternl, the wallet handles this. If using the Cardano CLI, you provide a JSON file, and the CLI converts it to CBOR.

  3. Add metadata to the transaction during construction. In the Cardano CLI, use the --metadata-json-file or --metadata-cbor-file flags. In a library like cardano-serialization-lib, call the appropriate method on the transaction builder.

  4. Submit the transaction normally. The metadata is included in the transaction body and recorded on-chain.

Practical Considerations

Checking your metadata after submission

To verify your metadata is on-chain:

Metadata remains readable for the lifetime of the chain. There is no expiration or automatic deletion. If you need data removed, you cannot - plan accordingly.

Not financial advice. joelube.xyz publishes market data and general information about digital assets. Crypto assets are volatile and you can lose everything you put in. Nothing here is a recommendation to buy, sell or hold, and we make no price predictions.

Prices are sourced from third parties and may be delayed or wrong. Verify anything you intend to act on against a primary source.

Back to cardano