When you list an NFT for sale on one of the NFT Marketplaces (like say OpenSea, Rarible, LooksRare, etc.) and someone then buys your NFT, which party is calling the safeTransferFrom() function at that point to make the transferring of that NFT happen from you to the Buyer? Is it that Marketplace's smart-contract that's calling safeTransferFrom(), or is it the SELLER - meaning the current owner of the NFT that's calling it?

As a quick reminder, here's the method's signature --> and note how from is the very first argument in it:

safeTransferFrom(address from, address to, uint256 tokenId)

I'm asking because I looked at some recent sale transactions on Etherscan and found the info there to be inconsistent - and also just plain confusing.

For starters, we don't even always see safeTransferFrom() being called. Sometimes its a function called fulfillBasicOrder(tuple parameters) that gets called (this is with an OpenSea sale transaction.)
Of course, I'm assuming they wrap safeTransferFrom() inside of their fulfillBasicOrder() function, but either way - who is from in this case?



I think a bit of clarification is needed - judging from the responses I got...

I was trying to understand who from is in safeTransferFrom(address from, address to, uint256 tokenId).

I knew that from is the owner of the token being transferred - but then who is actually doing the calling of this safeTransferFrom() function? Meaning where is that call coming from?

So these two different "froms" confused me.

Then I realized that when we call safeTransferFrom(from, to, tokenId) it is NOT necessarily the case that the caller of this function is the owner of the token. Actually, when it comes to NFT Marketplaces, it's probably never the case.

And if we did want to find out and examine where the call was coming from, all we would have to do is use... msg.sender

That's it.

The safeTransferFrom() call is coming from msg.sender, and the token it's transferring is from it's owner - just as we would expect it to be.

End of confusion.

3 Answers 3


The from is the address of the current owner of the NFT.




In any case either direct call to safeTransferFrom or some other contracts functions that wraps safeTransferFrom. when safeTransferFrom of NFT contract is called, it's always called with.

from: seller's wallet
to: buyer's wallet
tokenId: NFT id we are talking about

As much as I can tell from your query, you are trying to determine who calls the safeTransferFrom function when we purchase an NFT.
For educational purposes, I'm currently developing an NFT market place. According to the tutorial I'm using, the marketplace's smart contract calls the safeTransferFrom function of the NFT you are purchasing.
And that, in my opinion, is how openSea, binance and other services operate.

An illustration of how the smart contract for the marketplace calls the safeTransferFrom

IERC721(nftAddress).safeTransferFrom(from, to, tokenId);
from is always owner of nft
to is always buyer of nft

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.