ERC-721 Interface

In September 2017, Dieter Shirley, a Github contributor, proposed the ERC-721 standard to standardize unique tokens. The proposal aimed to improve on past iterations, such as gas efficiency, and to allow the blockchain to recognize non-functional tokens.
The standard interface allows wallet/broker/auction applications to own and transact any NFT on Ethereum. Both simple ERC-721 smart contracts and contracts tracking arbitrarily large numbers of NFTs are provided.
It was in this proposal that the term “NFT” first appeared. This new standard was later used in CryptoKitties, the first project to implement ERC-721. After CryptoKitties, many NFT projects followed suit and adopted the ERC-721 standard.
Simply put, the standard allows any applications to work with any NFT on Ethereum (and later in any EVM-compatible blockchain).
Examples of ERC-721 NFTs
- Digital art - paintings, photos, videos, etc.
- Various access keys, passes, tickets, memberships to private clubs, etc…
- Avatars or PFP NFT (Profile Picture Non-fungible Token).
ERC 721 Properties
The ERC-721 standard NFT has two properties:
- ID - a unique identifier for a particular smart contract and blockchain
- Metadata (a data array with name, description, image address and other valid properties).
NFT Metadata
Knowing how to view your NFT's metadata is an important component of every NFT and helps holders understand what they are actually buying.
NFT metadata is a set of data that makes up the content of an NFT. On a website, NFT metadata can describe its characteristics and properties, such as its title, description, features, a link to a hosted image, and more.
NFTs use structured metadata to describe the basic properties of a token, which is the ideal use case for relational databases. Many encodings and data formats can be used, but the de facto standard is to store metadata as a JavaScript Object Notation (JSON) object encoded in the UTF-8 byte string. You can see the example on the image above.
There are many ways to structure metadata for NFT, and many of the details depend on the specific usage scenarios of a particular NFT platform. NFT creators use these standards so that the platform has a uniform way to use the data.
Where is NFT metadata stored?
There are two ways to store a data that forms your NFT's view:
- On-chain. It means that the entire NFT, including its image and metadata, is storing on the blockchain. This is the most secure way to store.
- Off-chain. In this case parts of the NFT or the entire NFT exist outside of the blockchain. This is because images such as JPEG files contain a lot of data, and storing large amounts of data on a blockchain can be prohibitively expensive. Storing NFTs off-chain means that parts of the NFT or the entire NFT exist outside of the blockchain. Although there are creators who prefer to store their NFTs on centralized servers such as Amazon Web Services (AWS) or Google Drive, most choose InterPlanetary File System (IPFS) , a distributed peer-to-peer (P2P) file-sharing network. Because files uploaded to IPFS are protected across multiple nodes, they are much less likely to be prone to server problems. In addition, to save money, you can store metadata from your NFT on ether, on another blockchain specialized for file storage, such as Filecoin, Storj or Arweave.
Why I need to know NFT metadata
Knowing these features of NFTs is critical if you want to keep your NFTs secure. These are just some of the possible attacks on metadata:
- Spoofing attacks, when one identifier corresponds to different metadata (of an attacker and an honest author/owner)
- Phishing attacks involved tricking a victim into taking some action that benefits the attacker.
- Fake giveaways (airdrop) with subsequent extortion of approvals (approve - permission to interact with the contract);
- Direct replacement of metadata.
Know more about Security Issues in the NFT Ecosystem.
ERC 721 contract
Today, the Ethereum ERC-721 standard is the primary standard for non-fungible tokens. However, marketplaces such as OpenSea and other applications have adopted these NFT standards, along with their own modifications.
- The original NFT standard — the metadata attributes are provided in a properties object.
- The Opensea standard is slightly different. The OpenSea metadata reference uses an array of attributes to store NFT attributes as objects.
Most popular NFT frameworks
- ERC721.sol contract. OpenZeppelin's ERC721 implementation is a community-vetted, open-source framework for building NFTs.
- ERC721Upgradeable.sol An upgradeable variation of the OpenZeppelin ERC721 contract.
- ERC721A.sol A more gas performant ERC721 implementation.
- ERC721AUpgradeable.sol An upgradeable variation of the Chiru Labs ERC721A contract.