The transaction metadata lives outside of the transaction body, inside of the auxiliary_data
. In the Babbage ledger era, you can see this in the wire spec (CDDL)
here
In particular, the metadata is defined
here.
In Haskell, you can see that the metadata is
defined
as a map from Word64
to Metadatum
.
(I've chosen the Alonzo auxiliary data type to link to here, which is re-used by the Babbage era).
And Metadatum
is the JSON-like structure defined
here.
Note that the transaction metadata is a different type than the Datum
type used by Plutus, though the structure is nearly identical. (txData
contains Datum
, not Metadatum
.)
CIP-25 is provides a schema for expressing NFT Metadata within the transaction metadata. So in particular, it specifies using the number 721
as the transaction metadatum label ( a reference to the Ethereum NFT standard ERC-721 ), and proceeds to specify the rest of the structure. The cardano-cli
is capable of converting JSON metadata files into the correct wire format, and attaching it to a transaction (with the hash in the transaction body, so that it cannot be corrupted).