Enabling Dynamic NFTs on Hedera: Exploring HIP-646, HIP-657, and HIP-765
Small profile pic michiel dec 2022
May 28, 2024
by Michiel Mulders
Developer Advocate at Swirlds Labs

Non-fungible tokens (NFTs) have revolutionized how we think about digital ownership and asset management. However, as the digital landscape evolves, so do the needs and expectations of creators and users. One significant development in the Hedera ecosystem is the introduction of dynamic NFTs, which are made possible by mutable metadata fields.

This blog post will explore how three Hedera Improvement Proposals (HIPs)—HIP 646, HIP 657, and HIP 765—enable dynamic NFTs and advance token metadata on Hedera.

IMG 3505 1

Visualization of how HIP 646, HIP 657, and HIP 765 affect different parts of an NFT or token on the Hedera network.

Understanding the HIPs

HIP 646: Fungible Token Metadata Field

HIP 646 addresses the need for standardized metadata in fungible tokens (FTs). Just as NFTs can carry additional information through metadata, FTs need to include supplementary data that can be accessed and displayed by wallets, explorers, and other applications.

This HIP introduces a metadata field for FTs, enhancing their functionality and user experience by allowing both the admin key and the newly introduced metadata key to update the token-level metadata field.

Code snippet:

Code Snippet Background
// Generate a metadata key
const metadataKey = PrivateKey.generateED25519();
// Initial metadata
const metadata = new TextEncoder().encode("{ website: hedera.com }");

// Create a non fungible token
let createTokenTx = new TokenCreateTransaction()
    .setTokenName("Project ESG")
    .setTokenSymbol("ESG")
    .setMetadata(metadata) // set NFT-level metadata
    .setTokenType(TokenType.FungibleCommon)
    .setDecimals(2)
    .setInitialSupply(10000)
    .setTreasuryAccountId(operatorId)
    .setMetadataKey(metadataKey) // set metadata key
    .freezeWith(client);

HIP 405: Building on HIP-646, HIP-405 introduces a fungible token metadata JSON schema. This schema allows token creators to provide more detailed information about their token and its corresponding project than what is afforded by the HTS token model.

HIP 657: Mutable Metadata Fields for Dynamic NFTs

HIP 657 is the cornerstone of this discussion, as it introduces the concept of dynamic NFTs on Hedera. Unlike static NFTs, where metadata is immutable after minting, dynamic NFTs can have their metadata updated over time. Updating metadata is achieved through a new "metadata key," allowing creators to change NFT-level metadata without compromising the token's unique properties.

Think of it like owning a digital trading card of a soccer player. When the player scores a hat-trick, their card's stats and achievements can be updated automatically through smart contracts, including oracles for off-network data, to reflect this incredible performance. In the case of a real-estate asset represented as a dynamic NFT, the property owner can update the metadata themselves to reflect improvements made to the house.

Whether through automated updates via smart contracts or manual changes by the creator, dynamic NFTs open up new creative and more engaging possibilities for NFTs.

Code snippet:

Code Snippet Background
// Update NFTs metadata
const tokenUpdateNftsTx = new TokenNftsUpdateTransaction()
    .setTokenId(tokenId)
    .setSerialNumbers([nftSerial])
    .setMetadata(newMetadata)
    .freezeWith(client);

HIP 765: NFT Collection Token Metadata Field

HIP 765 extends the idea of metadata to NFT collections. Similar to HIP 646, this proposal introduces a top-level metadata field for NFT collections, providing additional information about the entire collection rather than individual NFTs. This is crucial for defining attributes that apply to the collection as a whole, such as the creator’s details, collection description, or links to external resources. Both the admin key and the newly introduced metadata key can update this top-level metadata field.

Code snippet:

Code Snippet Background
// Generate a metadata key
const metadataKey = PrivateKey.generateED25519();
// Initial metadata
const metadata = new TextEncoder().encode("{ website: hedera.com }");

let createTokenTx = new TokenCreateTransaction()
    .setTokenName("Project ESG")
    .setTokenSymbol("ESG")
    .setMetadata(metadata) // set NFT-level metadata
    .setTokenType(TokenType.NonFungibleUnique)
    .setTreasuryAccountId(operatorId)
    .setSupplyKey(supplyKey)
    .setMetadataKey(metadataKey) // set metadata key
    .freezeWith(client);

HIP-766: Building on HIP-765, HIP-766 introduces an NFT collection metadata JSON schema. This schema allows creators to provide more detailed information about their NFT collections than what is available on-chain, standardizing the additional information that can be included.

The Power of Dynamic NFTs

Introducing mutable metadata fields through HIP 657 is a game-changer for the NFT space on Hedera. It allows creators to offer more engaging and interactive experiences for their audience. Whether it's updating the attributes of a gaming asset, evolving a piece of digital art, or maintaining accurate information about a digital collectible, dynamic NFTs provide a new level of versatility and user engagement.

Conclusion

Hedera's commitment to innovation is evident through these HIPs, which collectively enhance the capabilities of both fungible and non-fungible tokens on the network. Hedera is paving the way for more dynamic and interactive digital assets by adding metadata fields and introducing the ability to update NFT metadata.

For those interested in diving deeper, you can explore the detailed HIPs through the following links:

With these advancements, the future of NFTs on Hedera looks more vibrant and dynamic than ever.