I minted an NFT on the Rinkeby network and it worked fine. But when I check Opensea testnet the image and details aren’t showing up. I tried to validate it and got Valid: "false".
Here’s what my smart contract looks like:
pragma solidity ^0.8.2;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
contract CoolMonkey is ERC721URIStorage, Ownable {
using Counters for Counters.Counter;
Counters.Counter private _tokenIds;
uint256 public price = 0.02 ether;
uint256 public maxSupply = 5000;
uint256 public maxPerWallet = 5;
string public baseURI;
bool public isSaleActive = false;
constructor(string memory _name, string memory _symbol, string memory _initBaseURI) ERC721(_name, _symbol) {
baseURI = _initBaseURI;
}
function mint() public payable {
require(isSaleActive, "Sale is not active");
require(msg.value >= price, "Not enough ETH sent");
require(balanceOf(msg.sender) < maxPerWallet, "Max per wallet reached");
uint256 newTokenId = _tokenIds.current();
_safeMint(msg.sender, newTokenId);
_tokenIds.increment();
}
function _baseURI() internal view override returns (string memory) {
return baseURI;
}
function toggleSale() public onlyOwner {
isSaleActive = !isSaleActive;
}
}
I used IPFS for storing metadata. Any ideas why it’s not showing up on Opensea?
hey there! i’m curious about something - have you tried pinning your metadata on ipfs? sometimes that can help with visibility issues. also, i noticed you’re using ERC721URIStorage but not actually setting the token URI in your mint function. maybe try adding something like _setTokenURI(newTokenId, tokenURI); after minting?
oh, and another thing - how long ago did you mint? sometimes opensea takes a while to catch up, especially on testnets. i’ve had nfts take hours to show up before
have you tried viewing the nft on other marketplaces? might be worth checking to see if it’s an opensea-specific issue. let us know what you find out!
hey mate, might be an issue with ur metadata. make sure the IPFS link is correct and the format matches opensea’s requirements. also, opensea can be slow to update sometimes. try refreshing metadata on opensea or wait a bit. if that doesnt work, double-check ur contract’s tokenURI function.
From my experience, the issue likely stems from your implementation of the tokenURI function. In your contract, you’re using ERC721URIStorage but not setting the token URI after minting. You should add a call to _setTokenURI in your mint function.
Also, ensure your baseURI ends with a trailing slash. If it doesn’t, your metadata URLs won’t be constructed correctly. Lastly, verify that your metadata JSON files on IPFS are formatted according to OpenSea’s standards, including the ‘image’ field with a valid IPFS or HTTP URL.
If these steps don’t resolve the issue, you might need to wait a bit longer. OpenSea’s indexer can sometimes take a while to pick up new NFTs, especially on testnets.