NFT artwork not displaying on marketplaces and wallets

Hey everyone! I’m having trouble with my ERC721 contract deployment. I created a smart contract to mint 10 collectible tokens on the Polygon network. The images are hosted on my personal server instead of using IPFS for this test project.

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

import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Strings.sol";

contract DigitalArt is ERC721URIStorage, Ownable {
    uint256 public tokenCounter;
    uint256 public constant TOTAL_SUPPLY = 10;
    string public metadataBaseURI;

    event TokenCreated(address indexed owner, uint256 id, string uri);

    constructor(string memory _name, string memory _symbol) ERC721(_name, _symbol) Ownable(msg.sender) {
        metadataBaseURI = "https://192.168.1.100/metadata/";
    }

    function createToken(address to) external onlyOwner {
        require(to != address(0), "Invalid recipient");
        require(tokenCounter < TOTAL_SUPPLY, "All tokens minted");

        uint256 tokenId = ++tokenCounter;
        _safeMint(to, tokenId);

        string memory uri = string(abi.encodePacked(metadataBaseURI, Strings.toString(tokenId), ".json"));
        _setTokenURI(tokenId, uri);

        emit TokenCreated(to, tokenId, uri);
    }

    function updateBaseURI(string memory newURI) external onlyOwner {
        require(bytes(newURI).length > 0, "URI required");
        metadataBaseURI = newURI;
    }

    function _baseURI() internal view virtual override returns (string memory) {
        return metadataBaseURI;
    }

    receive() external payable {}
    fallback() external payable {}
}

I deployed this through Remix and minted all tokens successfully. However, the artwork doesn’t appear in the MetaMask wallet, Polygonscan explorer, or OpenSea marketplace. Only generic placeholder images show up. What could be causing this visibility issue?

yeah, that’s def a networking issue. 192.168.x.x is local, so those marketplaces can’t access it outside your network. best to host it publicly on something like vercel or dropbox for testing, then they’ll see your art.

Oh interesting, so you’re serving metadata from your home network? That explains it!

Did you check if the tokenURI got set correctly on-chain? Try calling tokenURI(1) on polygonscan - does it return the full URL with your local IP?

Are you getting specific error messages when marketplaces try to fetch the metadata, or just generic placeholders? OpenSea’s developer console usually gives hints about what’s breaking with metadata fetching.

Try a quick test with public file hosting - even throw a test metadata file on Google Drive with public sharing. That’ll confirm if it’s the root cause before you mess with complex hosting solutions.

What’s your actual metadata JSON structure look like? Sometimes it’s not just accessibility - the format might not match what marketplaces expect.

The Problem:

Your ERC721 NFTs are not appearing in MetaMask, Polygonscan, or OpenSea because your metadata is hosted on a local server using the IP address https://192.168.1.100/metadata/. These platforms cannot access this internal network address. Your smart contract code itself appears correct; the issue lies solely in the inaccessibility of your metadata.

:thinking: Understanding the “Why” (The Root Cause):

OpenSea, MetaMask, and Polygonscan need to retrieve metadata (information about your NFTs, including image URLs) to display your artwork correctly. They do this by accessing the tokenURI which your contract generates. Since your tokenURI points to a locally hosted server, these external services cannot connect to it and retrieve the necessary data to render your NFTs. Your contract is minting tokens successfully, but these platforms lack the information needed to display them.

:gear: Step-by-Step Guide:

  1. Make your metadata publicly accessible: The core solution is to host your metadata files on a publicly accessible server. This means any server that’s reachable from the internet, not just your local network. Avoid using local IP addresses like 192.168.1.100.

  2. Update your metadataBaseURI: Once you have uploaded your metadata files to a public server, replace "https://192.168.1.100/metadata/" in your contract’s constructor with the new, public URL. You will need to deploy a new version of your contract with this updated URI. Here’s how your updated constructor would look:

constructor(string memory _name, string memory _symbol) ERC721(_name, _symbol) Ownable(msg.sender) {
    metadataBaseURI = "https://your-public-url.com/metadata/"; // Replace with your actual URL
}

Remember to replace "https://your-public-url.com/metadata/" with the correct base URI of your public server. Ensure that the JSON files within your /metadata folder are correctly formatted and contain all necessary metadata attributes for each NFT (e.g., name, description, image).

  1. Redeploy your contract: After updating your metadataBaseURI, you must redeploy your contract to the Polygon network. This ensures the updated URI is used for newly minted NFTs.

  2. Verify on Polygonscan: Once redeployed, check Polygonscan to confirm that tokenURI(tokenId) returns the correct public URL for your metadata.

  3. Allow time for indexing: OpenSea and other marketplaces often require some time (up to several hours) to re-index your NFTs after deploying the updated contract.

:mag: Common Pitfalls & What to Check Next:

  • Incorrect Metadata Formatting: Double-check that your JSON metadata files are correctly formatted. Even a small error can prevent marketplaces from correctly displaying your NFTs. Ensure the image field points to the correct publicly accessible image URL.

  • Cache Issues: If you’ve already updated your base URI and still see the problem, there might be caching issues. Try clearing your browser cache and, if possible, force the marketplaces to refresh their data.

  • Network Problems: If you are still experiencing issues after completing the steps above, there might be a temporary problem with your chosen hosting provider, or a temporary outage on Polygon.

:speech_balloon: Still running into issues? Share your (sanitized) config files, the exact command you ran, and any other relevant details. The community is here to help!