NFTs, Explained by A Software Developer

What you need to know (as a developer) to create an NFT

In this article, you will understand what an NFT is and how we developers can create one ( or maybe 10,000).

An NFT is a transaction recorded on a blockchain that attests the ownership of a unique object, linked via metadata to some assets, usually images or video.

Okay, this definition is so general that it doesn’t explain anything when you read it like this.

Let’s take a step back and start with the basics.

What does fungible mean?

Imagine you are at the supermarket, and you get a coupon or stamp for every $30 you spend. You are a loyal customer and have 20 half-dollar coupons.

Now imagine that as you rush out the doors with your coupons in hand, a middle-aged lady bumps into you, and your 20 coupons fall out, mingling with the lady’s ones.

No big deal, you know you had 20, and the lady know she had 10. You pick them up off the ground and share them. Each one is fine.

If we think of coupons as tokens, they are fungible: you can exchange them for each other. Each has the same value and characteristics as the other.

If you dropped your house keys instead of coupons, that was different.

Although visually similar, each key differs from the other, and you could not interchange them with the lady. If we think of keys as tokens, these are non-fungible tokens.

NFTs on the blockchain

Now that we know what non-fungible means, let’s figure out how to connect these tokens to the blockchain.

The good news is that it is optional to know in detail how a blockchain works to develop an NFT. We need to know some basic information. Let’s see it.

The first blockchain — Bitcoin — was born in 2008 by Satoshi Nakamoto: however, the subsequent implementations are all based on some standard features.

The blockchain (at its base) is a distributed data ledger, i.e., we can imagine it as a database or data storage in which transactions, i.e., changes in the state of the blockchain, are written.

Its fundamental characteristic is that it is not a single, centralized data source. Still, it is distributed in a peer-to-peer network, where each computer (called a node) has a copy of the entire ledger.

The addition of data is done through consensus mechanisms because most of the network nodes validate the transaction.

The essential characteristics of the blockchain are:

it is distributed (precisely because it is decentralized).

it is transparent (because the ledger is public and open).

it is trustless (that is, it has no central authority or intermediaries that users must rely on, but anyone can operate directly on the network)

it is incorruptible (the data written on the blockchain is permanent and immutable)

it is secure (because it relies on mechanisms that ensure that data are validated, using asymmetric key cryptography and various hashing systems)

A key feature that gives the technology its name is the way the data are stored: they are grouped in a block structure concatenated together in chronological order.

Writing data to the blockchain is done by generating a new block containing a certain number of records (named transactions).

The current block’s hash is calculated, then inserted as a reference within the next block, thus concatenating the two blocks. As new blocks are added, the chain grows.

Getting closer to NFTs

In the Bitcoin blockchain, transactions essentially contain currency transfers from one account to another. Still, in 2015, thanks to the work of Vitalik Buterin, Ethereum was born.

This new blockchain allows code to run on it. This code, these programs that run on the blockchain, are called smart contracts.

Each node on the Ethereum network implements a system called the Ethereum Virtual Machine (EVM), a virtual machine capable of executing smart contracts code, using the local copy of the blockchain to read and write information, and possibly interacting with other smart contracts.

Finally, NFTs

NFTs are a particular type of smart contract that implement a specific standard. This standard is ERC-721, which defines an interface to be implemented by the smart contract.

This interface has functions for determining the ownership of an NFT and functions for transferring it.

Then there are functions to obtain the name and symbol of the NFT.

An essential function is tokenURI, which defines a URI for each of the tokens managed by the contract.

This URI must point to a JSON file with a structure like the one defined in the figure. The standard defines the first three fields. The attributes are an extension added by the OpenSea marketplace and then became very common.

The image attribute points to the actual image.

Creating NFTs

Typically, users interact with a smart contract through a dApp (decentralized application), which interacts with the smart contracts deployed on the blockchain.

Usually, the dApp takes care of getting the user connected through its wallet. At this point, it allows the user to perform minting, that is: generating a new NFT from the smart contract.

The contract will write a transaction on the blockchain, generating a new token with its associated token id.

This token id is used to retrieve the metadata and image (usually previously uploaded to a distributed filesystem, e.g., IPFS) to show the image of the newly acquired NFT to the user.

At this point, we can write the initial definition again, which I hope has become more evident:

An NFT is a transaction recorded on a blockchain that attests the ownership of a unique object, linked via metadata to resources, usually images or video.

Yes, but in practice?

To develop the smart contract code, you use an adequate programming language, Solidity is one of them.

The ERC-721 interface has already been implemented for us by Openzeppelin, a company that has written many open-source smart contracts.

Some frameworks and tools help us develop the smart contract of an NFT, test it, deploy it on the blockchain, interact with the deployed contract, and finally create a dApp for users to interact with it.

Truffle and Hardhat are two of the most popular of these tools.

To develop an NFT, you should follow these steps:

Generate the assets (images, video, audio, etc.) and upload them online. Preferably on a distributed file system such as IPFS.

Copy the URI of the assets.

Develop the smart contract that implements ERC-721. You can use Openzeppelin’s ERC-721 basic smart contract to make your life easier.

Write tests on the newly developed smart contract. Once on the blockchain, the smart contract is not editable: our bugs will remain on the blockchain forever.

Deploy the smart contract on a test network. Yes, testing environments exist in the blockchain as well, fortunately.

Run tests of mint and other transactions on a test network.

Deploy the smart contract on a production network. This step requires hooking into a node on the blockchain.

Optional but recommended: develop a dApp to allow users to create NFTs (usually paying a fee).

Bonus: deploy the contract on the blockchain

Connecting to a blockchain node is a challenging task.

But first, let’s see how a node works. Each blockchain node consists of essential parts:

the blockchain data

the EVM (Ethereum Virtual Machine) to execute smart contracts

JSON-RPC APIs that the node exposes to allow users and other nodes to communicate with it.

When a user wants to interact with the blockchain, he must connect to a node, and he does so by calling the APIs that each node exposes.

To do so, he needs to know the Internet address of this API.

Moreover, these APIs are not the classic REST APIs we are used to using every day but are “slightly” more complex. For two reasons:

1. the content of the messages, which follow a standard, are encoded in hexadecimal

2. You must sign most of the messages with your private key.

You should use a ready-made library to implement calls to a blockchain node. There are some for almost every language.

But that’s not the end of the story. It gets even more complicated, the nodes may need to be in perfect sync with the rest of the blockchain, or it may be turned off or become unreachable just as it handles one of our transactions.

How do we solve this problem?

Fortunately, there are so-called providers, i.e., services that expose the same API as the blockchain nodes but are more reliable and dedicated to these operations. The most famous providers are certainly Infura and Alchemy.

So, when you want to deploy the NFT’s smart contract on the blockchain, you must connect to a provider and perform a “special” contract creation transaction.

When the contract gets deployed on the blockchain, it assigns an address to it.

The blockchain contract address is unique and must be used to execute the various transactions that the smart contract exposes: for example, the mint or transfer of an NFT.

Closing up

We have given an overview of what it takes to create an NFT. We have barely scratched the surface of this world, and in this article, there was no way to get into the depths of development details, but stay tuned. I will post more implementation-specific material as soon as possible.

In the meantime, if you want to learn how to develop an NFT or smart contract, feel free to contact me.

Thanks, and until next time


All Comments

Recommended for you

  • Hong Kong and Macao police jointly arrested 4 people this week in connection with the JPEX case and seized or frozen 24 million Hong Kong dollars in assets.

    With regards to the JPEX virtual asset trading platform case, the Hong Kong police have received 2,417 reports, involving a total amount of over HKD 1.5 billion. Assistant Commissioner of Police, Chung Yung-min, stated that the Hong Kong police carried out a joint operation with the Macau Judiciary Police from Tuesday to Thursday this week, arresting four people and seizing or freezing HKD 24 million in assets, including casino accounts and a large amount of cash. She also said that the police are actively tracing the whereabouts of virtual assets, have identified other targets, but some have left Hong Kong. The police will work with international cooperation to arrest those involved. She pointed out that the JPEX fraud network is very large and complex, and the investigation is still in its early stages. Those involved still insist that it is a legitimate investment platform. She hopes that the public will be more cautious when making any decisions regarding JPEX. Chief Superintendent of the Cyber Security and Technology Crime Bureau, Cheng Lai-ki, said that the criminal group has destroyed many documents, making it difficult for the police to track the fraudulent funds and investigate. However, she emphasized that the police will continue to communicate with overseas trading platforms to trace the whereabouts of virtual assets. A total of HKD 5 million worth of encrypted currency assets have been frozen temporarily. 

  • Valkyrie Ethereum Futures ETF Receives U.S. SEC Approval

    The US SEC has approved Valkyrie to convert its existing Bitcoin futures ETF to a Bitcoin and Ethereum futures ETF. The new fund will be renamed "Valkyrie Bitcoin and Ethereum Strategy ETF" and will take effect on October 3, with the code still being BTF.

  • AlphaSense Raises $150M in Series E Funding Round Led by BOND and Alphabet's CapitalG

    AlphaSense, a B2B AI platform focused on business intelligence and search, has completed a successful Series E funding round, raising $150 million. The round was led by BOND and included investments from Alphabet's CapitalG, Goldman Sachs, and Viking Global. AlphaSense's valuation has grown from $1.7 billion to $2.5 billion since its Series D funding round in June 2023. The platform uses machine learning to provide deep insights into business and finance analytics, offering "insights-as-a-service." The latest investment will allow AlphaSense to continue leading the generative AI revolution in the B2B sector.

  • web3 startup IYK raises $16.8 million in seed funding, led by A16z Crypto

    Web3 startup IYK has raised $16.8 million in seed funding, with A16z Crypto leading the way and other investors including 1kx, Collabcurrency, Lattice Capital, and gmoney. According to its website, IYK is a participant in the a16z Crypto Startup School, which is an accelerator program from the venture capital giant that typically invests $500,000 in participating startups in exchange for 7% equity. IYK says that it has recruited over 100 creators from industries such as fashion, music, and art since its founding in 2021. To attract more brands and creators, it is launching a self-service platform to help create digital physical experiences.

  • Oracle project Supra completed over US$24 million in financing, with participation from Animoca Brands and Coinbase Ventures.

    On September 28th, Supra, a provider of oracle and VRF services, announced that it had completed a funding round of over $24 million. Investors in this round include Animoca Brands, BCW, Coinbase Ventures, FiveT Fintech (formerly Avaloq Ventures), Galaxy Interactive, Hashed, HashKey, Huobi Ventures, No Limit Holdings, Prosus Ventures,, Republic Crypto, Shima Capital, Signum Capital, SMO Capital, Sound Ventures, Sublime Ventures, UOB Venture Management (Dahua Bank), and Valor Equity Partners.

  • Hong Kong police arrested three people again in connection with the JPEX case, bringing the total number of arrests to 15

    Hong Kong police arrested three more people related to the JPEX case, including one director and one employee of the overseas exchange Lupin, and one popular analyst from a foreign currency exchange shop. The total number of arrests is now 15. The police have received a total of 2,392 reports, involving a total amount of nearly 1.5 billion yuan, and have frozen 77 million yuan in assets. 

  • The EU will collect data proving that cryptocurrency PoW mechanisms "seriously" harm the environment and plans to develop sustainability standards

    On September 28th, the European Commission released a tender contract worth 800,000 euros (approximately $842,000) aimed at mitigating the "significant harm" that cryptocurrency poses to the environment. The research, which will end on November 10th, will establish standards that will be incorporated into potential future EU policies to curb the impact of cryptocurrency on climate change and develop new energy efficiency labels for blockchain. The European Commission stated in the tender document that "there is evidence that crypto-assets can cause significant damage to the climate and the environment," which could undermine the EU's greenhouse gas reduction targets, indicating that new sustainable development standards may be adopted in the future. EU legislators are concerned about the energy-intensive PoW consensus mechanism that supports blockchain such as Bitcoin. The EU's research will be completed within a year and will study green issues related to the use of water, waste, natural resources, and energy by cryptocurrencies. (CoinDesk)

  • Brazil’s cryptocurrency trading volume in July was US$3.7 billion, with USDT trading accounting for 81.6%

    According to data from the Federal Tax Authority, cryptocurrency transactions in Brazil reached 18.8 billion Brazilian real (approximately 3.7 billion US dollars) in July, a decrease of 11.4% compared to the previous month. The three highest transaction volumes were stablecoins, with USDT accounting for 15.3 billion Brazilian real, or 81.6% of the total transaction volume, followed by USDC (838 million Brazilian real) and Brazilian real stablecoin BRZ (641 million Brazilian real). 

  • The National Blockchain Industry Industry-Education Integration Community was established in Xiongan New Area

    National Blockchain Industry Production-Education Integration Community Establishment Conference was held in Xiong'an New Area on September 27. The National Blockchain Industry Production-Education Integration Community is jointly formed by Xiong'an Guochuang Center Technology Co., Ltd., Southwest University of Finance and Economics, Hebei Software Vocational and Technical College, and other units under the guidance of the Vocational and Adult Education Department of the Ministry of Education, the Education and Examination Center of the Ministry of Industry and Information Technology, and the China Association of Small and Medium Enterprises, together with relevant industry associations, enterprises, undergraduate colleges, vocational colleges, scientific research institutes and other units. The establishment of the National Blockchain Industry Production-Education Integration Community aims to gather high-quality production-education resources and establish a new type of production-education integration organization to support the development of the blockchain industry, promote industrial development and talent cultivation, effectively promote the deep integration of industry and education, improve the quality of talent cultivation, better meet the development needs of the blockchain industry, and effectively promote economic and social development.

  • Slope, a Fintech Startup Backed by the Founder of Worldcoin, Completed $30 Million in Financing

    Slope, a financial technology startup supported by Worldcoin founder Sam Altman, announced the completion of a $30 million financing round, with participation from Y Combinator, monashees, and a group of angel investors in the financial technology field. It is reported that Sam Altman and Union Square Ventures jointly led Slope's previous $24 million Series A financing round. So far, the company's total financing amount has reached $187 million.