dxnft
14 October 2021 21:20
1
Hello, am following the cardano NFT guide on the developer portal and have a question:
IF i wanted to add “traits” or “abilities” to the meta data, is it as simple as :
abilities: [
"any_info_here",
"any_info_here_2",
“any_info_here_3”,
],
type: “anything”
notice “abilities” and “type” in the script. Do I have to define these somewhere in a script or something or I can just add these in the metadat?
Yes, you can use any valid JSON or CBOR formatted metadata you want.
Edit:
There is also a hard limit of 16kb per transaction and this includes the metadata. It would be cost prohibitive to mint tokens with MB of data directly even if it was supported. If you need a lot of data or want an image it’s best to pin it with IPFS or equivalent and then simply inlcude the hash link in the token metadata. This is what most NFT do currently to include image data …
See also the metadata readme:
# Transaction Metadata
Transaction metadata (tx metadata) can contain details about a specific transaction, including sender and receiver IDs, transaction comments, and tags. Adding metadata to transactions provides transaction information by adding arbitrarily structured data onto the chain and is a useful feature in Cardano Shelley. Tx metadata is stored on-chain and is carried along with each transaction. A factor in its design is that the on-chain metadata is not stored in the ledger state and does not influence transaction validation, thereby not compromising ledger performance.
Tx metadata is a valuable feature for developers who build applications and process transactions, and for application end users. Developers embed metadata directly and submit a valid transaction with accompanying details. End users don’t interact with the tx metadata directly, but can view transaction-specific metadata using the Cardano Explorer.
For example, tx metadata can be used to:
+ certify ownership and exchange of assets specifying asset owners in different time periods, transfer details, or asset value at the time of transfer
+ certify documents and signatures, by using a public hash that proves the document’s existence
Transactions can contain metadata whose hash is part of the body of the transaction. Because the metadata hash is in the tx body, this allows for integrity checking and authentication of the metadata.
## Metadata structure
In the Cardano environment, the structure of the metadata is defined by a mapping from keys to values (key-value pairs) that combine details for multiple purposes into the same transaction.
*Metadata keys* act as a schema identifier that show what the metadata value is. Keys are unsigned integers limited in size up to 64 bits.
The *metadata values* are simple terms, consisting of integers, text strings, byte strings, lists, and maps. Values are required to be structured, which makes it easier to be inspected and managed, particularly by scripts.
This file has been truncated. show original
1 Like