1

The minted NFT item and detail not displayed on test net Opensea while rinkeby network working properly . pls kindly advise where gone wrong

https://testnets.opensea.io/collection/squirrel-eqf09pjm5s

https://mumbai.polygonscan.com/address/0xEE21cF8F15e487968706C5bbD15837c50D1aB2a1

contract.sol

constructor() ERC721("Squirrel", "SRL") {
    
    _baseTokenURI = "QmSrH7nkakj9T7FUKSD48ENcJusvnaTdmdJV9AXhLPHNst/";  //metadata url

the ipfs metadata and images file working fine.

json = ipfs/QmSrH7nkakj9T7FUKSD48ENcJusvnaTdmdJV9AXhLPHNst/0

{"name": "Squirrel #0", "description": "Squirrel NFT . limited edition 1,000!", "image": "ipfs://QmczVxRT66QqC7HeYh6ZnT8QLd2qoAiqW8DfhX4ghG7bVw/0.png", "attributes": [{"trait_type": "Background", "value": "blue"}, {"trait_type": "Body", "value": "maroon"}, {"trait_type": "Eyes", "value": "standard"}, {"trait_type": "Clothes", "value": "blue_dot"}, {"trait_type": "Held Item", "value": "nut"}]}

images :

ipfs.io/ipfs/QmczVxRT66QqC7HeYh6ZnT8QLd2qoAiqW8DfhX4ghG7bVw/0.png

1 Answer 1

1

Let us first understand how Opensea reads your contract to retrieve the meta-data –

From Opensea's documentation

To find this URI, we use the tokenURI method in ERC721 and the uri method in ERC1155. First, let's look closely at the tokenURI method in the Creature contract.

Further:

The tokenURI function in your ERC721 or the uri function in your ERC1155 contract should return an HTTP or IPFS URL, such as https://opensea-creatures-api.herokuapp.com/api/creature/3. When queried, this URL should in turn return a JSON blob of data with the metadata for your token. You can see an example of a simple Python server for serving metadata in the OpenSea creatures repo here.

Further for IPFS specific

If you use IPFS to host your metadata, your URL should be in the format ipfs://. For example, ipfs://QmTy8w65yBXgyfG2ZBg5TrfB2hPjrDQH3RCQFJGkARStJb

Now let us see what your contract returns the tokenURI for a minted token (in this case, tokenID: 0)

enter image description here

As you can see, your contract is returning QmSrH7nkakj9T7FUKSD48ENcJusvnaTdmdJV9AXhLPHNst/0 which is incomplete since it does not contain a base (ipfs://) to resolve from.

Your tokenURI method should return the complete resolvable IPFS URI to your JSON file: ipfs://QmczVxRT66QqC7HeYh6ZnT8QLd2qoAiqW8DfhX4ghG7bVw/0

Additionally, you should make sure your JSON file is query-ready by manually visiting the IPFS URL through any IPFS enabled browser.

Here's an example of doodle contract returning URI:

Doodle's contract returning tokenURI for tokenID 0

4
  • alright Tanishq thanks for your detail explanation
    – brook18
    Mar 13, 2022 at 18:48
  • hi i having another issue below thread regarding address array invalid in polygon network as well. can pls assist to take a look? ethereum.stackexchange.com/questions/123714/…
    – brook18
    Mar 13, 2022 at 18:49
  • Hi, my tokenURI returns ipfs://QmUNekrvZj4MWezLX9wnBtpLC4M3E1Ea6SJgyMN739gYGv/1.json. Do I need to remove the .json? I can't get the nft to show on opensea as well.
    – yong ho
    Apr 13, 2022 at 7:53
  • @yongho You don't need to, but you do need to check if the link itself works. I just uploaded an NFT with .json, and it works as normal. Your link doesn't seem working btw. Sep 1, 2022 at 4:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.