Unidentified ERC1155 contract in Opensea

Hi Everyone,

I am having trouble setting the metadata for nfts minted on a erc1155 smart contract.

I can successfully deploy and mint from the erc1155 contract but I am having trouble with setting the metadata and viewing it in opensea.

I am building an app where users can deploy a smart contract, and mint some nfts from it.

The process I have set up is as follows,

  1. deploy an ownable erc1155 smart contract. (code example below)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;

import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

contract MetaRoomsRoomPass is ERC1155, Ownable {
    constructor() ERC1155("") {}

    function setURI(string memory newuri) public onlyOwner {

    function mint(address account, uint256 id, uint256 amount, bytes memory data)
        _mint(account, id, amount, data);

    function mintBatch(address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data)
        _mintBatch(to, ids, amounts, data);
  1. trigger setURI function with the string being a IPFS hash of a json (example below)

  2. trigger mint function

The 3 transactions go through fine but when I try to view the token in opensea it just shows an 'unidentified contract' and has no metadata to show.

I'm not sure if my setURI txn is setting the URI on the contract, not on the tokens minted from it.

Do I need to add a setTokenURI function to the smart contract and call that function instead?

Thank you, I hope this makes sense. I can clarify any missing information!

I think OpenSea expects contract-level metadata in a function called contractURI. You may need to add this.

I'm not sure the URI that you shared looks right:


You may need to write {id} in lowercase, and you may be missing a slash: ...fSSD/{id}.

If I understand it correctly, you're asking how the set the metadata for the tokens, not the OS contract-level metadata.

If you're just trying to set the metadata so that attributes are displayed for each nft in the collection, I would suggest this...

// I am adding your ipfs address in the constructor, changing id to lowercase, and appending .json.
constructor() ERC1155("ipfs://QmdvBsbshwWamd7ok8yn4nggfwDdUExgN8jJNvdhE2fSSD{id}.json") {}

I am making some assumptions here...
I am assuming that you have a directory in IPFS and that directory contains N number of json files. The IPFS CID (QmdvBsbshwWamd7ok8yn4nggfwDdUExgN8jJNvdhE2fSSD) is the CID for the directory. Within that directory there would be a series of json files.

Also your setURI function is fine.
If you want to have a "reveal" then you could initially deploy the contract and pass the CID to the locked metadata in through the constructor. Once you're ready to reveal, you can call setURI with the new "revealed" CID.

1 Like