Non-fungible tokens (NFTs) are digital representations of data, that embed digital authenticity and ownership and support the creation of intangible assets. Non-Fungible tokens are recorded on the blockchain, but not all NFTs are the same in the context of how they are stored. In this article, we will look deeper into the technical side of NFTs and how they are stored.
Generally, content such as files and metadata can be stored in or outside the blockchain. While it’s a common understanding that blockchain technology allows NFTs to be immutable and permanent, it’s not entirely true for all NFTs. This is where the distinction between on-chain and off-chain NFTs becomes important.
Before we start, there are a few important concepts that we need to take into consideration.
- Servers — a computer or computer program which manages access to a centralized resource or service in a network. NFTs are sometimes stored on servers. Nowadays, it is more common to be hosted on IPFS or Arweave.
- Hosting — storage of a website on a server or other computer as a service, so that it can be accessed over the internet.
- Metadata — a set of data that describes and gives information about other data. Metadata helps servers find, process, and host data more efficiently. When it comes to NFTs, the metadata supplies more information on the characteristics of the digital asset, such as the name of the token, the description of the token, plus any custom properties the creator wants to add (e.g., size, color etc.).
- Hash — The outcome of applying an algorithmic function to information in order to convert them into a random string of numbers and letters. This acts as a digital fingerprint of that information. Hashes are usually used to encrypt data efficiently and in a verifiable way.
- Smart contracts — A smart contract is a contract with the terms of the agreement between parties being directly written into code. The code and the terms of contract held there exist across a distributed, decentralized blockchain network. The lines of code enforce the execution while and transactions are traceable, transparent and irreversible. Without the need of a central authority or a legal system or an external enforcement mechanism, smart contracts allow trusted transactions and agreements to be performed. NFTs are minted and exchanged through smart contracts.
On-chain NFTs exist entirely on the blockchain and have all their metadata and smart contracts stored on-chain. This means that the data of these NFTs are stored on the blockchain.
On-chain NFTs include two important data components:
- Metadata which is the core information of a specific NFT — The name of the token, the custom properties of the NFT, where the digital copy is stored, and more. As this metadata is integrated with the on-chain NFT, the information itself lives on the blockchain as well.
- Smart contracts that can generate on-chain digital assets.
As the metadata, smart contract, and NFT are stored on the blockchain, we eliminate the need to rely on external systems or a third party. Therefore, if the blockchain is up and running, the NFT collection will always be available. However, storing entire image files requires considerably more computer storage. It is therefore extremely expensive and hence not common yet.
While on-chain NFTs live entirely on the blockchain, off-chain NFTs do not. They exist in two parts — the smart contract and the metadata for the actual artwork. Most commonly, the NFT’s smart contract — which is deployed on the blockchain — does not store the digital work/image of a physical work or any metadata on the blockchain, but only stores a pointer to an off-blockchain storage location, hence these NFTs are called Off-Chain. The pointer is basically a link that leads to a file holding the NFT’s respective metadata. This metadata file holds, among other information, the link to the image file of the represented digital work or an image of the represented physical asset.
The smart contract exists on the blockchain holding a set of rules which help the transaction and serves as a digital description of the content. The smart contract also holds a link that points to the server that stores the digital artwork, which may not be stored on a blockchain, but off-chain.
Although such off-chain NFTs are currently the most common way of linking NFTs with the assets it represents (like an image file), such an approach is technically rather risky. There is no guarantee that the file will not be replaced or overwritten by a file with the same name in the future. There is also a potential risk that the link leading to the work or even to the metadata file is tampered, as the server hosting the image, or the metadata might be no longer up and running. The entry on the blockchain would still exist and the NFT holder would still own the NFT, as it consists of a tokenID and an alphanumeric address of a smart contract. However, the NFT holder would only have a tokenID, but not the image of the physical asset or the metadata. In this case, the NFT would no longer fulfill its purpose and would not be able to link an NFT to a represented asset.
The risk of a broken link is indeed present. This can happen, in the case a web server company can no longer run its servers due to insolvency or other reasons. Already today, there are links to NFTs that that lead nowhere.
To avoid the risks involved with this kind of technical set up of an NFT, there are alternatives to how to link an image to an NFT. For example, it is possible for an NFT to point to an IPFS (InterPlanetary File System) location. IPFS is a peer-to-peer network. This means that uploaded files are stored and exchanged on several computers, which allows for the network to work in a decentralized and secure manner. Every file uploaded to IPFS is assigned a unique URL, a “fingerprint” of this file. This means that pointing an NFT to a specific IPFS URL guarantees that the asset behind the NFT cannot be altered (because the altered asset would be assigned a different IPFS URL). When using an IPFS, any user can access the file and compare the hash value of the file with the hash value of the NFT. Therefore, anyone can verify that the NFT refers to the original file.
Another solution would be to use Arweave. At its core, Arweave is a Decentralized Storage Network (DSN) that connects people who have extra available computer disk space with those who need more computer storage. It is designed to provide a scalable, cost-effective, and permanent data storage, and it is built on a blockchain-like data structure called the blockweave.
There are a few other options for off-chain storage, such as Google Drive, AWS, iCloud, or a centralized hardware server storage. There are, however, certain challenges with this approach. Firstly, we rely on third parties to be up and running as with any centralized server or storage. Secondly, there is a risk in security because these servers may be hacked, and their information may be tampered with. Nevertheless, IPFS does provide a more secure method of storing data as it is a P2P, distributed and decentralized storage network with no central point of failure. In the case a storage location fails, it will be backed up by a peer. But if the owner of the NFT decides to remove the NFT file from an off-chain storage, it will then break the link between the file and the blockchain.
The block.co approach:
NFTs minted through the Block.co platform have their metadata and assets stored on IPFS, through a commercial IPFS node provider called Pinata. This makes them immutable (since the NFTs are pointing to the IPFS URLs of the assets that were defined during minting, and these IPFS URLs can only point to these exact assets). Furthermore, this keeps the costs low, since IPFS storage is much cheaper than storing whole assets on the blockchain. Due to size limitations with Ethereum, NFT file data can be stored on IPFS, Arweave, or both. Both file hashes from these storage platforms can be written to the NFTs during minting. We believe this redundant storage, especially when paired with on-chain metadata, provides an extremely robust NFT solution with the goal of being permanent and immutable. However, we also cater for On-Chain NFTs depending on our clients’ needs.
Tel +357 70007828
We regularly post educational materials on our social media, follow us to stay up to date about the latest blockchain and NFT news.