Where are NFTs stored?
Storage outside the blockchain (offchain)
As we have already found out, NFTs are not stored on the blockchain, only a contract is written there stating that the NFT exists and who it belongs to.
More often than not, the actual art (metadata) is stored elsewhere as a hash.
ℹ️hash is data converted into one unique string as a set of characters. Using a hash function, we can turn huge data into a string of a fixed size, for example 256 bits.
The hashes themselves refer to centralized or decentralized storage.
Examples of centralized storage are Amazon or Google servers that store NFT metadata. With such storage, there is a risk of data loss due to disruption of servers (unlikely) and censorship (more likely).
Examples of decentralized storage are IPFS or Arweave.
IPFS
ℹ️The abbreviation IPFS stands for InterPlanetary File System or interplanetary file system. In simple words, it is a decentralized storage, data from which is stored on many computers.
ℹ️Arweave is an open, perpetual, unrestricted and uncensored decentralized archive. Essentially, this is a blockchain for storing data.
This option involves using a identification code (CID) associated with the NFT content. This type of data cannot be changed (unlike a centrally stored URL, which can be changed at any time).
It's important to note that decentralized storage is often cheaper. For example, at Arweave, the one-time fee for storing 1 MB of data forever is $0.01. And with the development of the network, the cost will only decrease.
Above we talked about off-chain storage of NFTs, that is, outside the blockchain. However, there are ways to store metadata within the blockchain. In this case, instead of NFT, the concept of a digital artifact is used.
Now we will dig deeper into the main difference - on-chain metadata storage.
Storage within the blockchain (on-chain)
Some digital assets are stored entirely on the blockchain. Simply put, they are recorded on the blockchain, along with their smart contracts and metadata.
In some ways, this is the optimal way to store digital artifacts. It leverages the best features of blockchain by storing complete information about digital artifacts in a secure, decentralized network. This ensures complete protection against censorship and hacking.
The downside is that storing this amount of information on the blockchain can be expensive, especially if the tokens themselves have a large file size. For example, in February 2022, hosting 500 KB on the Ethereum network cost $20 thousand.
However, some projects have managed to place their collections on the blockchain. CryptoPunks is a prime example. Indeed, although the collection was initially stored off-chain, Larva Labs moved it entirely to the blockchain in August 2021. Other major examples of artifacts are Loot, Autoglyphs, and Nouns.
Also, don’t forget about ordinals, all collections of which are located inside the blockchain. By the way, their metadata can hold up to 4 MB of video, pictures or text. In theory, NFTs on the Ethereum network can store 1 GB of data, but this will cost more than $150 thousand.
There are more suitable blockchains for storing data, for example, Filecoin, Sia and their analogues, which have almost unlimited capacity.