NFT 메타데이터

✳️

NFT 아이템 발행 전, URI를 생성해야 합니다.

NFT 아이템에 들어갈 Asset(이미지, 동영상 등)이나 Metadata의 URI 생성은 IPFS 혹은 Pinata 등을 통해 생성하거나 Data URI를 이용하는 것을 권장드립니다.

NFT 안에 실재하는 자산을 정의하기 위해 3가지 개념을 사용합니다.

  • Asset : NFT화 할 자산
  • Metadata : Asset을 정의하는 데이터
  • URI : Asset과 Metadata를 식별하는 식별자


Asset

Asset은 NFT화 할 자산을 의미합니다. 그림, 동영상, 음악 등의 디지털 저작물을 종류에 상관없이 NFT로 만들 수 있습니다.


Metadata

Metadata는데이터에 대한 데이터(data about data)를 의미합니다. NFT의 Metadata는 토큰으로 만들 Asset에 대한 정보, NFT에 대한 설명 등을 정의한 JSON 형식의 데이터입니다.

ERC-721

Metadata는 ERC-721 Metadata JSON Schema를 따르도록 제안하고 있습니다.

{
    "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. Consider making any images at a width between 320 and 1080 pixels and aspect ratio between 1.91:1 and 4:5 inclusive."
        }
    }
}

ERC-1155

ERC-1155 또한 ERC721 Metadata JSON Schema에 기본을 두고 있습니다.

{
    "title": "Token Metadata",
    "type": "object",
    "properties": {
        "name": {
            "type": "string",
            "description": "Identifies the asset to which this token represents"
        },
        "decimals": {
            "type": "integer",
            "description": "The number of decimal places that the token amount should display - e.g. 18, means to divide the token amount by 1000000000000000000 to get its user representation."
        },
        "description": {
            "type": "string",
            "description": "Describes the asset to which this token represents"
        },
        "image": {
            "type": "string",
            "description": "A URI pointing to a resource with mime type image/* representing the asset to which this token represents. Consider making any images at a width between 320 and 1080 pixels and aspect ratio between 1.91:1 and 4:5 inclusive."
        },
        "properties": {
            "type": "object",
            "description": "Arbitrary properties. Values may be strings, numbers, object or arrays."
        }
    }
}

Opensea

최대 NFT 마켓플레이스인 Opensea에서 NFT를 보여주기 위해서는 다음과 같은 제안을 따라야합니다. 해당 형식과 다른 metadata를 생성한 경우, Opensea 내에서 NFT의 썸네일이 보이지 않을 수 있습니다.

{
  "name": "Herbie Starbelly",
  "description": "Friendly OpenSea Creature that enjoys long swims in the ocean.",
  "image": "https://storage.googleapis.com/opensea-prod.appspot.com/creature/50.png",
  "attributes": [...]
}
PropertyDescription
nameNFT 이름
descriptionNFT에 대한 설명
imageasset의 URI
attributesasset을 정의하는데 필요한 기타 속성들

예시

아래는 Hexlant에서 제공하는 예시입니다.

{
  "name": "HEXLANT ISSUE REPORT VOL.15 - NFT:메타버스 시대로 가는 첫번째 발판",
  "image": "ipfs://QmPrcWA6fp1UZpXcPWcAxYnzub2ryrNhnWyMbDyWPfGTww",
  "attributes": [
    {
      "trait_type": "Date",
      "value": "26 May 2021"
    },
    {
      "trait_type": "Issue",
      "value": "VOL.15"
    },
    {
      "trait_type": "Purpose",
      "value": "Market Insight"
    },
    {
      "trait_type": "Authors",
      "value": "최지혜, 하제훈"
    },
    {
      "trait_type": "report",
      "value": "ipfs://QmZyAJWSUfbyWrdGS6SX2TzqQw4qynVwYdfhnPdU6bYRNn"
    },
  ]
}


URI

Asset과 Metadata는 무결성을 보장해야합니다. 따라서 일반적으로 IPFS를 사용하며, Data URI를 사용할 수도 있습니다. 경우에 따라 NFT의 Asset과 Metadata를 Amazon S3나 Google Cloud와 같은 서버에 저장한 후, 저장 경로를 URI로 사용하기도 합니다. 하지만 이 경우 무결성과 확실성을 보장할 수 없으므로 권장하지 않습니다.


URI 생성

IPFS를 통해 Asset이나 Metadata를 저정한 경우, ipfs://YOUR_CID 를 경로로 사용합니다.

🚧

ipfs:// 형식을 따를 것을 권장합니다.

Pinata 등의 서비스를 통해 IPFS로 파일을 저장한 경우, 저장한 파일이 https://SOME_URL/ipfs/YOUR_CID 와 같은 경로를 가리킵니다. 이 경로를 URI로 사용할 경우, 후에 해당 URL을 사용하지 못할 때 대처할 수 없습니다. 따라서 이러한 위험을 방지하기 위해 ipfs://YOUR_CID와 같이 URI를 사용하길 권장드립니다.


IPFS 사용법 (예시)

대부분의 IPFS 서비스에서는 파일을 업로드하면 해당 파일에 대응하는 CID가 발급됩니다. 해당 CID로 IPFS에서 파일에 접근할 수 있기 때문에 CID를 기억하고 있어야 합니다.


NFT 아이템은 다음 과정에 따라 생성됩니다.

  1. NFT화 할 Asset을 저장합니다.
  2. NFT Metadata를 정의합니다. Asset의 URI는 1번에서 얻은 CID를 ipfs://CID 형식으로 입력합니다.
  3. 2번에서 정의한 NFT Metadata를 IPFS에 저장합니다.
  4. NFT 생성 시, token URI에 3번 과정에서 얻은 CID를 ipfs://CID 형식으로 입력합니다.

1038

예시에서 사용한 Asset과 Metadata를 IPFS를 통해 저장한 화면