Building Dynamic NFT Metadata on the Fluence network

AngelDAO
3 min readDec 16, 2021

Our dev team at AngelDAO recently participated in the Web3Jam ETH Global hackathon. After talking with the team at Fluence Labs we realized that the potential to create Dynamic NFTs programmed to update metadata based on certain events is one of the largest untapped use cases in the NFT ecosystem. There are many possible use cases — updating NFTs based on the results of real world events like sports matches using oracles, continuously generative artworks that change over time, or in our case updating NFT metadata in blockchain games based on results of gameplay.

Proof of concept (Chess)

Because the Web3Jam hackathon was one week long, we decided a good proof of concept would be to update a demo NFT metadata file based on the results of moves in a chess game.

Any chess move can be expressed in a format known as Algebraic Notation. It is based on a system of coordinates used to denote which square a piece is moving towards, whether a capture occurs, and in some cases the square the piece is moving from. This is what it looks like:

Algebraic Notation

So our goal for the hackathon was to add the algebraic notation of each move to the NFT metadata file as it was played in real-time.

Fluence-JS Typescript SDK

In order to use the Fluence network we needed to code a Fluence Peer class that would be accessible on the Fluence Network and would contain functions to read and write moves.

Our Fluence Peer used a Ceramic stream to read and write files, and created a new JSON file on Ceramic for each game that is started. Once we had these functions, we needed to create the Aqua file which would define the entities in our Fluence Peer class. Aqua is a new programming language made for Fluence Network designed for peer to peer applications and interactions.

When we run the Fluence Peer, it is possible for anyone to connect to it via the Fluence Network nodes.

Connecting to the Frontend

The Frontend consisted of a chess board and three button. Create a New Game, which will generate a new Ceramic NFT metadata JSON file, Load Game which will accept input with a ceramic stream ID from a previous game and load the position on the chess board up to the last move, and View Dynamic NFT metadata which opens the Ceramic testnet explorer with the ceramic stream ID of the metadata file.

Every time you make a move, the mock NFT metadata file updates the array of moves and adds the latest move.

Future use cases

As described above there are many future use cases for NFTs that track real world events and generative art works. The use case we chose to demonstrate is focused on the crypto gaming sector. In the future this sort of integration will allow games to update your character’s profile NFT in real time as you acquire new virtual items in your inventory, change your outfit as your equip new clothing and armor, and much more.

The proof of concept we made during the Web3Jam hackathon is the easiest example for developers who are new to Fluence to understand in order to implement such solutions in their games and projects, and we hope it will serve as a useful reference.

Github: https://github.com/AngelDao/DynaChess

--

--