* Generated by stable diffusion
A dynamic NFT or dNFT is a non-fungible token whose metadata can be updated based on external conditions that originate off-chain (like through an oracle) or on-chain through state changes in the NFT smart contract itself. Dynamic NFTs unlock a whole new world of possibilities for what can be tokenised on the blockchain - A house under construction with the NFT metadata updating as it is built out; a complex game character with the metadata relecting its evolution; tokenised CDPs in Defi with the dNFT showing the latest state of your portfolio. The list goes on!
This repo contains extensive smart contract blueprints for creating a dynamic NFT on Tezos, an energy efficient blockchain that's leading the NFT space. These blueprints are referred to as structures
and they can be thought of as different techniques of incorporating dynamic metadata in an NFT smart contract.
Smart contracts in the repository are written in the two most popular languages on Tezos - LIGO(Cameligo syntax) and Smartpy. Both have their own separate folders with equivalent layouts for the ease of the viewer.
A total of 5 named structures
or dNFT blueprints are provided:
Brute structure
- As the name suggests, a dNFT using the Brute structure requires a manual updation of the metadata.Point structure
- More flexible than Brute, this one allows for dynamically creating a URI that points to the metadata.Create structure
- Adds a pinch of efficiency to Point by avoiding repetition of static fields in the metadata.Oracle structure
- Goes a step ahead and allows for dynamic metadata based on some external state received from an oracle.SVG structure
- The most ambitious of all, this enables the dynamic creation of an SVG graphic for the NFT metadata, entirely on the chain.
Each of these structure can be used in a different context depending upon the use-case of the developer. A deeper explanation is provided in the 'How to choose a structure?' section. Also, a total of 3 examples are provided that properly display how the structures can be used by developers in their projects.
If you are a beginner in your understanding of smart contracts on Tezos, you can either choose Get Started (LIGO) or Get Started (Smartpy), depending on your language of choice. If you are already comfortable with Tezos contract, you can head over to the main documentation.
If you want to checkout examples deployed on ghostnet, take a look at the deploy folder.
\
|————— assets/ # images used as NFT graphic
.
|————— deploy/ # deployment scripts and list of examples deployed on ghostnet
.
|————— docs/ # markdown files for documentation
.
|————— ligo/ # structures and examples in LIGO
.
|————— smartpy/ # structures and examples in Smartpy
.
|————— .gitignore
|————— LICENSE
These are the set of general concepts and language specific tooling that you are expected to understand before delving deeper into the code in this repo.
- TZIP 12
- FA2 multiasset standard on Tezos is a set of defined rules that will be used for creating non-fungible tokens contracts.
- This standard also defines how the token metadata should be incorporated in the contract.
- TZIP 16
- The contract metadata standard which introduces
offchain views
that are used to deliver the token metadata dynamically.
- The contract metadata standard which introduces
- TZIP 21
- The standard for rich token metadata, this elaborately defines the fields that can be added to the metadata JSON.
- LIGO - Cameligo syntax [version: 0.52.0]
- Flextesa - Tezos sandbox for testing out the contracts [version: oxheadalpha/flextesa:20221123]
- Docker - For running flextesa and LIGO images [version: 20.10.14]
- Taquito - For deploying contracts and sending transactions on flextesa [version: 14.0.0]
- Typescript - For test scripts [version: 4.8.4]
- Python - required for understanding Smartpy itself and also the utility functions written in pure python [version: 2.7.4]
- Smartpy [version: 0.9.0]
The code is provided as is. The smart contracts are not formally auditted by a third party. Users are advised to do their own research before using the code in this repository . The author is not liable for any failure or loss of funds.