-
Notifications
You must be signed in to change notification settings - Fork 17
Token Data Standard #64
Comments
At the moment, NFT-collection may have On the other hand, NFT-collection may have its own metadata (e.g., name or image of the overall collection). |
It is very gratifying to see that our discussion has turned into an Issue and our @disintar team's proposals have been accepted. I'm currently full-time writing the CLI and didn't have time to comment on the draft itself, but there is one point that I want to express before the CLI and other comments are published. It would be cool to add another type tag "SemiChain" - which will mean that attributes, properties, name, image will be inside the contract, everything else will be in the offchain. This is very necessary to give an opportunity to developers to save some parameters inside the network, which will remain even if the offchain data is lost. And take out heavy content in the off chain. I don't know yet how to properly separate the fields into offchain and onchain, perhaps you need to give developers the opportunity to choose and enter a binary mask, instead of the first tag. I understand that this is difficult things both for parsing and for contract code, but this is a necessity that will help make better contracts and protect users from losing content. |
@tvorogme |
NoelJacob suggested to use combination of offchain content and onchain authenticated code (hash of the content). |
Consider standardizing the following metadata attributes:
|
@tolya-yanot hi.
You want to remove those fields or you would like to discuss more specification on these fields? |
Nobody forbids setting these fields, the question is - do we really need to standardize them? |
Ok. Got it. Some arguments to specify
As an example, you may see that OpenSea collections support this field. E.g. metadata of one song uses In my opinion, music and video for NFT are very common, so we need to set the structure rigidly so that third-party application developers can simply parse the content.
|
Is this being moved ahead with? This is also recommended in the whitepaper (p. 79) There are more criticism to NFTs being reduced to just owning a link. Signal's founder Moxie had detailed the problem his quite famous blog post. (tldr; He made an NFT that changes art based on the IP requesting) I suggest anything stored off-chain should have on-chain authenticated code, by default. |
Hi!
I think it's better to keep interface more flexible and use fields like |
Maybe it'll be cool to clearly define merge rules (on merge conflicts) which must be the same for everyone :) |
I think this draft should change
|
I think we have to standardize |
Summary
A standard interface for tokens (meta)data (in particular NFT or Jettons).
Motivation
For applications like wallets or marketplaces it is quite useful to be able automatically retrieve information for display. Token data standard allows to simplify this process and uniform the way of token display across different applications.
Specification
Content representation
Three options can be used:
Off-chain content layout
The first byte is
0x01
and the rest is the URI pointing to the JSON document containing the token metadata. The URI is encoded as ASCII.If the URI does not fit into one cell, then it uses the "Snake format" described in the "Data serialization" paragraph, the snake-format-prefix
0x00
is dropped.On-chain content layout
The first byte is
0x00
and the rest is key/value dictionary.Key is sha256 hash of string.
Value is data encoded as described in "Data serialization" paragraph.
Semi-chain content layout
Data encoded as described in "2. On-chain content layout".
The dictionary must have
uri
key with a value containing the URI pointing to the JSON document with token metadata.Clients in this case should merge the keys of the on-chain dictionary and off-chain JSON doc.
Data serialization
Data that does not fit in one cell can be stored in two ways:
Snake format when we store part of the data in a cell and the rest of the data in the first child cell (and so recursively).
Must be prefixed with
0x00
byte.TL-B scheme:
Chunked format when we store data in dictionary
chunk_index
->chunk
.Must be prefixed with
0x01
byte.TL-B scheme:
Data that fits into one cell is stored in "Snake format".
Informal TL-B scheme:
Note, that while TL-B scheme does not constrain bit size of each chunk it is expected that all chunks contain ceil number of bytes.
NFT metadata attributes
uri
- Optional. Used by "Semi-chain content layout". ASCII string. A URI pointing to JSON document with metadata.name
- Optional. UTF8 string. Identifies the asset.description
- Optional. UTF8 string. Describes the asset.image
- Optional. ASCII string. A URI pointing to a resource with mime type image.image_data
- Optional. Either binary representation of the image for onchain layout or base64 for offchain layout.Jetton metadata attributes
uri
- Optional. Used by "Semi-chain content layout". ASCII string. A URI pointing to JSON document with metadata.name
- Optional. UTF8 string. The name of the token - e.g. "Example Coin".description
- Optional. UTF8 string. Describes the token - e.g. "This is an example jetton for the TON network".image
- Optional. ASCII string. A URI pointing to a jetton icon with mime type image.image_data
- Optional. Either binary representation of the image for onchain layout or base64 for offchain layout.symbol
- Optional. UTF8 string. The symbol of the token - e.g. "XMPL". Used in the form "You received 99 XMPL".decimals
- Optional. If not specified, 9 is used by default. UTF8 encoded string with number from 0 to 255. The number of decimals the token uses - e.g. 8, means to divide the token amount by 100000000 to get its user representation, while 0 means that tokens are indivisible: user representation of token number should correspond to token amount in wallet-contract storage.In case you specify decimals, it is highly recommended that you specify this parameter on-chain and that the smart contract code ensures that this parameter is immutable.
Changelog:
The text was updated successfully, but these errors were encountered: