Explanation of URI (Metadata structure)

A URI (Uniform Resource Identifier) is a unique identifier used for identifying and locating resources on the internet. In the context of blockchain tokens, URI is often employed to access metadata associated with a specific token. For example, the URL for an image, description, owner information, etc.

In this documentation, as an example, we will frequently refer to Meta assets utilized in the game Degen Youki to provide you with the most comprehensive understanding of the situation.

How to Retrieve URI Data?

To retrieve the URI data for a specific token, simply use the uri(uint256 id) function available in the smart contract that implements the IERC1155MetadataURI interface. This function returns the URI address for a given token identifier.

Our metadata is inspired by the Enji metadata standard. To learn more about the Enji standard, click on the link.

Smart Contract: https://bscscan.com/address/0xa293d68684be29540838dc8a0222de0c43c6b5b4#code

This method on the Contract is Responsible for returning the token URI

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)

pragma solidity ^0.8.0;

import "../IERC1155.sol";

/**
 * @dev Interface of the optional ERC1155MetadataExtension interface, as defined
 * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].
 *
 * _Available since v3.1._
 */
interface IERC1155MetadataURI is IERC1155 {
    /**
     * @dev Returns the URI for token type `id`.
     *
     * If the `\{id\}` substring is present in the URI, it must be replaced by
     * clients with the actual token type ID.
     */
    function uri(uint256 id) external view returns (string memory);
}

You can also check the URI address directly by accessing the token contract. Below are the steps on how you can obtain such data from our platform:

  1. Scroll down the page to method "17" titled "uri"

  2. Click on it, to expand the section

  3. Enter the token ID in the input and click the 'Query' button. For example, you can enter ID: 1182

  4. As a response, you will receive a link to the URI of the specific token

Expand to see the whole structure
{
  "tokenId": "1248",
  "bucket_hash": "7699177f-4e21-4d20-bec3-928d52254855",
  "description": "Yo, listen up, you savvy wanderer! Degen Youki's droppin' the bomb on your wardrobe with the **Degen Frenchie Shirt**. This ain't no run-of-the-mill shirt, nah, it's a total flex of your decentralized swagger.\n\nPicture this: you throw on the Degen Frenchie Shirt and instantly level up your style game. This ain't your grandma's fabric – it's like you're rockin' threads spun straight from the blockchain itself. Smooth as a token transfer, this shirt is gonna have you lookin' fly and feelin' like a true crypto maverick.\n\nSo, my friend, don't sleep on this. Grab your Degen Shirt, slap it on, and join me on this wild ride through the metaverse.\n\nIf you're lookin' to blast off to uncharted realms and dive into heart-pounding showdowns, you better be strappin' one of these bad boys to your digital hip. Trust me, it's the ticket to a wild ride you won't wanna miss!\n\nStay SAFU, stay Degen.",
  "image": "https://gateway.metaproprotocol.com/1248/preview",
  "minified_image": "https://gateway.metaproprotocol.com/1248/minified-preview",
  "extra_files": [
    "https://prdmetaassetfiles.blob.core.windows.net/7699177f-4e21-4d20-bec3-928d52254855/assets/7d87b09c-5e0b-416e-a845-976a4ec9a0a7.mp4",
    "https://prdmetaassetfiles.blob.core.windows.net/7699177f-4e21-4d20-bec3-928d52254855/assets/decf1fd0-7c38-48d8-a8f1-18cbe1bd7f66.png"
  ],
  "name": "Degen Youki 'Frenchie' Shirt",
  "properties": {
    "boosts_Player_extra_life": {
      "name": "Player extra life",
      "value": 2,
      "display_type": "boost_number"
    }
  },
  "files_spec": {
    "item_experiance": [
      
    ],
    "common": {
      "standard": [
        {
          "key": "asset_type",
          "value": [
            "2D meta asset"
          ],
          "value_type": "string array"
        },
        {
          "key": "asset_licence",
          "value": "Royalty Free (RF)",
          "value_type": "string"
        },
        {
          "key": "asset_restriction",
          "value": "Public meta asset",
          "value_type": "string"
        },
        {
          "key": "asset_tags",
          "value": [
            "metapro",
            "gaming asset",
            "DY",
            "DegenYouki"
          ],
          "value_type": "string array"
        },
        {
          "key": "asset_tag_ids",
          "value": [
            21,
            17,
            155,
            154
          ],
          "value_type": "integer array"
        },
        {
          "key": "asset_category",
          "value": "Wearable",
          "value_type": "string"
        },
        {
          "key": "asset_subcategories",
          "value": [
            "Upper body clothes"
          ],
          "value_type": "string array"
        },
        {
          "key": "asset_category_ids",
          "value": [
            11,
            14
          ],
          "value_type": "integer array"
        }
      ],
      "2d_spec": [
        {
          "key": "asset_height",
          "value": 1200,
          "value_type": "integer"
        },
        {
          "key": "asset_width",
          "value": 1200,
          "value_type": "integer"
        },
        {
          "key": "asset_layers",
          "value": false,
          "value_type": "boolean"
        }
      ],
      "3d_spec": [
        {
          "key": "asset_geometry",
          "value": "",
          "value_type": "string"
        },
        {
          "key": "asset_polygons",
          "value": 0,
          "value_type": "integer"
        },
        {
          "key": "asset_vertices",
          "value": 0,
          "value_type": "integer"
        },
        {
          "key": "asset_materials",
          "value": false,
          "value_type": "boolean"
        },
        {
          "key": "asset_textures",
          "value": false,
          "value_type": "boolean"
        },
        {
          "key": "asset_uv_mapped",
          "value": false,
          "value_type": "boolean"
        },
        {
          "key": "asset_animated",
          "value": false,
          "value_type": "boolean"
        }
      ],
      "sound_spec": [
        {
          "key": "asset_bpm",
          "value": 0,
          "value_type": "integer"
        },
        {
          "key": "asset_sample_rate",
          "value": "",
          "value_type": "string"
        },
        {
          "key": "asset_bit_depth",
          "value": 0,
          "value_type": "integer"
        },
        {
          "key": "asset_channels",
          "value": "",
          "value_type": "string"
        },
        {
          "key": "asset_duration",
          "value": "",
          "value_type": "string"
        },
        {
          "key": "asset_isrc_code",
          "value": "",
          "value_type": "string"
        }
      ]
    }
  }
}
ValueInformation

tokenId

ID of the Meta Asset on the specific contract.

bucket_hash

Bucket hash where files are stored.

description

Description of the Meta Asset.

image

Image of the Meta Asset.

minified_image

Compressed image of the Meta Asset.

extra_files

Additional files showcasing the Meta Asset.

name

Name of the Meta Asset.

properties

Properties of the specific Meta Asset that distinguish it may display information about the values it provides more on this later.

files_spec

Files and data related to the Meta Asset, including its license, assigned category, 2D and 3D files, and sound files. (more detailed information can be found in the next document)

What is URI Data Used For?

URI data is crucial as it enables access to metadata associated with a specific token, which can be significant for users, trading platforms, exchanges, and applications that want to display information about the token.

How Can Token URI Benefit You?

Resource Preview:

  • Allows players to preview details of a resource, such as description, preview image, technical data, etc., before purchasing.

Game Integrations:

  • When creating a game, you can use URI data to integrate NFT resources directly into the game, enabling players to use unique characters, items, etc.

Resale and Trading:

  • URI data is crucial for NFT resale platforms, providing the necessary information to present the resource on an NFT trading platform.

In-Game Metadata Utilization:

  • Games can dynamically use resource metadata to customize game mechanics based on unique features owned by players.

Collections and Statistics:

  • URI data enables the creation of in-game NFT collections, tracking statistics of individual resources, and rewarding players for their collections.

Properties

Properties in our application play a significant role, extending beyond the visual aspect to provide real value in the game. Here's why using properties is essential in the context of real value in the game:

In the case of the discussed game Degen Youki: Properties allow precise specification of functions for each item. For example, a specific item might provide additional life or increase points earned for collecting items during gameplay. This is crucial for users who want to consciously choose items to increase their advantage in the game.

For the discussed asset, properties provide access to a unique map.

Degen Youki Extra Life Asset

"properties": {
  "boosts_Player_extra_life": {
    "name": "Player extra life",
    "value": 2,
    "display_type": "boost_number"
  }
}

Another example of the Properties Parameters used

Check the Asset to see it live: New Era - Green Sword

Expand to see the whole structure
{
  "tokenId": "1248",
  "bucket_hash": "7699177f-4e21-4d20-bec3-928d52254855",
  "description": "Yo, listen up, you savvy wanderer! Degen Youki's droppin' the bomb on your wardrobe with the **Degen Frenchie Shirt**. This ain't no run-of-the-mill shirt, nah, it's a total flex of your decentralized swagger.\n\nPicture this: you throw on the Degen Frenchie Shirt and instantly level up your style game. This ain't your grandma's fabric – it's like you're rockin' threads spun straight from the blockchain itself. Smooth as a token transfer, this shirt is gonna have you lookin' fly and feelin' like a true crypto maverick.\n\nSo, my friend, don't sleep on this. Grab your Degen Shirt, slap it on, and join me on this wild ride through the metaverse.\n\nIf you're lookin' to blast off to uncharted realms and dive into heart-pounding showdowns, you better be strappin' one of these bad boys to your digital hip. Trust me, it's the ticket to a wild ride you won't wanna miss!\n\nStay SAFU, stay Degen.",
  "image": "https://gateway.metaproprotocol.com/1248/preview",
  "minified_image": "https://gateway.metaproprotocol.com/1248/minified-preview",
  "extra_files": [
    "https://prdmetaassetfiles.blob.core.windows.net/7699177f-4e21-4d20-bec3-928d52254855/assets/7d87b09c-5e0b-416e-a845-976a4ec9a0a7.mp4",
    "https://prdmetaassetfiles.blob.core.windows.net/7699177f-4e21-4d20-bec3-928d52254855/assets/decf1fd0-7c38-48d8-a8f1-18cbe1bd7f66.png"
  ],
  "name": "Degen Youki 'Frenchie' Shirt",
  "properties": {
    "boosts_Player_extra_life": {
      "name": "Player extra life",
      "value": 2,
      "display_type": "boost_number"
    }
  },
  "files_spec": {
    "item_experiance": [
      
    ],
    "common": {
      "standard": [
        {
          "key": "asset_type",
          "value": [
            "2D meta asset"
          ],
          "value_type": "string array"
        },
        {
          "key": "asset_licence",
          "value": "Royalty Free (RF)",
          "value_type": "string"
        },
        {
          "key": "asset_restriction",
          "value": "Public meta asset",
          "value_type": "string"
        },
        {
          "key": "asset_tags",
          "value": [
            "metapro",
            "gaming asset",
            "DY",
            "DegenYouki"
          ],
          "value_type": "string array"
        },
        {
          "key": "asset_tag_ids",
          "value": [
            21,
            17,
            155,
            154
          ],
          "value_type": "integer array"
        },
        {
          "key": "asset_category",
          "value": "Wearable",
          "value_type": "string"
        },
        {
          "key": "asset_subcategories",
          "value": [
            "Upper body clothes"
          ],
          "value_type": "string array"
        },
        {
          "key": "asset_category_ids",
          "value": [
            11,
            14
          ],
          "value_type": "integer array"
        }
      ],
      "2d_spec": [
        {
          "key": "asset_height",
          "value": 1200,
          "value_type": "integer"
        },
        {
          "key": "asset_width",
          "value": 1200,
          "value_type": "integer"
        },
        {
          "key": "asset_layers",
          "value": false,
          "value_type": "boolean"
        }
      ],
      "3d_spec": [
        {
          "key": "asset_geometry",
          "value": "",
          "value_type": "string"
        },
        {
          "key": "asset_polygons",
          "value": 0,
          "value_type": "integer"
        },
        {
          "key": "asset_vertices",
          "value": 0,
          "value_type": "integer"
        },
        {
          "key": "asset_materials",
          "value": false,
          "value_type": "boolean"
        },
        {
          "key": "asset_textures",
          "value": false,
          "value_type": "boolean"
        },
        {
          "key": "asset_uv_mapped",
          "value": false,
          "value_type": "boolean"
        },
        {
          "key": "asset_animated",
          "value": false,
          "value_type": "boolean"
        }
      ],
      "sound_spec": [
        {
          "key": "asset_bpm",
          "value": 0,
          "value_type": "integer"
        },
        {
          "key": "asset_sample_rate",
          "value": "",
          "value_type": "string"
        },
        {
          "key": "asset_bit_depth",
          "value": 0,
          "value_type": "integer"
        },
        {
          "key": "asset_channels",
          "value": "",
          "value_type": "string"
        },
        {
          "key": "asset_duration",
          "value": "",
          "value_type": "string"
        },
        {
          "key": "asset_isrc_code",
          "value": "",
          "value_type": "string"
        }
      ]
    }
  }
}
Property ValueDescription

Collection

A collection of a given asset serves as a set, enabling the creation of collections within a specific game, as in this case, Degen Youki. Collections can also be created to categorize Meta Assets of the game into various categories such as Weapons, Armors, Helmets, etc.

Properties

Properties take three values: Feature Name, Feature Value, and Displayed Feature Value (an optional parameter that doesn't add any value). This metadata allows for a clear presentation of what a given item offers, for example, gender, damage, special ability, weapon type, etc.

Levels

Levels take four parameters: Level Name, Value, Maximum Value, and Display Type. Levels are particularly useful when indicating that a certain asset provides access to a specific map at a defined level or determining the level of armament.

Boosts

Boosts take three parameters, appearing in two variants: percentage values and numerical values. These metadata include Name, Value, and Display Type, allowing precise determination of what a given item provides. It is perfect for displaying information that a particular item, for example, offers a bonus to movement speed, increases jump height, etc.

Using properties not only enhances the visual appeal of items but also introduces a strategic, economic, and functional dimension to the game world, which is crucial for user satisfaction and engagement. The provided example is just one of many possible options.

Last updated