NFT Not Appearing in OpenSea Collection After Transfer

I’m currently creating NFTs using an ERC721 smart contract and encountered a frustrating issue with OpenSea. My contract is based on OpenZeppelin and it works fine for both minting and transferring NFTs.

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

import "@openzeppelin/contracts@4.6.0/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts@4.6.0/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts@4.6.0/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts@4.6.0/utils/Counters.sol";

contract PIXELS is ERC721, ERC721Enumerable, ERC721URIStorage {
    using Counters for Counters.Counter;
    
    Counters.Counter private _idTracker;
    uint256 TOTAL_LIMIT = 3000;
    
    constructor() ERC721("PIXELS", "PXL") {}
    
    function createToken(address recipient, string memory tokenUri) public {
        uint256 newId = _idTracker.current();
        require(newId <= TOTAL_LIMIT, "Maximum tokens reached!");
        _idTracker.increment();
        _safeMint(recipient, newId);
        _setTokenURI(newId, tokenUri);
    }
    
    function _beforeTokenTransfer(address sender, address receiver, uint256 id)
        internal
        override(ERC721, ERC721Enumerable)
    {
        super._beforeTokenTransfer(sender, receiver, id);
    }
    
    function _burn(uint256 id) internal override(ERC721, ERC721URIStorage) {
        super._burn(id);
    }
    
    function tokenURI(uint256 id)
        public
        view
        override(ERC721, ERC721URIStorage)
        returns (string memory)
    {
        return super.tokenURI(id);
    }
    
    function supportsInterface(bytes4 interfaceId)
        public
        view
        override(ERC721, ERC721Enumerable)
        returns (bool)
    {
        return super.supportsInterface(interfaceId);
    }
}

Here’s what happened: I successfully minted two NFTs and they appeared in my OpenSea testnet account. After that, I transferred one NFT (token ID 1) to another wallet using the safeTransferFrom function. The blockchain confirmed that the transfer was successful and shows that the new address owns the token. However, when I check OpenSea, the NFT has vanished from my collected items, and it doesn’t appear in the new owner’s account either. Only the NFT that I didn’t transfer (ID 0) is still visible in my collection. Has anyone else experienced this issue?

Had the same issue with my ERC721 contract on testnet. OpenSea’s indexing gets behind after transfers - they temporarily lose track of NFTs while catching up with the blockchain. Hit the refresh button on the NFT’s OpenSea page first. If that doesn’t work, make sure the new owner’s wallet is connected to OpenSea with proper permissions. Also check your tokenURI endpoint - OpenSea hides NFTs with broken metadata. Testnet transfers usually take a few hours to a full day to show up properly in OpenSea’s interface.

hmm this is really interesting - i’ve been working with nft contracts lately too and this opensea behavior sounds familiar but also kinda weird?

I’m curious about a few things that might help narrow down what’s happening here. when you say the nft “vanished” from opensea, did you try searching for the specific contract address + token id directly in opensea’s search bar? sometimes the collections view gets messed up but the individual nft page still exists.

also, what network are you deploying this on - goerli, sepolia, or polygon mumbai? i’ve noticed different testnets have varying levels of opensea support and indexing reliability.

one thing that caught my attention in your contract - you’re using _idTracker.current() and then incrementing, so your first token should be id 0, second one id 1, etc. Are you sure the transferred token was id 1 and not id 0?

have you checked the transaction hash on etherscan (or whatever block explorer) to see if opensea picked up the Transfer event properly? sometimes there’s a disconnect between what the blockchain shows and what opensea’s indexers caught.

oh and just curious - did you try importing the nft manually into the new owner’s account using the contract address? that sometimes forces opensea to refresh their cache. would love to hear what you find!

openSea testnet can be a bit glitchy with transfers. refresh the metadata on ur NFT page or wait some hours as testnet indexing is slower. also, double check ur tokenURI to ensure it’s still valid, cause broken links might hide ur NFTs.