What command-line options and input file content can I provide to cardano-cli transaction build-raw to specify a transaction with metadata similar to the one in this transaction? https://explorer.cardano.org/en/transaction?id=ff126032aeccf0079a02168f9810a81d9632a8ac34e50cad278771be2423aa86

I initially thought that I just needed to give --metadata-json-file a JSON file with the corresponding desired JSON content (like the JSON show under 'metadata' on the webpage), but that just gives an error message about integer keys. In the Transaction Metadata reference for cardano-node, it says that the top-level keys must be integers, but I don't understand the significance or meaning of the values of the top-level integer keys or how the whole thing relates to an actual JSON I want to appear in the explorer.cardano.org transaction webpage.

2 Answers 2


Looks like you are using the CLI correctly, and the question was really about the NFT metadata standard. The usage of "721" as the top level key is to be compatible with Etherium token metadata and 3rd party sites that showcase ETH NFTs.

Alessandro of BERRY/SpaceBudz is the one who proposed this as a CIP on the Cardano forums and it seems to have been widely adopted at this point.

Edit: See also Is there a metadata standard for native assets (talking about fungible tokens first) in Cardano?


I still do not know the meaning of the values given to top-level integer keys, but I was able to get cardano-cli transaction build-raw to work by putting my original JSON as a value of a top-level integer key of 721. On cardanoscan.io, I noticed that the metadata has a 'label', which explorer.cardano.org lacks. I surmised that the label is the top-level integer key, but I don't know of a way to confirm that.

So the short answer is that the JSON given to cardano-cli must be an object with integer keys.

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.