How to create NFT using solidity blockchain

How to create a Non-Fungible Token ( NFT ) using Solidity Blockchain


Non Fungible Tokens ( NFTs ) 


A Non-Fungible Token is a one-of-a-kind token that has no counterpart. This is in sharp contrast to ERC20s, which are fungible. Fungible is a word that implies "replaceable" or "interchangeable". NFTs are a new enterprise made possible by the introduction of blockchain and smart contracts, and people are creating incredible things with them. They are all easily distinguished from one another and cannot be used interchangeably. Consider Non-Fungible Tokens (NFTs) to be rare collectables; each has distinct qualities, distinctive attributes, and, in most cases, metadata.


Since the release of Cryptokitties, digital collectables compatible with the ERC-721 standard have grown in popularity and have moved closer to general adoption in recent months. This article will walk you through the process of constructing and deploying our own ERC-721 (NFT) smart contract using the 0xcert/Ethereum-erc721 smart contract library.


Crypto Wallet


A crypto wallet is a digital wallet that helps its users to send, receive and manage their cryptocurrencies such as Bitcoin, Solana, Ether, and others.

One will need to connect its own wallet to the website when developing a website that allows users to interact with Non-Fungible Token ( NFTs ) .


About ERC-721 


The ERC stands for Ethereum Request for Comment. In the Ethereum ecosystem, ERCs are application-level standards that can be used as a smart contract standard for tokens. ERC–721 was created to add the functionality to track and transfer the ownership of NFT within smart contracts. It is an open standard that demonstrates how to build NFTs on EVM (Ethereum Virtual Machine)  and the set of rules it possesses makes it easy to build NFTs and NFTs are not only of ERC-721 type.


Prerequisites to create Non-Fungible Token ( NFT ) 


One can create a Non-Fungible Token ( NFT )  without requiring any development experience, but here we’re going to show you how to create your own Non-Fungible Token ( NFT )  using the Solidity blockchain. But first, we need to cover the following things before jumping into the process of creating your own Non-Fungible Token ( NFT ):


  • Writing some smart contracts in Solidity.
  • Deploy the contract into your chosen network.
  • Create a Non-Fungible Token ( NFT ) asset.
  • Create the metadata file for your Non-Fungible Token ( NFT ).
  • Mint the metadata file using your own contract.


Creating your own Non-Fungible Token  ( NFT ) contract


A Non-Fungible Token ( NFT ) contract also known as (the ERC-721 Contract) eases us to create/mint & purchase/transfer ownerships of these Non-Fungible Token ( NFTs ) or digital arts.

In Ethereum you can simply create your Non-Fungible Token ( NFT ) using ‘Remix’ it is an open-source web-based application 

Here, is the complete solidity blockchain code for Non-Fungible Token ( NFTs).



“”” pragma solidity >=0.6.0 <0.8.0;

import "@openzeppelin/contracts/token/ERC721/ERC721.sol";

import "@openzeppelin/contracts/access/Ownable.sol";

 contract NFT is ERC721, Ownable {

    address payable public _owner;

    mapping(uint256 => bool) public sold;

    mapping(uint256 => uint256) public price;

    event Purchase(address owner, uint256 price, uint256 id, string uri);

    constructor() ERC721("YOUR TOKEN", "TOKEN") {

     _owner = msg.sender;


function mint(string memory _tokenURI, uint256 _price)



 returns (bool)


    uint256 _tokenId = totalSupply() + 1;

    price[_tokenId] = _price;

    _mint(address(this), _tokenId);

    _setTokenURI(_tokenId, _tokenURI);

    return true;


function buy(uint256 _id) external payable {



    emit Purchase(msg.sender, price[_id], _id, tokenURI(_id));


 function _validate(uint256 _id) internal {

    require(_exists(_id), "Error, wrong Token id");

    require(!sold[_id], "Error, Token is sold");

    require(msg.value >= price[_id], "Error, Token costs more"); 


  function _trade(uint256 _id) internal {

    _transfer(address(this), msg.sender, _id);


    sold[_id] = true;


} “””


Here in this code, the main thing to take note of is the two strings passed into the constructor the first “YOUR TOKEN” would be the parent name for all of your tokens created with the contract, the second argument “TOKEN” is the shortcode that will be used for your Tokens.


Deploying the Non-Fungible Token ( NFT )


After you've written your contract, you'll need to deploy it to put it through its paces. One important aspect of the blockchain is that all contracts are immutable, which means that a flaw will always exist in your contract; you cannot edit a contract after it has been deployed. Here we have test environments available to us, There are multiple test nets available but The ability to reset contracts and overwrite mistakes is a huge advantage of test nets. That is, you can test your contracts until they are satisfactory before deploying them to the main net.

To get your contacts on the test net you will want to use (Truffle), Truffle is an excellent tool that allows you to easily deploy.


You can also interact with your Non-Fungible Token ( NFT ) and can discuss how to upload your assets for minting.


  • Admin
  • April 20, 2022

Add a comment


KYVoAyzX at May 20, 2022
HAGzSfiS at May 20, 2022
huAQksux at May 20, 2022
pKVzicQC at May 20, 2022
oBPaLmoS at May 20, 2022
qgkoeIQx at May 20, 2022
iKCJLfUi at May 20, 2022
UzyQwJKH at May 20, 2022
TCaGonzC at May 20, 2022
pxvbejGu at May 20, 2022
wergIUVv at May 20, 2022
vXWlQLZc at May 20, 2022


To properly understand the things that are prevalent in the industries, keeping up-to-date with the news is crucial. Take a look at some of our expertly created blogs, based on full-scale research and statistics on current market conditions.

May 24, 2022
May 24, 2022

How Pubs and Partying will look in Metaverse

In the pubs and parties, metaverse will allow people to have their own unique Avatars which would r…

May 22, 2022
May 22, 2022

How to create play to earn Games using Blockchain?

Blockchain is a system in which the record of transactions in various cryptocurrencies like Bitcoin…

May 2, 2022
May 2, 2022

What is DeFi, Use Cases of DeFi, Companies working on DeFi, Advantages of DeFi

Decentralized finance (DeFi) is a new financial system that is built on secure distributed ledgers

Let's get in touch

Give us a call or drop by anytime, we endeavour to answer all enquiries within 24 hours on business days.

Let's Convert Your Idea into Reality