Guide: Dynamic NFTs That Evolve



In the digital realm, the concept of upgradable NFTs is akin to the familiar experience of playing Pokémon games in the Web2 world, where players nurture and evolve their Pokémon as they gain experience and level up. Just as a Pokémon like Charmander evolves into Charmeleon and then Charizard with enough experience points (XP), dynamic NFTs can transform and upgrade over time based on specific criteria or achievements.

This innovative approach to NFTs brings a level of interactivity and progression to digital assets that was previously unattainable or too expensive to implement. In traditional Web2 gaming, a player's dedication and time investment are rewarded with the evolution of their Pokémon, enhancing the creature's abilities and value. Similarly, upgradable NFTs reward users' engagement and milestones with digital assets that evolve, reflecting their journey and accomplishments.

Developer examples in this blog post are translating this engaging mechanic into the Web3 space using smart contracts. These contracts act as the backbone for NFT collections that can be minted, leveled up, and queried for updated metadata, much like checking a Pokémon's current level and stats.

By drawing inspiration from the Pokémon evolution mechanic, dynamic NFTs offer a new dimension of user interaction, where the value and characteristics of an NFT can grow and change, providing a richer and more immersive experience that goes beyond the static ownership model of traditional

Upgradable NFT Collection

Pokemon on Phat Contract

The concept of upgradable NFTs is a revolutionary one, and Phat Contract is at the forefront of this innovation. Let's take a look at the work done by developer Paco Yang on GitHub. He created a Next.js project that lays the groundwork for an upgradable NFT collection.

For web3 builders, this use case demonstrates how you can create NFTs that are not static but can evolve over time. This opens up a new dimension of possibilities for NFT creation, making them more interactive and engaging for users.

#[ink::contract(env = pink::PinkEnvironment)]
mod phala_nft_collection {
    pub struct PhalaNftCollection {
        owner: AccountId,
        name: String,
        description: String,
        total_nfts: u32,
        nfts: Mapping<u32, Nft>,
        // JS code to dynamically compute NFT metadata
        compute_formula: Option<String>,

    impl PhalaNftCollection {
        pub fn create(name: String, description: Option<String>) -> Self {
            Self {
                name: name.clone(),
                description: description.unwrap_or(String::from("")),
                owner: Self::env().caller(),
                nfts: Mapping::new(),
                total_nfts: 0,
                compute_formula: None,

        pub fn mint(&mut self, token_id: u32, account: AccountId) -> Result<u32, Error> {
            // Mint NFT ...

        pub fn levelup(&mut self, token_id: u32, account: AccountId) -> Result<u32, Error> {
            // Levelup the NFT data ...

        pub fn get_nft_metadata(&self, token_id: u32) -> Result<NftMetadata, Error> {
            // Return the NFT metadata ...

For more info on this implementation, check out the codebase here.


Another interesting use case is presented by Keshav Sharma in his project PokeLens on understanding LensAPI Oracle by Phala Network. In his post, Keshav explains how Phat Contract can be used to create dynamic NFTs that change based on Lens data fetched from APIs.

The idea is to create a smart contract that rewards with an evolved NFT if you accomplish the checkpoints. There are three checkpoints - Level 0, Level 1 & Level 2.

  • Level 0: i.e. Pichu is the bare minimum that can be claimed by an account if the Lens Profile has less than 10 total followers, 50 total posts, 50 total comments, 10 total mirrors, and 10 total collects.
  • Level 1: i.e. Pikachu can evolve from the prior if the profile is in the range of 10-50 total followers, 50-100 total posts and comments, and 10-20 total mirrors and collects.
  • Level 2: i.e. Raichu can be acquired if the profile is above 50 total followers, 100 total posts and comments, and 20 total mirrors and collects.


As the blockchain space continues to mature, the concept of dynamic NFTs is likely to gain more traction, offering new ways for creators to connect with their audiences and for users to interact with their digital assets. The work being done in this field is not just a technical feat but also a creative endeavor that redefines the value and utility of NFTs in the digital economy. With the continued innovation and development of upgradable NFTs, we are witnessing the unfolding of a new chapter in the story of blockchain and digital collectibles.

About Phala

Phala Network is a decentralized cloud that offers secure and scalable computing for Web3.

With Phat Contracts, an innovative programming model enabling trustless off-chain computation, developers can create new Web3 use cases.

Get the latest Phala Content Straight To Your Inbox.