Technical foundation of NFTs
Research
September 30, 2021

Technical foundation of NFTs

NFTs first appeared in 2017/2018, but their prevalence truly began to spike in 2021. As NFT adoption continues to increase, the technical foundation underlying them is also evolving. At  their core, NFTs are one of many applications of the vast world of blockchain and smart  contract technologies. However, only a select number of blockchain protocols can support the use and scale of NFTs with Ethereum being the most common one. The following article will  aim to distill the technical blocks powering NFTs. Accordingly, the following topics will be  covered: 

1. A review of blockchain and smart contracts 

2. Different NFT standards and underlying blockchains 

3. Storage of NFT metadata 

1. A review of blockchain and smart contracts  

In order to understand the technical foundation of NFTs, it is important to have a clear  understanding of blockchain and smart contracts. In fact, they constitute the building blocks  of a functional NFT scheme.  

Blockchain: blockchain – as an idea – was first proposed in 2008 by Satoshi Nakamoto where  he simultaneously introduced the concept of bitcoin. Satoshi aimed to create a peer-to-peer  system for financial transactions, and unlike any traditional financial system, bitcoin uses  algorithms to reach an agreement on transaction data – blockchain is the technology that  powers said algorithms. The blockchain can be thought of as a distributed database that  maintains a list of records in blocks of data that are protected and linked to one another using  cryptographic protocols. Once a transaction happens, these cryptographic protocols are solved  and confirmed by a decentralized set of computers (or nodes). After the shared data on the  blockchain is confirmed in most distributed nodes, it becomes immutable because any  changes in the stored data will invalidate all subsequent data. The most common blockchain  platform used in NFT schemes is Ethereum; this particular platform introduced the notion  of smart contracts.  

Smart contracts: Smart contracts are computer programs that can automatically verify,  execute, document and accelerate a set of digital actions defined by their authors. Their  novelty resides in the fact that the author of a smart contract can pre-define a set of  conditions or terms under which the contract would be executed. Therefore, they allow  decentralized parties to transact fairly without a trusted third party. Ethereum further  developed these smart contracts in the blockchain ecosystem. Under Ethereum, the terms of  a smart contract are shared by all stakeholders, thereby guaranteeing more transparency.  An example of the application of smart contracts in the NFT space is that they allow  developers to place a cap on the supply of non-fungible tokens and enforce persistent  properties that cannot be modified after the NFTs are issued.

Address and transaction: A blockchain based address is made of a fixed number of  alphanumeric characters. It is the unique identifier for a user to send and receive an asset. To transfer the ownership of a digital asset (including an NFT), the owner must prove its  possession; this operation is usually performed using a cryptocurrency wallet.  

NFT encoding: Encoding can be defined as the process to convert a piece of data from one  form to another. Typically, data tends to be encoded in a compressed format to save memory space or into an uncompressed format to preserve its high resolution. In the Ethereum blockchain, hex values are used to encode the elements of a transaction. This includes its  function name, parameters and values. The ownership of an NFT can therefore be  transcribed to the ownership of a set of hex values defined by its creator.  

2. Different NFT standards and underlying blockchains  

Before an NFT is uploaded in the blockchain there are a couple of steps that must occur in the back end: 

1) The NFT is digitized meaning that the owner checks that the file, title, description are completely accurate. Then, the owner digitizes the raw data into a proper format.

2) An NFT owner stores the raw data into a database that could be outside or inside the  blockchain 

3) The NFT owner signs the transaction including the hash of the NFT and sends it to a smart contract 

4) The minting and trading process begins. The main mechanism behind NFTs is the  logic of the Token Standards that will be discussed in the coming paragraph. Here,  the mint function has to check if the specific hex code of the color had already been  minted. To proceed, the color token has to have never been minted before 

An NFT scheme is a concept/technology that can be built on top of various blockchains. Given that each blockchain is distributed and not controlled by a central authority, developers  within a community commonly agree to a set of standard rules that should be followed for  the implementation of NFTs. This ensures the uniformity of each NFT. However, it is  important to note that the standards across different blockchains are not necessarily  interchangeable. This means that while it is possible to transfer an NFT from a blockchain  to another one is possible, it remains a very complex task. The following section will cover  the most popular blockchains and NFT standards. 

ERC 721:  

Ethereum is regarded to be a pioneer in the NFT space and remains to  this date the most widely used blockchain platform to power NFTs. In particular, the most popular standard used is ERC 721 on the Ethereum blockchain. ERC721 represents a standard for tokens that are non fungible, and is considered the first standard for non-fungible tokens and  was released in 2018. It allows each token to be unique and to have a price associated with  it that is independent of other tokens. Inside every ERC721 smart contract, a given NFT is identified by a unique unit256 variable also called tokenID. This token cannot be changed during the lifetime of the contract.  

The code below represents the fundamental functions of smart contract under ERC 721 - the  ownerOf function allows users to check the owner of different assets and the transferFrom  function allows the transfer of assets between wallet addresses. 

Algorithm 1: NFT Standard ERC721


interface IERC721 { 
function ownerOf(uint256 _tokenId) external view returns (address); 
function transferFrom(address _from, address _to, uint256 _tokenId) external payable;

  

ERC-1155:  

ERC-1155 allows for the representation of both fungible and non-fungible tokens.; the  standard was first developed and intended for use across the gaming community. In fact,  fungible tokens could represent a currency in any given game while non-fungible tokens could  represent different assets of the game. It was therefore important to have a set of standards  that would allow both fungible and non-fungible tokens. The main advantage behind ERC 

1155 is that a single smart contract can govern an infinite number of tokens. Therefore,  creating a new token only requires a function to add an ID to the pool of tokens available. In  contrast, creating a new token on ERC 721 requires deploying an entirely new smart contract  which is very costly.  

The code below represents the most fundamental functions under ERC1155. Both functions  feature the uint256 variable _id for referencing token categories; the transferFrom function  features the uint256 variable quantity for transferring an amount of the specified type  (variable is commonly defined in fungible tokens). 

Algorithm 2: NFT Standard 1155 

interface IERC1155 { 
function balanceOf(address _owner, uint256 _id) external view returns (address); 
function transferFrom(address _from, address _to, uint256 _id, uint256 quantity) external payable 
}

Flow-NFT Standard  

Flow-NFT standards are set of rules for the Flow blockchain network. It was created after  the success of one of the first NFT games: Cryptokitties.

The team behind cryptokitties (Dapper Labs) realized the limitations of using ERC-721 at scale. They decided to solve this  problem by creating the flow blockchain which uses the proof of stake mechanism along with initiating the Flow-NFT standard. This is the standard behind NBA Top Shots, the most popular NFT-based platform to date. The Flow-NFT  standard deviates in some of its properties when compared to the ERC standard. First and foremost, smart contracts on Flow are written in  Cadence, a different programing language that is arguably easier and  more accessible than other blockchain native languages. Moreover, it  allows “upgradeable smart contracts”; these smart contracts are first  deployed in a beta state where they can be improved or fixed even after they have been deployed. They are then deployed in a “final state” where they become immutable like the  other smart contracts.  

3. Storage of metadata  

Metadata is a crucial part of the NFT scheme. It corresponds to series of variables that  describe the characteristics of an NFT. An example of a metadata file would be the following: 

Algorithm 3: Metadata file 


"name": "Color",
 "hex": "#F08080", 
"link": "https://bit.ly/3mdRahT",
"owner": "0x6902702BB5678D7361C94441c71F600C255dd833"

When the ownerOF function described above is used to verify the ownership of an NFT, it  references to the metadata files. In fact, each NFT corresponds to a specific set of metadata  file that describe the NFT. For example, the metadata of an NFT representing an event ticket  might include the date, seat, type, and the owner of a ticket. Many encodings and format can  be used to store the metadata but the most common one is to store it as a JSON. There are 2  storage solutions to store the metadata: On-chain and off-chain storage.  

On-chain storage:  

In the blockchain sphere, a chain is often used to colloquially reference a blockchain of some  sort. Storing metadata on-chain therefore refers to storing it on the blockchain. This has two core implications. Firstly, it means that the metadata is governed by the on-chain logic.  Secondly, it means that it will be stored on that chain for its lifetime – or in other words, it  will not depend on the underlying author. 

Off-chain storage:  

The alternative to on-chain storage is off-chain storage, which means that the metadata is  stored outside of the blockchain where the NFT lives. The implication is that the metadata  does not need to follow the governing restrains of a given blockchain. The main advantages  of storing metadata off-chain mainly involve considerably cheaper costs – it also makes it  easier to interact with different blockchains. In order to circumvent the difficulties of on chain storage, various blockchain protocols have standards on how to store an identifier that  can be used to retrieve metadata that is stored off-chain For instance, ERC721 includes a  function tokenURI that allows the retrieval of the location of the metadata. It returns a public URL that itself returns the metadata. 

There are 2 main ways of storing meta data off-chain: centralized and decentralized servers.  Centralized servers include cloud storage solutions like Azure or AWS. Here, only a link to  the location of the metadata in these centralized servers is stored on-chain. This link serves  as a direct path to the metadata in the centralized server. The disadvantage of centralized  servers solution is that the developer can indeed change the metadata of interest; in addition  to this, the server has the authority to change the link of the metadata – preventing it from being retrieved.  

Decentralized servers are ones where the data is stored through a multitude of servers. For  instance, the most common decentralized server is IPFS. It is a peer-to-peer storage system  where the data is stored and replicated across different locations. It prevents anyone from  replacing or changing the metadata. As with the centralized servers, IPFS produces a unique  link that is derived from the metadata and links to the metadata in the IFPS network. 

Source: The broken promises of NFT Art – Jboogle medium article   

Concluding remarks  

Ultimately, we can observe that the technical blocks powering NFTs are fundamentally tied  with the innovation and basics of blockchain technologies. The Ethereum blockchain and  supporting standards are to date the most important technologies enabling NFTs. However, due to the large gas fees associated with it, developers need to adapt and often innovate to  deploy NFTs at scale. It is important to note that these are still the early days of the cutting edge technology that is the NFT, and yet, we can bear witness to its rapid evolution. It is fair  to assume that new standards and storage solutions will come to place in the coming months;  however, the fundamental logic and foundation shall remain the same.

References  

Anett. (2021, May 02). NFTs - Exploring Infrastructure, Usability, Role in DeFi, And  Questions About Ownership. Retrieved from hackernoon

Barda, V. (2021, June 06). ERC-721 NON-FUNGIBLE TOKEN STANDARD. Retrieved  from Ethereum

Boogle, J. (2020, November 28). The broken promises of NFT Art. Retrieved from jboogle blog

Numbers Deep Tech. (2021, April 28). Ethereum’s Standards for Non-Fungible Tokens:  ERC-721 and ERC-1155. Retrieved from Numbers Deep Tech 

Opensea. (2020, January 10). The Non-Fungible Token Bible: Everything you need to know  about NFTs. Retrieved from Opensea blog

Radmowsvki, W. (2019, June 17). ERC-1155: The Final Token Standard on Ethereum. Retrieved from Enjin

Qim, J. (2021, April 4). An Introduction to NFTs. Retrieved from Medium

Shaan R. (2021, May 22). Non Fungible Token (NFT) Standards: An Overview: Retrieved from hackernoon

Stuven, R. (2021, January 29). On-Chain Artwork NFTs. Retrieved from Treum blog

Wang, Q. Li, R. Wang.Q. Chen. S. (2021, April). Non-Fungible Token (NFT): Overview,  Evaluation, Opportunities and Challenges.

What’s a Rich Text element?

The rich text element allows you to create and format headings, paragraphs, blockquotes, images, and video all in one place instead of having to add and format them individually. Just double-click and easily create content.

Static and dynamic content editing

A rich text element can be used with static or dynamic content. For static content, just drop it into any page and begin editing. For dynamic content, add a rich text field to any collection and then connect a rich text element to that field in the settings panel. Voila!

How to customize formatting for each rich text

Headings, paragraphs, blockquotes, figures, images, and figure captions can all be styled after a class is added to the rich text element using the "When inside of" nested selector system.

icon
Prev. article
Next article
icon