Metadata schema - Tonium-io/tonium-frontend GitHub Wiki

General info

All collection and tokens contains metadata - link to JSON file (or store JSON file on blockchain)

Metadata schema

We borrow well known and industry adopted ERC721-metadata standard for metadata store

Schema of metadata

{
    "title": "Asset Metadata",
    "type": "object",
    "properties": {
        "name": {
            "type": "string",
            "description": "Identifies the asset to which this NFT represents"
        },
        "description": {
            "type": "string",
            "description": "Describes the asset to which this NFT represents"
        },
        "image": {
            "type": "string",
            "description": "A URI pointing to a resource with mime type image/* representing the asset to which this NFT represents"
        },
        "attributes": {
            "type": "array",
            "description": "Additional attributes"
        },
    }
}

Sample of data

{
  "name": "Some nice name",
  "description": "Some nice description",
  "image_url": "https://storage.tonium.io/creature/33.jpg",
  "attributes": [...]
}

Implementation

On collection (smart contract) method called "getTokenURI". It will return URL to json file with metadata.

URL presentation

Url can be https url on base64 url

https url

https://api.tonium.io/json/{collectonID}/{tokenID}

Sample

https://api.tonium.io/json/1

https://api.tonium.io/json/1/1

Base 64 url

"data:application/json;base64,{base64decoded string}"

Sample "data:application/json;base64, eyJuYW1lIjoiVGhpcyBhIGxpdHRsZSBraXR0eSIsImRlc2NyaXB0aW9uIjoiU2hlIGFkb3B0ZWQgYnkgbmljZSBwZW9wbGVzIGFuZCBsaXZpbmcgd2l0aCA1IGxpdHRseSBraWRzIGluIG9uZSBob3VzZSIsImltYWdlX3VybCI6Imh0dHBzOi8vaW1hZ2VzLnBleGVscy5jb20vcGhvdG9zLzEwNTYyNTEvcGV4ZWxzLXBob3RvLTEwNTYyNTEuanBlZz9hdXRvPWNvbXByZXNzJmNzPXRpbnlzcmdiJmRwcj0zJmg9NzUwJnc9MTI2MCJ9"

Image storing

We implemented three options to store images

Store on server (absolute urls)

Upload files happened on endpoint /files/:collectionId/:tokenId? Endpoint going to return file url

File schema then will started by "https://"

IPFS store

Use ipfs upload File schema then will started by "ipft://"

Store on blockchain

Use method addBytes(tokenId,data)

File schema then will started by "toniumTonFile://{collectonID}/{tokenID}"