LogoLogo
  • Gather Fundamentals
    • INTRODUCTION TO GATHER
    • GTH
    • TOKEN STANDARDS
      • CREATE YOUR FIRST GRC-20 TOKEN
      • CREATE YOUR FIRST GRC-721 TOKEN
    • NETWORKS
    • CONSENSUS
      • PROOF-OF-WORK (POW) & GTHASH
    • BLOCK EXPLORER
    • BRIDGE
    • MULTI-SEND
  • GATHER DEVELOPEMENT STACK
    • WALLET SETUPS
      • GATHER WEB WALLET
      • METAMASK MAINNET CONFIGURATION
      • METAMASK TESTNET CONFIGURATION
    • SMART CONTRACTS & DAPPs
      • DEPLOYING YOUR FIRST SMART CONTRACT
      • HARDHAT CONFIGURATION AND DEPLOYMENT
      • TRUFFLE CONFIGURATION AND DEPLOYMENT
      • BUILDING AN ESCROW SMART CONTRACT
      • BUILDING AN E-COMMERCE SHOPPING SMART CONTRACT
      • DEPLOYING NFT MARKETPLACE DAPP
      • DEPLOYING DE-FI BANK DAPP
      • DEPLOYING DECENTRALIZED TWITTER
    • TESTNET FAUCET
    • COVALENT
    • THIRDWEB
    • VERIFY SMART CONTRACTS
      • VERIFY CONTRACTS ON SOURCIFY VIA REMIX IDE
      • VERIFY CONTRACTS USING HARDHAT
Powered by GitBook
On this page
  • Prerequisites
  • STEPS
  • VIDEO
  1. Gather Fundamentals
  2. TOKEN STANDARDS

CREATE YOUR FIRST GRC-721 TOKEN

PreviousCREATE YOUR FIRST GRC-20 TOKENNextNETWORKS

Last updated 3 years ago

A GRC-721 token on Gather Network is similar to an ERC-721 token on Ethereum.

This is a guide for creating your first GRC-721 (NFT) contract on Solidity with Open Zeppelin on Gather Testnet.

You can use the same guide to create a GRC-721 (NFT) contract on Gather Mainnet with mainnet configurations.

Prerequisites

  1. MetaMask or any web3 wallet configured with Gather testnet.

  2. Testnet GTHs.

For this guide, we will be using remix as IDE and MetaMask as our wallet.

STEPS

  1. Open Remix online compiler.

  2. In contracts create a new file token.sol and add the following code there.

    You can get the code from here as well -

    // SPDX-License-Identifier:MIT
    pragma solidity ^0.8.0;
    import "https://github.com/OpenZeppelin/openzeppelin-contracts/contracts/access/Ownable.sol";
    import "https://github.com/OpenZeppelin/openzeppelin-contracts/contracts/token/ERC721/ERC721.sol";
    
    contract DemoNFT is Ownable, ERC721("Demo", "DNFT") {
        uint tokenId;
        mapping(address=>tokenMetaData[]) public ownershipRecord;
        struct tokenMetaData{
        uint tokenId;
        uint timeStamp;
        }
    
        function mintToken(address recipient) onlyOwner public {
            require(owner()!=recipient, "Recipient cannot be the owner of the contract");
            _safeMint(msg.sender, tokenId);
            ownershipRecord[recipient].push(tokenMetaData(tokenId, block.timestamp));
            tokenId = tokenId + 1;
        }
    }

  3. Compile token.sol

  4. Switch to Gather Testnet Network in your MetaMask.

  5. In environments of Remix, select injected web3 and connect an account with enough testnet GTHs.

  6. Deploy your contract.

  7. This will open your MetaMask extension and ask you to confirm the pending transaction. Click the Confirm button on the MetaMask popup.

  8. You have successfully created and deployed a GRC-721 token contract on the Gather test network.

  9. You can now mint a GRC-721 token for any address on Gather testnet.

VIDEO

https://remix.ethereum.org/
https://github.com/GatherNetwork/GRC-721-Token.git