Link Search Menu Expand Document

Create & deploy an ERC-721 (NFT) project

Table of contents

I followed QuickNode Youtube Tutorial and learnt how to create and deploy NFT on the Blockchain testnet. It was super fun and here I wrote down the steps for my learning repository.

ERC721 definition - TLDR

  • ERC721: a standard for representing ownership of non-fungible tokens.
  • EIP: Ethereum Improvement Proposals
  • NFT: Non Fungible Token Standard

Prerequisite

  • A crypto wallet - metamask
  • Some ETH in the wallet to pay for the Gas fee. Get free Goerli ETH: https://faucet.quicknode.com/drip

Create NFT contract on Remix

// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;

import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

contract QuickNodeNFT is ERC721URIStorage, Ownable {
    constructor() ERC721("myArtworks", "MCN") {}
    //myArtworks - is the name 
    //MCN - is the symbol

    function mint(
        address _to,
        uint256 _tokenId,
        string calldata _uri
    ) external onlyOwner {
        _mint(_to, _tokenId);
        _setTokenURI(_tokenId, _uri);
    }
}
  • Click on compile with complier 0.8.17 as defined in the .sol.
  • Once compiled, you can click from the console for view on etherscan, it opens new tab where you will see Contract Creation success.

Generate images for the blockchain NFT

  • Using AI to generate artworks: https://stablediffusionweb.com/

About IPFS

  • Ideally you can put all images directly to blockchain but it’s slow and costly. Here I use NFT storage for IPFS: https://nft.storage
  • IPFS: https://ipfs.tech/, a peer-to-peer file storing and sharing distributed system

Upload images to nft.storage

  • Login to nft.storage
  • Click File > Upload
  • Once image is uploaded, click Action > Copy IPFS URL for the image metadata
  • Create .json file for the image, the above generated IPFS URL is used in the json file. Example:
    {
        "name": "Shark Art 1", 
        "description": "Just a shark generated by AI with Picasso style", 
        "image": "ipfs://bafkreifrsu7ph4h3ha2cprheuwdzb6ek3p4jlzdt2hyaewseynhn7m5rwa"
    }
  • Upload the json file
  • Then, click Action > Copy IPFS URL for minting an NFT on Remix

Mint NFT

“Minting” an NFT is the process of writing a digital item to the blockchain.

  • Copied IPFS URL of the json file
  • Go back to Remix > Mint, fill in below data
_to: my account address 
_tokenId: 1 (any number)
_unit: IPFS URL of the json file 

Remix Minting

  • Click transact
  • Confirm on metamask wallet

Metamask Wallet Confirm

  • Then click from the console: view on etherscan
  • Copy the contract address

Etherscan

  • Search contract address on https://testnets.opensea.io

    opensea is the marketplace to trade with Ethereum for digital items: event tickets, artwork, music etc

Example after my uploads: 
https://testnets.opensea.io/assets?search[query]=0x42c0d7077719e601c49f127dfc31e926df5e1fb6

My collection is here:
https://testnets.opensea.io/collection/quicknode-sharks-v3