DEV Community

Cover image for Introducing HIP-850: Enhancing Supply Key Functionality for NFT Updates in Treasury Account
Hedera Team
Hedera Team

Posted on • Originally published at hedera.com

Introducing HIP-850: Enhancing Supply Key Functionality for NFT Updates in Treasury Account

HIP-850 - to be implemented on the network as the mainnet upgrades to v0.53 soon - proposes a significant enhancement to the Hedera ecosystem by granting Supply Keys the ability to update NFT metadata while the NFTs reside in the treasury account (the specified account that receives tokens created as the result of a Token Mint operation).

Specifically, this HIP introduces the capability for the Supply Key to execute TokenUpdateNftsTransaction, allowing for the metadata of individual NFT Serials to be updated while they reside in the treasury wallet. By introducing this capability, HIP-850 aims to address the aforementioned limitations, enabling more dynamic and controlled management of NFT data without compromising asset integrity or trust. This proposal offers a solution for stakeholders seeking to evolve NFT functionality while maintaining the core principles of immutability once the NFT has been distributed.

Why is This Needed?

During the creation process of an NFT collection, users have the option to specify an AdminKey and/or MetadataKey which allow for the dynamic alteration of metadata after the minting process. Both keys are able to alter metadata at the NFT collection level, while the MetadataKey is able to also alter metadata at the NFT serial number level.

This dynamic functionality is beneficial - in some cases, essential - for certain use cases, but may not be appropriate for use cases in which post-distribution immutability should be guaranteed for the end-user.

Before this HIP, if neither an AdminKey nor MetadataKey was specified, NFT metadata was entirely immutable after the minting process. This immutability presents challenges for use cases where NFT metadata needs to be dynamically altered after minting but before distribution. Without the ability to make controlled changes, these scenarios become complex and often require workarounds that can compromise asset integrity or user experience.

By enabling the Supply Key to modify NFT metadata within the treasury account, this HIP provides a solution to these limitations. This approach introduces flexibility while maintaining data integrity post-distribution; it ensures that once an NFT leaves the treasury account, its metadata is immutable, preserving the integrity of the asset once it is distributed to the end-user.

Code Snippet

Create your NFT token type without a metadata key to dynamically update your NFT while it remains in the treasury account and preserve its immutability after distribution.

async function createNftTokenType() {
    //Create an NFT with the supply key
    const token = new TokenCreateTransaction()
        .setTokenType(TokenType.NonFungibleUnique)
        .setTokenName("MusicEvent2024")
        .setTokenSymbol("MEVNT")
        .setTreasuryAccountId(operatorId)
        .setSupplyKey(supplyPublicKey)
        .freezeWith(client);

    const signTx3 = token.sign(supplyKey);
    const submitTx3 = (await signTx3).execute(client);
    const tokenReceipt = (await submitTx3).getReceipt(client);

    // This is the nft collection Id
    const tokenId = (await tokenReceipt).tokenId;
    console.log(`The NFT collection ID is ${tokenId}`);

    return tokenId;
}
Enter fullscreen mode Exit fullscreen mode

Once you're ready to update the metadata of an NFT, use the supply key to sign the TokenUpdateNftsTransaction function.

async function updateNftMetadataWithinTreasury(tokenId, nftSerial) {
    const CID = 'bafkreidrqy67amvygjnvgr2mgdgqg2alaowoy34ljubot6qwf6bcf4yma4'

// Metadata to update the NFT with
    const newMetadata = Buffer.from(`ipfs://${CID}`);

    // Update the NFT metadata while it is in the treasury account and sign with the supply key
    const updateNftMetadata = new TokenUpdateNftsTransaction()
        .setTokenId(tokenId)
        .setSerialNumbers(nftSerial)
        .setMetadata(newMetadata)
        .freezeWith(client);

    console.log(
        "The transaction ID of the token metadata update transaction is " +
        updateNftMetadata.transactionId
    );

    const signTx = updateNftMetadata.sign(supplyKey);

    const submitTx = (await signTx).execute(client);

    const getReceipt = (await submitTx).getReceipt(client);
    const status = (await getReceipt).status;

    console.log("The NFT metadata update transaction was " + status.toString());
}
Enter fullscreen mode Exit fullscreen mode

Practical Examples

Event Ticketing
NFT technology has the potential to revolutionize the ticketing industry, but the ability to alter NFT metadata post-mint/pre-distribution is critical to unlocking the full potential of this disruption. Initially, tickets can be minted with basic details like event name, date, and time. As the event approaches and people begin purchasing tickets, the Supply Key can be used to add personalized details like seating assignments, VIP access, or special event features. HIP-850 enables the tickets - of which there may be many thousands - to be minted in advance, avoiding the need to mint individual tickets as people buy them.

Game Development
A game developer can utilize this enhancement to create dynamic in-game items. For example, an in-game NFT of a weapon or piece of armor can be initially minted with base attributes. As players progress through the game, the in-game NFT can be sent back to the treasury where the Supply Key can be used to update the item's attributes, such as damage, range, or special abilities to reflect character advancements or in-game events while ensuring immutability and asset integrity once the player regains control of the item.

Real World Assets
When a real world asset is minted as an NFT, it can have the base values needed for details of the asset and compliance with the governing bodies both on and off chain. Once that NFT is distributed, that new owner has the knowledge that the RWA cannot be adapted except by the trusted entity being the controller of the treasury. When the attributes of the token need to be updated - for example, a change in the underlying insurance of the asset - the owner can send it back to the treasury, get the new data added to the asset, and then be sent back to the owner.

The updating of the metadata in this way also keeps the provenance of the serial number. Previously, if only the Supply Key was on a NFT, the only way to gain this ability would be to burn the asset and mint a new one. This update will make book keeping and record tracking of assets much easier for distributing entities

Digital Collectibles
For digital collectibles, this feature offers increased flexibility. For example, a collectible art piece could be minted with initial metadata, including artist information and creation date. Later, the Supply Key could be used to add details about exhibitions, awards won, or collaborations, enhancing the collectible's value and providing additional context for collectors.

Conclusion

While the Hedera network already features the ability for creators and developers to dynamically alter NFT metadata post-minting through the use of AdminKeys and MetadataKeys, the implementation of HIP-850 extends this capability by ensuring post-distribution immutability for dynamic NFTs; end-users can be certain that while an NFT is in their possession, metadata for that NFT is entirely immutable. By granting the Supply Key the ability to update NFT metadata while within the treasury account, this HIP introduces a valuable enhancement to the Hedera network.

HIP-850 empowers stakeholders with greater flexibility and control over NFT management without compromising the fundamental principle of immutability. The proposed modification brings increased functionality to the current system, opening new possibilities for various use cases and driving innovation within the Hedera ecosystem.

Top comments (0)