NFT and Marketplace

Narendra Soni
8 min readDec 27, 2021

Non-Fungible Token, so what are they? How does it work? How to launch your own NFT Marketplace?

If you’re looking to learn about how NFTs work and want to learn about things to consider while building your own NFT Marketplace then probably you’ve landed at the right place.

This article would give you a general understanding of NFTs and the knowledge you would need to build an NFT marketplace.

Small disclosure before we proceed to another section.

The content in this article is for educational purposes. Views expressed are purely personal and do not reflect any organization’s view or thoughts that I may be affiliated or associated with. Please do your own due diligence.

NFTs are a type of tokens that can be used to represent possession of one-of-a-kind objects.
It is created to prove and verify the authenticity and ownership of an asset. Objects may refer to for example :
1. Limited edition baseball card
2. Place Ticket
3. Artworks
4. Avatars in e-games
5. Land in Metaverse

Properties of NFT
1. Uniqueness
2. Traceability
3. Rareness
4. Indivisible
5. Programmability

Uniqueness

In order for an asset to hold value, it must be having unique features. A buyer/owner must be able to clearly differentiate it from other assets in the market and hence derive the value in buying or owning the NFT.

Rareness

NFT must be just a limited edition. Owning a rare asset gives users the opportunity to reap rewards in the long term. Because the asset is rare so probably it would be able to generate demand in the market and users can sell it for a higher price. Owning rare assets also can give users exclusive rights.

NFTs that are rare and unique, this is already a great combination. If you can create/own such assets, you will be able to make crazy returns.

Traceability

Once the record of NFT is written in blockchain, it forever lives there. It hardly takes a second to trace the owner of NFT or even to track the transactions associated with the token. It does not cost any money to gather information about NFT and its ownership

Indivisible

NFT represent one single entity. At any point in time, there could be one single owner.

Programmability

NFTs are records written in the blockchain or to be more precise Smart Contract. If we take the example of Ethereum Blockchain, NFTs can be created using ERC-721. ERC-721 is an open standard for NFT smart contracts.
Different blockchains, publish their own standards. If you follow the standard, you can be assured that the tools (wallets, block explorers, and other third-party services) will be supported and your token will be compatible for seamless integrations.
NFTs can be programmed to Mint, Burn, Buy/Sell, Transfer, or probably do all kinds of automation that are supported in Smart Contract using SDKs available in different languages and frameworks.

Operations on NFT

  1. Mint
  2. Burn
  3. Transfer

Mint

Minting is the process where the owner for the very first time enters the record for the asset in the blockchain.

Let’s take an example of the ERC-721 reference smart contract for Ethereum blockchain.

function createNFT(string memory tokenURI) public returns (uint256){     //get number from token counter 
uint256 newNFTTokenId = tokenCounter;

//safely mint token for the person that called the function _safeMint(msg.sender, newNFTTokenId);
//set the token uri of the token id of the uri passed _setTokenURI(newNFTTokenId, tokenURI); //increment the counter tokenCounter = tokenCounter + 1;
//return the token id
return newNFTTokenId;
}

A tokenURI is an IPFS URL. After the token is minted, it returns the id of the token.
_safeMint and _setTokenURI are the underlying implementations provided by the community standard ERC-721 open-source reference smart contract provided by OpenZeppelin.

It is recommended to use Smart Contracts provided by OpenZeppelin because it is battle-tested, secure, and accepted by the wider community.

Burn

Burn is a process of erasing the entry of records in the smart contract.
The owner of the token or an approved account could possibly burn the token if the burn function is supported by the underlying smart contract.

function burn(uint256 tokenId) public {
require(_isApprovedOrOwner(msg.sender, tokenId));
_burn(ownerOf(tokenId), tokenId);
}

_burn is the implementation provided by OpenZeppeline ERC721Burnable smart contract.

Buy/Sell

Buying and selling of NFT involve a change of ownership. Change of ownership just means, updating of address in hashmap data structure inside the ERC721 contract to buyer’s wallet address.

mapping(uint256 => address) private _owners;

Transfer of ownership could be initiated by the owner or approved account.

function transferFrom( address from, address to, uint256 tokenId ) public virtual override { 
require(_isApprovedOrOwner(_msgSender(), tokenId), “ERC721: transfer caller is not owner nor approved”);
_transfer(from, to, tokenId);
}

Now that you have got a general understanding of NFT, we can start to discuss NFT Marketplace.

NFT Marketplace

NFT marketplace is a dedicated application that allows users to mint, buy, sell, auction, or initiate any kind of operations which applies to NFTs.

Some of the popular NFT marketplaces are OpenSea, Axie, CryptoPunks/LarvaLabs, NBA Top Shot, Rarible, SuperRare, KnownOrigin, Foundation, MakersPlace, NiftyGateway, Solanart, Binance NFT Marketplace, AtomicMarket, Aavegotchi, Decentraland etc.

You maybe have questions like.

Why build NFT Marketplace?
What should be a strategy?
What are the key things that should be considered for implementation?

I did have similar questions when I first started working on NFT and Marketplace and managed to figure out some key details around this use case. In the below sections, I have listed down the key details which might help you to form a strategy to build your own NFT Marketplace.

Custodial vs Non-Custodial Wallet

All major crypto services provide users an option to connect their own wallets via browser extensions or hardware wallets.
Custodial wallets are often common in exchanges like Binance, Coinbase, Gemini, etc. In this case, the exchange is your custodian which holds your keys and is tasked with securely storing your funds.
Many users prefer custodial wallets because they don’t require as much responsibility and are usually more convenient. Losing your password to a non-custodial wallet could be stressful if you do not manage your keys properly. Once you lose your keys, you forever lose control of your account.
However, if you forget your exchange account password, you will likely be able to reset it.

Non-Custodial wallets give you complete control of your keys and hence your assets. These are browser-based wallets.

User vs Admin minting and listing NFTs for sale

In Peer-To-Peer marketplaces like OpenSea etc, it is common that anyone can Mint NFT and list it for sale. In some cases, platform owners keep exclusive rights to mint NFTs. Only the administrator or approved account does the minting and users can buy the NFTs or sell it.
It could be the case where a luxury brand wants to host its own marketplace for its limited-edition NFTs and hence reserves rights to only publish NFTs minted by the brand. Users can however connect the wallet and buy those NFTs or probably re-sale it at a later time.

Lazy vs Upfront minting

Minting does cust some native tokens in terms of gas fees. In Ethereum it can cost some significant amount of $$ depending on the data stored in blockchain.
Also when you’re launching your NFT for the first time, you do not know what kind of response you might get from the community.

Hence it makes sense to think of a strategy to support minting only when the first buyer has paid the initial price of NFT.

Royalty

NFTs do provide artists or creators an avenue to earn on their artwork. Creators can charge some fee whenever NFTs change hands. It depends on what charge the creator of NFT wants to earn, they can set it as the initial parameter while minting.
However, to support the royalty fees, the underlying NFT smart contract must have this feature implemented. Also, you can explore if it would be worth considering updating of royalty fee at a later time or even to turn it ON and OFF if the creator or approved account would like to do that.

Platform Fee

It is common that platforms charge some nominal fees in buying and sell for NFTs. It helps fund the platform infrastructure costs and extends the business by adding new features.

Farming

Are there any incentives/rewards that users get for holding the NFT? NFTs are unique and rare in their properties. NFT holders might look to earn reward tokens or access to some exclusive rights or accesses. It is worth providing support for earning for NFT holders.

It helps build a sustainable NFT business model and supports various use cases around NFT such as Defi and GameFI.

Auction

Auction is an interesting feature where the owner of NFT can set conditions for selling, such as :
1. Minimum bid price
2. Validity of auction

The auction feature can be implemented and automated via an external smart contract that holds the token amount and address of the highest bidder.
If anyone bids higher than the current bidder then the amount is returned to the previous bidder account and the record of the new successful bidder gets updated in the smart contract.

After the auction ends, NFT is transferred to the final successful bidder account.

DAO(Decentralized Autonomous Organization)

Community plays a key part in building a successful and sustainable business. It does mean that the community has the power to vote and decide on the roadmap for the product and key decisions.
If users perform any kind of transactions, actions related to the marketplace then they can earn some tokens which make them eligible for actions such as voting right.
Users could also be part of a consortium that can put proposals to provide a new growth direction.

Metadata

NFTs are distinguished with their tokenURI and tokenID.
tokenURI returns JSON schema which contains asset URL from IPFS, token description, and other information related to NFT.

It is important, tokenURI should also be served from JSON file stored in IPFS so that it is always available and can’t be updated.
Marketplae parses the tokenURI and renders the NFT information on the webpage.

Indexer

Peer-To-Peer marketplaces like OpenSea are backed by NFT-Indexer.

Any user can deploy ERC-721 and mint NFTs in a public blockchain like Ethereum. Minting can be done via the marketplace or using external script/IDE.

nft-indexer listens to blockchain and the marketplace can use these indexers to query the data about the blockchain state.
It also help to implement search or ordering features for NFTs in the platform.

If the indexer is not present then users can still bring the NFT to be listed in the marketplace but that would be a manual process.

Interoperability

Think of a case where Gmail users can send emails to only other Gmail users or Yahoo mail users can send emails to only other Yahoo users?

If the above scenario would have been the case then the world would have never been able to communicate openly or we might have restricted ourselves from innovation in the community.

The analogy is quite similar in the case of blockchain and tokens.

Interoperability in the blockchain is possible with cross-chain bridges. Bridges enable the transfer of tokens, assets, smart contract instructions, and data between the blockchain.

For the greater reach, success, and impact it’s important that decentralized applications(dApp) or marketplace creators should start to look for interoperability.

Alright, we have covered quite a long list of “things to consider”. But now you must be thinking so how to approach technical implementation?

I want to quote this.

Technically NFT Marketplace is not much different from an E-Commerce Marketplace.

I want to provide a 10,000-foot overview of technical design. I will go into more detailed implementation in another article.

Marketplace Technical Overview

The content of this document is blockchain agnostic, underlying implementation could possibly be the same in all major blockchains.

--

--

Narendra Soni

I am generalist and problem solver. My expertise lies in taking product from 0 to 1. I work hard to improve my knowledge. My DMs are open for collaboration.