Tokens

ERC721 Part 2: Your NFT on OpenSea

written by
Chris Cao
Date Last Updated
September 19, 2022
Download Project Files

In the tutorial, I am going to show you how to interact with your contract and see your very own nft on OpenSea!

NFT to OpenSea

The hardest part is over. You have made the contract and understand the EIP-721. You are ready to deploy it on a testnet and see it for real on OpenSea. There are many different ways to reach this end goal, and I will show you a simple way to do it with a couple of tools outside ApeWorX. The Web3 ecosystem is incredible, so let me show off some cool tools to bring it all together.

9 Steps to the finish line:

  1. Create a metadata file and an Image for your NFT
  2. Host the two files on an NFT media manager site (optional)
  3. Save the new ipfs CID to your contract.
  4. Compile new content in the contract
  5. Open Ape Console with the testnet and provider
  6. Mint NFT
  7. Verify on OpenSea
  8. ???
  9. Profit

1. Creating a JSON meta data file:

NFTs are digital signatures that represent ownership of something tangible. The most common use case is proof of ownership of a picture and the details behind it. The details can be represented in a metadata file: The metadata file standard is defined by this standard EIP-1155


{
  "name": "ApeNFT #0",
  "description": "This is a place holder for Ape NFT.",
  "external_url": "https://www.apeworx.io/",
  "attributes": [
    {
      "trait_type": "animal",
      "value": "ape"
    },
    {
      "trait_type": "background color",
      "value": "pink"
    },
    {
      "trait_type": "accent color",
      "value": "yellow"
    },
  ],
  "image": "ipfs://QmSdR1bZJNuRuPAqtbqf4JLbSGktshvj4waDjZ6SwFYRoi"
}

2: Host the two files on an NFT media manager site (optional)

One of the tools I recommend is Pinata. It is a Media Manager company for content creators and developers to integrate with IPFS (InterPlanetary File System)

IPFS is a protocol, hypermedia, and file-sharing peer-to-peer (p2p) for storing and sharing data in a distributed file system. We will use Pinata to manage a metadata file and its image to pin it on an ipfs node for all to use and see.

3. Save the new IPFS CID to your contract

CID means Content Identifier. When you host a file on ipfs, it hashes the content address so you can use it discreetly. This is a sample of a CID


ipfs://QmR9BQNHmru4JY1tKKakZCHHZ2kARLKMiRh5J327Hgb6Jt

It views the image hosted on ipfs, and you can use this format for Piñata.


https://gateway.pinata.cloud/ipfs/QmR9BQNHmru4JY1tKKakZCHHZ2kARLKMiRh5J327Hgb6Jt

4. Compile the contract

With the new CID, make sure you find and replace all the CID references. You can test to ensure you got them all by running ape test.

5. Open Ape Console with testnet and provider


$ ape console --network ethereum:rinkeby:alchemy

This is the home stretch. Deploy the contract on a testnet; if you want it on OpenSea, you can deploy it on Rinkeby and Polygon as well.

6. Mint the NFT


In [1]: contract.mint("reciever_address", sender=dev)

7. Verify on a marketplace(OpenSea)

Now that the contract has deployed and you have minted an NFT. Make sure you check it out and see your hard work! You can check your work on the testnet linked to OpenSea and another testnet with Rariable.

8. ???

You have done it! You can do whatever you want to the contract is on the blockchain forever!

9. Profit

Let me know what you decide to do with it!

Here are some recommendations on what to do next:

  • Host a front-end so your friends can mint an NFT. (I would love to have one!)
  • Tell me what was easy to understand and hard to grasp. (I want to improve it)
  • Join a hackathon and show this off! (Join a team and make something cool with what you learned)
  • Say hello in our discord! We have an #NFT channel, S H O W I T O F F

If you like what we are about, you can donate if you like: ApeWorX's banana fund.