Deep dive into NFT Metadata
NFTs are usually referred to as picture on-chain, but NFT is more than just on-chain JPEG. NFTs on Ethereum are built on smart contracts which are standardized in most cases as ERC-721, sometimes referred to as ERC-1155. If you do lack understanding of what ERC means, you can read this article in order to understand ERCs and it’s fundamentals. This article is deep dive and overview of Metadata and issues the NFT ecosystem is facing with metadata.
In the NFT space it’s pretty known that we are facing a lot of issues which are usually attached to the lack of technical development of ERC-721 as the most used NFT Standard. The main issue with this standard is associated with Metadata. There are numerous issues of how not so competent this standard is and people like Transmissions are sharing insights how this standard can be improved. But before you start hating this standard, you need to understand the fact that ERC-721 was created in 2017 when the Ethereum chain was “in diapers’’. The ERC-721 was proposed to allow smart contracts to operate as tradable tokens similar to ERC20 token standard as we were missing having the option to create and trade non fungible items on chain. It is the most used standard that NFTs are being minted using this smart contract, which is being modified by marketplaces in order to add functions to it which the basic standard is missing.
The fact that ERC-721 — the most used NFT standard is super simple — is giving a ton of headaches to the developers. This standard defines metadata as tokenURI which is referring to IPFS (or other storage provider service) URL (link).
ERC721 is using tokenURI which is a unique resource identifier of the NFT itself. This can be linked to a server where the metadata — picture (file) is stored. Usually IPFS, Arweave or centralised server link. So NFT metadata is defined as a URL which points out to the server where the NFT file (JPEG, PNG…) is stored.
Other attributes / properties are not defined in the ERC-721 contract itself. Opensea made metadata implementation of rich metadata to ERC-721 and ERC-1155 standards aiming to provide more options for metadata. This implementation is pretty popular around ERC-721 and ERC-1155, it is being used around the projects quite a lot.
The ERC-1155 is extending the features of ERC-721 and adding multi token features like storing data of multiple items, atomic swaps — trading multiple items by batching the items into one or multiple accounts in a single transaction, multi transfers and unification. This standard makes it easier to store multiple items in a single smart contract with the minimum possible amount of data needed to recognise (distinguish) the token from others. The contract contains tokenID that contains the configuration and all the behaviour governing the token collection. Each item has its own unique identity and can be traded, indexed and fully fungible with others. This standard is supporting only image files as metadata.
This standard was initially proposed to solve issues with describing metadata in ERC-721. It introduces tokenURIIntegrity and tokenURISchemaIntegrity functions. These are supposed to provide access to assets on-chain by adding schema to the metadata itself which is describing metadata in a more readable way.
This standard is stagnant which means it is inactive for a period of 6 months or greater. Most likely there are other solutions like OpenSea metadata standard or Zora metadata media which can replace this standard.
The OpenSea Rich Metadata standard
The Opensea metadata standardisation is using schemas which are being added to JSON files, schemas are describing data as visual characters. This standard is supporting multimedia attachments — audio, video and 3D models including interactive traits for your items which makes it easier to filter and sort items on OpenSea marketplace.
Zora Media Metadata standard
Zora protocol has a bunch of amazing documentation and modifications of ERC-721 and NFT smart contracts. In ZDK you can find a bunch of modules for interacting with ZORA NFT contracts including ERC-721, metadata schemas and many handy tools.
Why should we even care about NFT Metadata ?
It is complicated for the NFT marketplace (or any other NFT minting platform) to know what’s the mimeType (definition) of an element definition of metadata — whether it is “img”, “video”, “iframe”, “gif” or other file format. The front end does not know what kind of file you just uploaded on the platform as it can read only the tokenURI which points to IPFS/Arweave/ centralised storage link. The link itself contains (if it is uploaded to IPFS): ipfs://SHA (hash algorithm), for example: ipfs://QmQ9xMUDiWtVp1YMU1f1MpcdsB3enP6V3JfYmTmhnju5JC which does not gives any information to backend how the file should be displayed. Whether it is a video, image, gif… the front end needs to know what type of file you just uploaded in order to show it correctly. This can be done by adding check boxes of what file you minted in order to show it correctly on the front-end.
New EIPs which are aiming to solve (not only) metadata issues
These EIPs were created by NFT Standards Working Group members.
The implementation is modifying Permit EIP-2612 but with added functions to support functions of non fungible token instead of fungible token functions.
This EIP is identifying underlying content and associated data type of the NFT file itself via on-chain getter function.
This ERC is proposing to add TypeScript specification of JSON file representing metadata.
ERC for backward-compatible signed ERC-20/ERC-721/ERC-1155 transfers. This implementation is wrapping ERC-20, ERC-721, or ERC-1155 assets with a permit function.
There are a few gaps in the NFT ecosystem and development and as a community we can do better. The biggest issue the NFT dev ecosystem is facing are metadata. Generally speaking, in the most used standard ERC-721 the metadata is lacking. The ERC721 is using tokenURI which is a unique resource identifier of the NFT itself. This can be linked to a server where the metadata — picture (file) is stored. Usually IPFS, Arweave or centralised server link. Many projects are using the implementation of ERC-721 which is not very gas efficient. We need better support of video formats of NFTs as there are many issues with video and music NFTs. Platforms are creating their custom solutions which are going against smart contract cross platform interoperability.
More to explore:
Dive into NFT Standards wiki
Excited to see new NFT standards being created and surge in NFT ecosystem development!
We are going to host the NFT Dev Meetup in Denver! More updates are coming soon!
Consider making donation to Ethereum Magicians Gitcoin grant to support NFT Standards Research and Development
This article was initially published on Mirror