Creating my own NFTs (How Orignal)

With the metaverse, crypto, and NFTs taking over the world. And Zuck soon to become the digital overlord, I decided to start reading Snow Crash like everyone else and obviously as an icing on the top creating my own meme NFTs on Ropsten Test Network.

The most fascinating thing about this is how stupidly simple and easy it is.

Part 1: Writing a smart contract

If you are not looking for something fancy creating a smart contract is as simple is copying a bunch of lines of code, copy your api key from Alchemy, then compile and deploy!

Screen Shot 2022-01-06 at 5.36.17 PM.png

Contract code:

//Contract based on <https://docs.openzeppelin.com/contracts/3.x/erc721>
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.3;

import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

contract MyNFT is ERC721, Ownable {
    using Counters for Counters.Counter;
    Counters.Counter private _tokenIds;

    constructor() public ERC721("MyNFT", "NFT") {}

    function mintNFT(address recipient, string memory tokenURI)
        public onlyOwner
        returns (uint256)
    {
        _tokenIds.increment();

        uint256 newItemId = _tokenIds.current();
        _mint(recipient, newItemId);
        _setTokenURI(newItemId, tokenURI);

        return newItemId;
    }
}

Deploy script:

async function main() {
   // Grab the contract factory
   const MyNFT = await ethers.getContractFactory("MyNFT");

   // Start deployment, returning a promise that resolves to a contract object
   const myNFT = await MyNFT.deploy(); // Instance of the contract
   console.log("Contract deployed to address:", myNFT.address);
}

main()
  .then(() => process.exit(0))
  .catch(error => {
    console.error(error);
    process.exit(1);
  });

Output:

Contract deployed to address: 0xbcacf042af5af08ac85ee651358ce5f0f873ac28

Proof:

Screen Shot 2022-01-06 at 5.43.31 PM.png