NFT transfer issue: Transaction successful but ownership unchanged

I’m having trouble with my NFT transfer process. I’ve set up a smart contract and minted an NFT, but when I try to transfer it, something odd happens. The transaction goes through fine and shows up on Etherscan, but the NFT ownership doesn’t change. What could be causing this?

Here’s a simplified version of my transfer function:

async function moveToken() {
  const txCount = await web3.eth.getTransactionCount(SENDER_ADDRESS, 'latest');
  
  const transferData = {
    from: sender,
    to: recipient,
    nonce: txCount,
    gas: 400000,
    data: nftContract.methods.transferFrom(sender, recipient, tokenId).encodeABI()
  };

  try {
    const signedTx = await web3.eth.accounts.signTransaction(transferData, SENDER_KEY);
    const receipt = await web3.eth.sendSignedTransaction(signedTx.rawTransaction);
    console.log('Transfer hash:', receipt.transactionHash);
  } catch (error) {
    console.error('Transfer failed:', error);
  }
}

moveToken();

I’ve also included a basic ERC721 contract. I’m not directly calling the transfer function, as I thought the OpenZeppelin transferFrom would handle it. But even when I use the contract’s transfer function, the result is the same: the transaction goes through, but the NFT doesn’t move. Any ideas what might be wrong?

yo, had similar issue. check if the contract’s approved for transfer. Sometimes u gotta do a separate approval transaction first. also, double-check the token ID ur using - easy to mix up. if its still borked, maybe the contract’s bugged? good luck mate

Have you checked if the contract is actually updating the ownership internally? Sometimes the transaction goes through, but the contract’s state doesn’t change as expected. You might want to add a function to your contract that lets you query the current owner of the NFT, then call it after the transfer to see what’s happening. Also, make sure you’re using the correct token ID and that the sender actually owns the NFT they’re trying to transfer. If all else fails, you might need to review your contract’s transfer logic - there could be a condition preventing the ownership change that you’re not aware of. Hope this helps!

hey there! i’ve seen this kind of thing before. have you double-checked that the sender actually has permission to transfer the NFT? sometimes we forget to set up the approval first, especially if you’re using OpenZeppelin’s stuff.

also, maybe try adding some extra logging to your function? like, print out the owner before and after the transfer. could help you spot what’s going wrong. something like this:

async function moveToken() {
  console.log('Owner before:', await nftContract.methods.ownerOf(tokenId).call());
  
  // your existing transfer code here
  
  console.log('Owner after:', await nftContract.methods.ownerOf(tokenId).call());
}

oh, and make sure your contract’s not paused or anything. some contracts have sneaky pause functions that can mess with transfers.

let us know how it goes! always fun to debug these weird blockchain quirks :slight_smile: