-
Notifications
You must be signed in to change notification settings - Fork 7
ICRC-97: Non-Fungible Token (NFT) Metadata Standard #98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
sea-snake
wants to merge
13
commits into
dfinity:main
Choose a base branch
from
sea-snake:icrc-97-nft-metadata
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+95
−0
Open
Changes from 9 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
7bee2e0
Create ICRC-97.md
sea-snake ba2e7d9
Update ICRC-97.md
sea-snake d8b9ba3
Update ICRC-97.md
sea-snake 4aafbfe
Update ICRC-97.md
sea-snake f030e36
Update ICRC-97.md
sea-snake ac1b5f3
Update ICRC-97.md
sea-snake a79d8d3
Update ICRC-97.md
sea-snake 0fabfd7
Update ICRC-97.md
sea-snake af41f95
Update ICRC-97.md
sea-snake 5f95f16
Refactor standard to align with JSON approach.
sea-snake 918b60c
Refactor standard to align with JSON approach.
sea-snake ba4999c
Refactor standard to align with JSON approach.
sea-snake fda2baa
Remove ICRC-91
sea-snake File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| | ICRC | Title | Author | Discussions | Status | Type | Category | Created | | ||
| |:----:|:------------------------------------------:|:--------------------------------------------------------------------------------:|:-----------------------------------------:|:------:|:---------------:|:--------:|:----------:| | ||
| | 97 | Non-Fungible Token (NFT) Metadata Standard | Thomas (@sea-snake), Austin Fatheree (@skilesare), Dieter Sommer (@dietersommer) | https://github.com/dfinity/ICRC/issues/97 | Draft | Standards Track | | 2024-08-13 | | ||
|
|
||
| # ICRC-97: Non-Fungible Token (NFT) Metadata Standard | ||
|
|
||
| ICRC-97 is a metadata standard for the implementation of Non-Fungible Tokens (NFTs) on | ||
| the [Internet Computer](https://internetcomputer.org). | ||
|
|
||
| The standard is designed to allow for multiple assets with different data types with various purposes. Where additional | ||
| asset purposes and attribute display types can be standardized in ICRC-97 extensions. | ||
|
|
||
| A list of asset purposes and attribute display types are defined in ICRC-97 to the minimum needed for wallets and marketplaces to display NFTs. | ||
|
|
||
| ## Extending the ICRC-7 Standard with Token Metadata | ||
|
sea-snake marked this conversation as resolved.
Outdated
|
||
|
|
||
| The [`icrc7_token_metadata`](https://github.com/dfinity/ICRC/blob/main/ICRCs/ICRC-7/ICRC-7.md#icrc7_token_metadata) | ||
| method returns the token metadata for `token_ids`, a list of token ids. Each tuple in | ||
| the response vector comprises an optional `metadata` element with the metadata expressed as a vector of `text` and `Value` | ||
| pairs. Where `Value` is recursive as defined in the ICRC-3 standard. | ||
|
|
||
| ICRC-7 does not specify the representation of token metadata any further than that it is represented in a generic manner | ||
| as a vector of (text, Value)-pairs. The ICRC-97 standard defines a token metadata | ||
| standard for ICRC-7 and other NFT standards. | ||
|
|
||
| ### Entrypoint | ||
|
|
||
| The following metadata property MUST be defined in the root of the token metadata if we want to return on-chain | ||
| metadata. | ||
|
|
||
| | Root Metadata Property | ICRC-3 Type | Description | | ||
| |------------------------|-----------------|----------------------------------------| | ||
| | icrc97:metadata | variant { Map } | Contains on-chain metadata properties. | | ||
|
|
||
| Alternatively the following metadata property MUST be defined in the root of the token metadata if we want to return | ||
| external | ||
| off-chain metadata instead of on-chain metadata. | ||
|
|
||
| | Root Metadata Property | ICRC-3 Type | Description | | ||
| |--------------------------|-----------------|---------------------------------------------------| | ||
| | icrc97:external_metadata | variant { Map } | Contains below external JSON metadata properties. | | ||
|
sea-snake marked this conversation as resolved.
Outdated
|
||
|
|
||
| | External Metadata Property | Optional | ICRC-3 Type | Description | | ||
| |----------------------------|----------|------------------|--------------------------------------------------------------------------------| | ||
| | url | No | variant { Text } | URL that returns the metadata in JSON format (protocol is not limited to HTTP) | | ||
| | sha256_hash | Yes | variant { Blob } | SHA-256 hash of HTTP response body bytes returned from above url. | | ||
|
sea-snake marked this conversation as resolved.
Outdated
|
||
|
|
||
| ### Metadata properties | ||
|
|
||
| Below table lists all (optional) metadata properties defined in this standard. Each property is defined in both ICRC-3 | ||
| and JSON type to support both on-chain `Value` and off-chain JSON metadata, respectively. | ||
|
|
||
| | Metadata Property | Optional | ICRC-3 Type | JSON Type | Description | | ||
| |-------------------|----------|-----------------------------------------|-----------|---------------------------------------------------------| | ||
| | external_url | Yes | variant { Text } | string | URL that allows the user to view the item on your site. | | ||
| | name | Yes | variant { Text } | string | Plain text. | | ||
| | description | Yes | variant { Text } | string | Markdown. | | ||
| | assets | Yes | variant { Array = vec variant { Map } } | object[] | List of assets ordered by priority descending. | | ||
|
sea-snake marked this conversation as resolved.
Outdated
|
||
| | attributes | Yes | variant { Array = vec variant { Map } } | object[] | List of attributes ordered by priority descending. | | ||
|
sea-snake marked this conversation as resolved.
Outdated
|
||
|
|
||
| The following table lists all (optional) asset properties. | ||
|
|
||
| | Asset Property | Optional | ICRC-3 Type | JSON Type | Description | | ||
| |----------------|----------|------------------|-----------------|--------------------------------------------------------------------------------| | ||
| | url | No | variant { Text } | string | URL that returns the asset e.g. a PNG image (protocol is not limited to HTTP). | | ||
| | mime | No | variant { Text } | string | Mime type as defined in RFC 6838. | | ||
| | sha256_hash | Yes | variant { Blob } | string (base64) | SHA-256 hash of HTTP response body bytes returned from above url. | | ||
| | purpose | Yes | variant { Text } | string | Indicate purpose of asset. | | ||
|
|
||
| Below list of purpose values are part of the ICRC-97 standard, this list could be extended by other standards. | ||
| Purpose values can define additional asset properties. | ||
|
|
||
| | Purpose Value | Description | | ||
| |----------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------| | ||
| | icrc97:image | Original size image that is shown on e.g. item details page. Additional optional `width` and `height` properties define the dimensions in number of pixels. | | ||
|
sea-snake marked this conversation as resolved.
Outdated
|
||
| | icrc97:preview | Small image meant as preview within e.g. a list of items. Additional optional `width` and `height` properties define the dimensions in number of pixels. | | ||
|
|
||
| The following table lists all (optional) attribute properties. | ||
|
|
||
| | Attribute Property | Optional | ICRC-3 Type | JSON Type | Description | | ||
| |--------------------|----------|----------------------------|------------------|---------------------------------------------| | ||
| | value | No | variant { Text; Nat; Int } | string \| number | Value of the trait. | | ||
| | trait_type | No | variant { Text } | string | Name of the trait. | | ||
| | display_type | Yes | variant { Text } | string | Indicate how attribute should be displayed. | | ||
|
|
||
| Below list of display types are part of the ICRC-97 standard, this list could be extended by other standards. | ||
| Display types can define additional attribute properties. | ||
|
|
||
| | Display Type Value | Description | | ||
| |-------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------| | ||
| | icrc97:property | Shows attribute as property with e.g. rarity, this is the default display type. | | ||
| | icrc97:date | Shows attribute as date, expects epoch timestamp number in milliseconds. | | ||
| | icrc97:time | Shows attribute as date with time, expects epoch timestamp number in milliseconds. | | ||
| | icrc97:rank | Shows attribute as progress rank e.g. 4 of 10, expects number and additional `max_value` property with a number. | | ||
|
sea-snake marked this conversation as resolved.
Outdated
|
||
| | icrc97:stat | Show attribute as stat e.g. 1 out of 2, expects number and additional `max_value` property with a number. | | ||
| | icrc97:boost | Shows attribute as boost e.g. +10, expects number and optional additional `min_value` and `max_value` properties. Numbers can be either positive or negative. | | ||
| | icrc97:boost_percentage | Same as `icrc97:boost` but shows values with %. | | ||
|
|
||
| ## Future work | ||
|
|
||
| This standard defines a token metadata standard for ICRC-7. But also applies to future standards like ICRC-8, where needed ICRC-97 can be extended with additional asset purposes and display type values to accomodate for these standards. | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.