Creating Your Own NFT from Scratch and Listing It on OpenSea

·

Introduction

NFTs (Non-Fungible Tokens) have surged in popularity, from CryptoKitties clogging the Ethereum network to Twitter's founder selling his first tweet as an NFT for nearly $3 million.

This guide walks you through creating your own NFT collection using:

What Is an NFT?

An NFT is a unique digital asset verified via blockchain, ideal for:

The ERC-721 Standard

Proposed in 2018, ERC-721 is a Non-Fungible Token Standard enabling:


Tools & Development Assets

Prerequisites

Key Tools Explained


Metadata Setup

Off-Chain vs. On-Chain Storage

ERC-721 JSON Schema Example

{
  "description": "Galaxy photo collection",
  "image": "ipfs://QmZ6iJbUpEfKxUodwx4DgaF9zquvRjJEMXAkH8EJtWPLKm",
  "name": "Starry Night #1",
  "attributes": [
    {"trait_type": "Author", "value": "Jane Doe"},
    {"trait_type": "Resolution", "value": "6016x3385px"}
  ]
}

👉 Learn more about OpenSea metadata standards


Upload Metadata to IPFS via Pinata

  1. Upload Images: Add files to Pinata’s dashboard.
  2. Copy IPFS URL: Use this in your metadata files.
  3. Upload Metadata Folder: Pin the entire folder to IPFS.

Example IPFS folder URL:
https://gateway.pinata.cloud/ipfs/QmcdnHCTuPoazQG8ft3tsRQ6RZTob6EDgAR5Mo3LV2Weif/


Environment Setup

  1. Initialize Project:

    mkdir my-nft && cd my-nft  
    npm init -y  
    npm install @openzeppelin/contracts truffle  
    npx truffle init  
  2. Configure Truffle:
    Edit truffle-config.js for Rinkeby:

    const HDWalletProvider = require('@truffle/hdwallet-provider');
    const secrets = require('./secrets.json');
    
    module.exports = {
      networks: {
        rinkeby: {
          provider: () => new HDWalletProvider(
            secrets.mnemonic,
            `https://rinkeby.infura.io/v3/${secrets.projectId}`
          ),
          network_id: 4
        }
      }
    };
  3. Fund Testnet Account: Use Rinkeby Faucet.

Smart Contract Deployment

  1. Deploy Script:
    Create migrations/2_deploy_token.js:

    const ERC721PresetMinterPauserAutoId = artifacts.require('ERC721PresetMinterPauserAutoId');
    
    module.exports = function(deployer) {
      deployer.deploy(
        ERC721PresetMinterPauserAutoId,
        "My NFT Collection",
        "MNC",
        "ipfs://QmcdnHCTuPoazQG8ft3tsRQ6RZTob6EDgAR5Mo3LV2Weif/"
      );
    };
  2. Deploy to Rinkeby:

    npx truffle migrate --network rinkeby
  3. Mint an NFT:

    await mynft.mint("0xYourMetaMaskAddress");

Listing on OpenSea

  1. Find Contract Address:

    truffle(rinkeby)> mynft.address
  2. Import to OpenSea:

    • Go to OpenSea.
    • Click "My Collections" → "Import Contract".
    • Paste your contract address.

Example listing URL:
https://testnets.opensea.io/assets/0xYourContractAddress/0

👉 Explore advanced NFT use cases


FAQs

How much does it cost to mint an NFT?

Costs vary based on Ethereum gas fees. Testnet deployments are free, but mainnet minting can range from $50–$200+.

Can I update NFT metadata after minting?

No, metadata is immutable once deployed to IPFS. Plan carefully!

How do I make my NFT dynamic?

Use oracles (e.g., Chainlink) to fetch real-time data or upgradeable contracts.

Why isn’t my NFT showing on OpenSea?

It may take 12–24 hours for OpenSea to index new contracts. Verify transactions on Etherscan.


Next Steps

Conclusion

You’ve now:

  1. Created an ERC-721 NFT with OpenZeppelin.
  2. Stored metadata on IPFS via Pinata.
  3. Listed your NFT on OpenSea.

For further learning, check out Your Immutable Future podcast.

🚀 Ready to launch your NFT project? Start here!