TL;DR This is the sequence of actions for minting an NFT stored with its Metadata on IPFS
NFT Basic Composition
An NFT is typically a piece of content (e.g. a JPEG or a video file) plus some Metadata. This metadata adds extra descriptive information that is useful when buying and selling the NFT. A key thing to note is that the content URL is also part of the metadata.
When we mint an NFT, we need to store this content in an immutable place, so it remains accessible forever. Typically, we choose IPFS as a storage location since we can be reasonably sure that this will never disappear.
We also need an immutable place to store our metadata. So we use IPFS, too! Essentially, we do two separate uploads to IPFS: one for the content and another for the metadata. As mentioned, the metadata upload contains the URL for the content upload.
An NFT is typically a piece of content (e.g. a JPEG or a video file) plus some Metadata. This metadata adds extra information which can be used when buying and selling the NFT, for example.
Double Upload to IPFS
We do two uploads to IPFS.
First, we upload our content, getting an IPFS URL in return. The IPFS URL contains the Content Identifier (CID) plus the filename we uploaded. We can upload multiple files under a single CID, which is especially convenient for collections of NFTs.
Secondly, we upload our metadata. We take the IPFS URL, bundle it with the rest of our metadata and put that all on IPFS. This operation returns us a fully-qualified NFT address, which consists of the metadata plus a URL to the content itself.
Here’s where lazy-minting comes into play: to minimise the cost of our mint, we don’t put the NFT on the blockchain until someone wants to buy it. If we minted everything, then we’d spend a lot of money on Ethereum gas to create an NFT, which might not have much (or even any) value at all.
Most NFT mint processes will not perform the steps in blue in this diagram. Lazy-minting is ‘gasless’. The only cost is to the owners of web app responsible for managing the IPFS upload. The user will pay nothing.
Once the off-chain mint is done, the NFT exists on IPFS and can be referenced, searched, looked at and rendered in a web app. It doesn’t exist (yet) on the blockchain, however. If someone wants to buy it, or the owner wants to transfer it, they will pay the gas to mint it entirely in addition to the cost of the transfer operation on-chain.
Here’s how the sequence looks: