πŸ”„ Dynamic NFTs

Use the Media & Metadata APIs to create NFTs with properties that change based on user action

Developers access the APIs through Co:Create's Platform, where they can effortlessly upload, host, and manage their media and metadata files. Using Co:Create's APIs, a developer can also implement the use case of creating a dynamic NFT that changes based upon user actions within an application.

Dynamic NFT Use Cases

Airline Miles

Airline miles membership programs are a great fit for dynamic NFTs, as they involve variable values, status tiers, and personalized member data. Here's a simplified version of how it could potentially work:

  1. Issuance: When a customer joins the airline's loyalty program, they are issued a dynamic NFT. This NFT represents their membership and is tied to their personal identity.
  2. Miles Accumulation: As the customer flies with the airline, they earn miles. These miles are not simply added to their account in a traditional database, but instead, the NFT itself via its metadata is updated to reflect the new mileage balance. The dynamic nature of the metadata of the NFT allows it to change over time, representing the customer's current balance.
  3. Status Changes: Most airline loyalty programs have different tiers (Silver, Gold, Platinum, etc.) that provide different benefits. As a customer earns enough miles to move to a new tier, both the media & metadata of the NFT can change to reflect this. For example, the color or design of the NFT could change, or a new badge could be added, and the tier attribute of the metadata could also be updated.
  4. Redemption: When a customer wishes to redeem miles, they could do so by interacting with their NFT. This could potentially be done through a blockchain interface or through the airline's app or website. Upon redemption, the NFT metadata would update to reflect the decreased miles balance.

Airline Miles Metadata Example

When a user signs up for the program, they are given an NFT to represent their membership, which could be freely-tradeable so that it can be bought and sold on a secondary market or it could be soulbound. The program has both tiers and points built into the metadata.

Initial Metadata

When a user joins, they're given an NFT that has the default metadata applied from the metadata instance created. This might look like:

{
  "name": "Airline Miles Membership",
  "description": "This NFT represents a membership in our airline miles program.",
  "image": "https://cocrtcdn.com/images/membership-card.png",
  "attributes": [
    {
      "trait_type": "Points",
      "value": 0
    },
    {
      "trait_type": "Tier",
      "value": "Member"
    }
  ]
}

Points Earned, Tier Upgraded

Now, let's say that the user took a big flight, which awarded them 50,000 points, and which also resulted in a tier upgrade from Member to Silver. The metadata for the token can be updated using the metadata override endpoint so that it reflects this new state:

{
  "name": "Airline Miles Membership",
  "description": "This NFT represents a membership in our airline miles program.",
  "image": "https://cocrtcdn.com/images/membership-card-silver.png",
  "attributes": [
    {
      "trait_type": "Points",
      "value": 50000
    },
    {
      "trait_type": "Tier",
      "value": "Silver"
    }
  ]
}

In the above example, the following was updated:

  • image -- membership-card.png to membership-card-silver.png
  • "trait_type":"Points" -- "value": 0 to "value": 50000
  • "trait_type": "Tier" -- "value": "Member" to "value": "Silver"

The metadata is controlled via API, therefore no on-chain transaction was ever needed. The base_uri applied to the token remains the same. Only the metadata has been updated.

Donation-Based NFTs

A donation organization wants to issue a unique, dynamic NFT to each user when they sign up. This NFT could serve as a visual representation of the user's donation history and impact, starting as a black-and-white image and gaining color and badges as the user donates more or contributes to different causes. Here's a simplified version of how it could potentially work using Co:Create’s APIs:

  1. Upload the media file & create the metadata instance: The black-and-white image can be added as the initial media for the NFT using the Co:Create's Media API. The donation organization would use the POST https://api.cocrt.xyz/alpha/nft/media endpoint to create a new media instance for the black & white image. They would create a new metadata instance and then list this media URL within.
  2. Create the NFT and mint a token to the new user: The donation organization can use Co:Create’s ERC721 API to deploy the token contract & mint a new NFT for that user.
  3. Update the NFT as the user donates: As the user donates more, the donation organization will want to update the NFT to reflect this. They can do this by updating the media associated with the NFT. To add color to the image or add badges, Givepact would create a new media instance for the updated image using the Media API, and then update the NFT's metadata using the Metadata API to point to the new image.