Metadata is possibly one of the most critical pieces of data for builders creating NFT-related experiences. What people don’t see is just how deceptively difficult it is to fetch and build with NFT metadata, especially at scale...here there be dragons.
Today we’ll take a quick look at some of the peculiarities of NFT metadata so you know what types of dragons you'll need to tame in order to work with this important contextual information.
Metadata brings NFTs to life
Before we jump in, let’s take a moment to discuss what NFT metadata is and why it is so significant. If you’re building an NFT-related Web3 experience, there’s a good chance that you’ll be working with NFT metadata in some form. That’s because in many ways NFT metadata is what makes an NFT an NFT. Metadata is the soul of an NFT. Unlike ERC-20 tokens, which are fungible, NFTs are by definition, non-fungible. These digital assets are completely one-of-a-kind and the information about their unique attributes and descriptions is stored in their metadata. An NFT without metadata is nothing more than a record on a ledger.
3 Challenges to prepare for if you’re building with NFT metadata:
1. Making sense of countless different metadata schemas and edge cases
Let’s say you’re building an NFT wallet experience and want to visually display the NFTs your users own. To do this, you’d need to fetch the contents of a specific wallet, and then get the metadata of each NFT held. At first glance, the solution seems easy: crawl the URI listed on the chain and return the data. Unfortunately, it’s not that simple. Currently, there are thousands of unique schemas for structuring NFT metadata in use. So, before you can effectively retrieve the data you need, you need to understand how the data is structured, which you can do by reading through the collection’s smart contract. It’s also helpful to know where the metadata lives and whether it is encoded or not before you can properly index it.
This context-gathering is not so bad if you only need metadata from a handful of collections and have the means to parse through their smart contracts and familiarize yourself with their schemas and encodings, but it’s not feasible to do this rapidly at a broader scale. This is why so many marketplaces and wallets out there only support a specific set of collections, or list collections as “coming soon” – they’re onboarding new collections one by one, taking care to look at each collection’s metadata individually so as to not create a poor user experience.
2. Maintaining up-to-date metadata
Retrieving the freshest metadata possible will become increasingly important as NFT utilities continue evolving. NFT Metadata is not always static, which means taking a snapshot of a token’s metadata at a given moment in time is not sufficient – it needs to be re-indexed. Otherwise, you risk displaying outdated information.
The most common example of this is NFT reveals where all the NFTs for a given collection initially have the same preview graphic up until reveal day, when the actual NFTs are revealed and the images are updated in the metadata. In cases like this, as well with composable or dynamic NFTs, you’ll need to crawl and re-index metadata in order to ensure you’re consistently displaying the freshest metadata to your users.
Considering there are tens of thousands of new collections emerging every month, continuously crawling and re-indexing metadata for every collection out there is simply not a scalable or useful solution, so you’ll need to find ways to detect when metadata needs to be re-indexed and have your crawler act accordingly.
3. Relying on centralized servers
Finally, while there’s a fundamental assumption that Web3 should be fully decentralized, you may be surprised to learn that at least 70% of NFT collections today have metadata stored off chain in centralized storage servers such as AWS.
Unlike decentralized storage solutions that are guaranteed by design to be available for indexing at any time, centralized servers can have reliability issues that you’ll want to plan around. If a server is overloaded with too many requests or out for maintenance and can’t serve your requests, you’ll have to retry until the metadata becomes available again…often at the unfortunate expense of your user experience.
Unfortunately, the reliability of off-chain stored metadata is largely out of your control as a developer, though one thing you can do to help improve the quality of the experience you’re building is notify your users whether the metadata for an NFT they’re viewing or otherwise interacting with is stored off-chain or on a decentralized storage solution such as IPFS.
There’s a better way to fetch NFT metadata
As you can see, accessing, normalizing, and maintaining up-to-date metadata to power your application is not as simple as it may seem at first. That's one of the many reasons we built Mnemonic. Mnemonic's easy-to-use APIs enable you to easily build with any NFT datapoint imagineable -- including metadata. We tackle the complexities associated with NFT metadata and provide complete, normalized metadata that is kept up-to-date in real time.