Last updated
Last updated
Clarity makes creating NFTs incredibly easy. With built-in functions for creating and working with the token, you can have an NFT created in less than 10 minutes of work.
Let's see how.
:::tip For a more in-depth discussion of NFTs in Clarity and how to create them, check out the . :::
The first thing we need when we create an NFT is a trait. A trait is an interface that allows us to create an NFT with a defined set of functions. Its primary purpose is to ensure that NFTs are composable and different tools know how to interact with them.
By implementing a trait that the community agrees on, all protocols and products know how they can interact with an NFT.
The official mainnet trait can be and looks like this:
All we are doing here is defining the function signatures for functions we'll need to implement in our Clarity contract, which we can see a simple version of below.
This is the Clarity code we need in order to create an NFT, with one additional function, mint
that allows us to actually create a new NFT. This mint
function is not needed to adhere to the trait.