ERC721 Metadata not showing up on OpenSea (Rinkeby Test Net)

I made NFT's, following a tutorial. I created 5 jpeg images in MS Paint, and 5 corresponding JSON files to match for the metadata. I uploaded the 5 images to pinata and then took that CID and put it in the metadata for the JSON files. I then uploaded the JSON files, and took that CID and put it in my smart contract. An example of my JSON file is here: Metadata uploaded to Pinata

I deployed the smart contract via Remix to my Metamask on the Rinkeby Testnet. OpenSea detected the assets in my wallet after they were minted, but the pictures and metadata in the json files was not there. Here is my smart contract:

// SPDX-License-Identifier: MIT

pragma solidity ^ 0.8.10;

//import Open Zepplin contracts

import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC721/ERC721.sol";

import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Strings.sol";

contract NFT is ERC721 {

    uint256 private _tokenIds;

   

    constructor() ERC721("EGM NFT", "DEC25_01") {}

   

//use the mint function to create an NFT

    function mint() public returns (uint256) {

        _tokenIds += 1;

        _safeMint(msg.sender, _tokenIds);

        return _tokenIds;

    }

   

//in the function below include the CID of the JSON folder on IPFS

    function tokenURI(uint256 _tokenId) override public pure returns(string memory) {

        return string(

            abi.encodePacked(

                "ipfs://QmSiTHvaSRpg41RMCPQudyExVHG8bMQqmdZu6J4HJkDaxq/",

                Strings.toString(_tokenId),

                ".json"

            )

        );

    }

}

Can anybody please tell me why image and description won't show on OpenSea test net? PLEASE help, I am busting my butt trying to learn this.

I tried to deploy your code on remix and mint one tokenId.

It produce a tokenURI (Id #1):
ipfs://QmSiTHvaSRpg41RMCPQudyExVHG8bMQqmdZu6J4HJkDaxq/1.json

But your CID on the pinata is:
https://gateway.pinata.cloud/ipfs/QmSiTHvaSRpg41RMCPQudyExVHG8bMQqmdZu6J4HJkDaxq/nft1.json

Seems like you need to rename nft1.json --> 1.json

Extras:

  1. Make your contract is Ownable -> see: OS doc for "Structuring your Smart Contract"
  2. Optional: Using ERC721Enumerable extension: " This implements an optional extension of [ ERC721 defined in the EIP that adds enumerability of all the token ids in the contract as well as all token ids owned by each account."

Hope it helps.

1 Like

Thank you so much dude. Got it figured out!!!

e_n, What did you do to fix this? My NFT placeholder is showing up but not the image.

Im having the exact same issue, did you ever get it figured out?

First off, delete this thread and start a new one without the IPFS location displayed to the public. Anyone can access your NFT data and potentially modify the contract through remix with the name, symbol, and IPFS location.name and symbol are available on etherscan and the IPFS location is on here for some reason.

Second, You need to input the pinned IPFS location parent Directory followed by a β€œ/β€œ in the contract and without the forward slash when interacting with it in remix.

Lastly, the IPFS metadata address for each NFT image will be the metadata parent directory followed by a /#.json. The image will be parent director followed by /#.Img or .png or .jpg... Unless you named all your nfts individually as 1nft, 2nft, 3nft... so on. But I can almost guarantee this isn’t the situation because computer generated collections automatically name them with just a number and the extension.

Good luck.