1. Introduction

I know you can create an NFT collection like this: https://testnets.opensea.io/collection/runner-nfts.

It’s very easy to do this from an OpenSea user’s perspective! 😉

But,

  • Can you create this collection in a programmable way?

  • Why you should do this?

If you are in the sportive area, please contact me and I will discuss with you the business values for such thing.

The purpose of this tutorial is give to Blockchain developers some initial steps to start coding NFTs.

2. The manual (but fastest) way to create programmable NFTs

2.1. Tools used in the following steps

2.2. Steps

→ Install Metamask

  1. Instal [metamask] on your [google-chrome].

→ Get some Rinkeby ethers

  1. Use the [rinkeby-faucet] the get some fake ethers on the Rinkeby network.

→ Create the contract

  1. Access the [openzeppelin-wizard] URL and create the contract.

    1. Click the button ERC721.

    2. Name the NFT as RunnerNFTs and use the symbol RUNF (Run Forrest! Run!) ;)

    3. Check the following features:

      1. Mintable (and Auto Increment Ids)

      2. URI Storage

  2. Click the button Open in Remix.

→ Publish your image on NFT Storage and get its URL

  1. Access the [nft-storage] URL and publish the image of your NFT.

  2. Copy the generated URL to the image in order to use it in the next step.

→ Create the JSON metadata

  1. Copy and paste this JSON to [jsonkeeper]:

    {
      "name": "Ironman Brazil 2017",
      "description": "Ironman Brazil 2017 medal",
      "image": "https://bafybeibgx437bg5mrvyaqkvst5ffa3uxk7yan4bao22ynev6lajq6zgdwq.ipfs.nftstorage.link/"
    }
  2. Change the image URL according to the published URL in NFT Storage.

  3. Hit the Save button and copy the generated JSON URL (i.e.: https://jsonkeeper.com/b/KN5D)

→ Compile and test the contract locally

  1. Inside [remix-ide], change the COMPILER version to the corresponding generated code.

  2. Click Ctrl+S to compile the contract.

  3. Click Deploy & run transactions on the left pane.

    1. Select the CONTRACT: RunnerNFTs.

    2. Click the button Deploy.

  4. Select the contract on Deployed Contracts.

    1. Click the safeMint button.

      1. Copy the address in the ACCOUNT and paste it into the value for the to: field.

      2. Copy the JSON URL published in the previous step into the value for the uri: field.

    2. Click the tokenURI button.

      1. Enter the value 0 for the field tokenId: and click call.

      2. Check if the returned value is the JSON URL informed above.

→ Deploy the contract to the Rinkeby network

  1. Change the ENVIRONMENT to Injected Web3.

  2. Check if the selected CONTRACT is RunnerNFTs.

  3. Click Deploy and notice that Metamask will open.

  4. Confirm the transaction and wait for it to be confirmed.

    1. Click view on etherscan on then Remix console to check the deployed contract on the Rinkeby.

→ Mint the NFT

  1. Call the the saveMint function passing your account on Metamask and the JSON URL returned on the previous step.

→ Check your NFT on OpenSea

  1. Repeat the actions safeMint and tokenURI to check if the things are ok on the Rinkeby network.

  2. Copy the NFT contract address on Remix and search for it on [opensea-testnets].

→ Add another NFT to you collection

  1. Repeat the action safeMint using another JSON URL.

  2. Call the tokenURI function incrementing it by 1 and check the JSON URL.

3. Using Hardhat to create NFTs in a programmable way