NFT Contract

An NFT is a token that represents some digital asset. It can be used to represent in-game items, cryptocurrency, art, and even real estate. You can think of it as a representation of any digital asset you own on the blockchain.

NFTs are ERC-721 tokens. This means that they have been issued via an Ethereum smart contract and are stored within this contract for you to manage. This makes them unique, non-fungible tokens which allows them to be traded on the Ethereum blockchain with ease!

blockchain smart contract
NFT smart contract

NFT extension

To import the extension, we do this:


import * as NFT from ‘./nft.js’


The extension object is created in index.js and looks like this:


const Extension = {

/*** Method of the smart contract ***/


const methods = [NFT_CONTRACT_METHODS];

ERC721 Methods

The onERC721Received function is used to send a message to a smart contract that an event has occurred. This is useful for when you want to notify your smart contract about things like the purchase, transfer, or sale of ownership of an NFT.

This function can be overridden by inheriting from ERC721Metadata and overriding the `onERC721Received` method. For example:




ERC721Received function

The onERC721Received function is called when a new token is received. The function can be used to verify that the sender has the right to transfer the tokens they are sending, or perform any other checks needed to ensure that it’s safe to proceed with the transaction.

The onERC721Transferred function is called when an existing token is transferred between two accounts. It also takes care of updating balances in each account and transferring ETH if necessary, so you don’t have to worry about doing those things manually.

The onERC721Approved function is called when an account approves another account’s request for some amount of NFTs owned by them (e.g., a user approves another user’s request for 2 Pogs). It also updates balances in each account accordingly and transfers ETH if necessary, so again there isn’t much for you code-wise here other than deciding which users should have access and how many tokens are available per user/group at any given time during development mode versus production environment where the real money will be involved!

The onERC721Revoked function works similarly as above but allows revoking someone else’s approval instead rather than requesting yours…and vice versa!

Lastly, there is an option provided by the OpenZeppelin library we used which allows us to create burn events using the burn() method before our contract deploys into production mode where the real money will be involved since this method only works during development mode which makes sense because who wants paying fees just trying out something simple like burning tokens?

NFT Marketplace

Implementing a Marketplace for NFTs

Most of the work to create an NFT marketplace is done by the ERC721 standard. To help you understand how it works, let’s break down all of the major parts:

  • The NFT Contract (ERC721): This is the smart contract that holds your virtual assets. It keeps track of who owns what, and when their owners can be transferred or revoked.
  • The NFT Extension (EIP-721): This extends the ERC20 token standard so that any contracts using it will also support non-fungible tokens! It makes life easier for developers like us because we don’t have to use new programming languages or learn how to implement our own way of handling these assets.
  • Methods on an ERC20 Token Contract: These methods allow you access certain functionalities from within your application code—including transferring ownership between accounts, minting tokens based on certain conditions being met (like after receiving money), and checking if someone else has already claimed ownership over something before assigning them as yours too!

NFT smart contract

Finding NFT smart contract reliable service on the web can be a daunting experience, especially when it requires a full stack developer or maybe a team of developers on hand.

Reach out for further NFT smart contract discussions and projects directly to me.

About Me

A full-stack digital marketing expert with experience consulting and managing NFT projects.  Samer provides A-Z NFT development:

👉 NFT graphics design 2/3D
👉 NFT collection generation (traits, characters, accessories…)
👉 NFT smart contract ERC 721- 1155
👉 NFT website development
👉 NFT marketplace setup (Opensea)

“I enjoy collaborating to create high-converting NFT projects”.

Social Presence

Popular Categories

Rececnt Posts

Is it over for NFTs?

Is it over for NFTs?

NFTs are a new digital asset class that has been introduced by blockchain technology. They have many use cases, but it is not clear if they will be able to replace cryptocurrencies like Bitcoin in the future. NFTs are created using smart contracts and are often used...

Are you safe with Cryptocurrency?

Are you safe with Cryptocurrency?

The future of cryptocurrency. A cryptocurrency is a digital currency that relies on cryptography to generate and secure its transactions. It is a decentralized currency, meaning it doesn’t rely on banks or other institutions to process transactions. Any government...

Web3 and NFTs: How They Have Transformed Digital Ownership

Web3 and NFTs: How They Have Transformed Digital Ownership

Have you ever heard about Web3?  Web3 technology along with Non-Fungible Tokens (NFTs) has changed the lives of many users. It is now possible for you to own digital assets more securely. Many people have started using NFTs. This is because these tokens offer a...

NFTs and Web3: Empowering Creators, Redefining Ownership

NFTs and Web3: Empowering Creators, Redefining Ownership

Content creators have long grappled with protecting their intellectual property and receiving fair compensation for their work. Traditional systems of copyright and distribution often leave creators at the mercy of intermediaries who control access and profit...



Submit a Comment

Share This