Metadata integration with OpenSea


I have an issue with metadata. I am using Openzeppelin ERC 721 preset, complied and deployed the contract via Remix to Rinkeby and want to see it in testnet on OpenSea.
I established a IPFS folder with metadata files 0.json, 1.json etc.; next, I minted token with tokenURI “ipfs://-CID-/0”; however I cannot see this on a testnet validate check which throws me an error: “TokenUrl404ResponseException: Received 404 response for:”. I am using OpenSea metadata standard.
When I click on the ipfs link, it says: “ipfs resolve -r /ipfs/-CID-/0: no link named “0” under -CID-”

Can you please help me how to resolve this one?



Hi @SolidityDevPrague,

If you have a directory uploaded to IPFS, each file should be 0, 1 etc with no extension.

Your baseURI can be ipfs://[IPFS Hash]/ and then your token URI for token ID 0 is ipfs://[IPFS Hash]/0

See my example:

Hi @abcoathup , thanks for a quick reply!

When I tried that (I removed the “.json” so that only 0, 1, … remains in the name of the files) and I created new contract and minted new token, I received this error: "TokenUrlTimedOutException: " and when opening the IPFS link itself, it does not load.

Any thoughts on what I might be doing wrong welcomed! I minted some tokens, but this is the first time with metadata, so might be an amateur mistake.

Hi @SolidityDevPrague,

Try creating a simple ERC721 (you can use Contracts Wizard and then you can iterate from there with your own metadata.

Set the baseURI to: ipfs://QmUm25XMSnUvxvi7XE9Xr8XwRdkNosmTDyKDDyxMajjytv//
Mint a token and try to view on OpenSea.

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";

contract MyToken is ERC721, AccessControl {
    bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");

    constructor() ERC721("MyToken", "MTK") {
        _setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
        _setupRole(MINTER_ROLE, msg.sender);

    function safeMint(address to, uint256 tokenId) public {
        require(hasRole(MINTER_ROLE, msg.sender));
        _safeMint(to, tokenId);

    function _baseURI() internal pure override returns (string memory) {
        return "ipfs://QmUm25XMSnUvxvi7XE9Xr8XwRdkNosmTDyKDDyxMajjytv/";

    function supportsInterface(bytes4 interfaceId)
        override(ERC721, AccessControl)
        returns (bool)
        return super.supportsInterface(interfaceId);

Thank you @abcoathup !

I still cannot see the metadata there, but at least I got a different error :smiley:

When checking validation, I get: “InvalidTokenUrlResponseException: Invalid JSON response for URL:”.
However, I can open the link and I see the json file.

What do you think I am doing wrong?

Thanks, P.

Can the issue be with the way I constructed the file?
MS Notepad where I put the JSON structure as a pure text, saved it as All files and changes the name to 0.json. Windows got that this is JSON file and labeled it like that. Later, after uploading to IPFS, I changed the name back to 0

Hi @SolidityDevPrague,

You need to remove the extension before uploading to IPFS.

Can you share your JSON in the following format, where it is ipfs://[IPFS Hash of the directory]/[token ID]?
e.g. ipfs://QmUm25XMSnUvxvi7XE9Xr8XwRdkNosmTDyKDDyxMajjytv/0

Using the Brave browser you can open that IPFS link.

Hi @abcoathup , thanks!
It started working after a while. If there would be a rookie looking for the same issue, 2 things helped me to get this working - 1) wait a bit, couple of minutes, it takes time IPFS to be reflected in the opensea; 2) click Refresh metadata on OpenSea and wait a bit again.

So @abcoathup your advice was good, just me doing it for the first time was doing it wrong.

1 Like

Hi @SolidityDevPrague,

Glad to help. Good luck with your project.