Like erc20, when someone sends me a erc20 token, they're not actually sending the tokens to my address. Instead, they're sending a transaction to the Ethereum network that calls the transfer function of the ERC-20 contract with your address as the recipient and the amount of tokens to transfer.

The ERC-20 contract then updates its mapping of token balances, which records the number of tokens held by each address. This means that the balance of ERC-20 tokens associated with my address increases accordingly.

Does the same happen in the case of erc721?

1 Answer 1


Yes, the same happens with the ERC721, you simply become the owner of that NFT in the contract.

As you can see in the contract below from OpenZeppelin, the transferFrom() function calls _transfer(). This function, after the checking requirements does the following:

  1. deletes token approval for the previous holder.
  2. adds +1 to your balance of tokens in the balances mapping, and -1 to the previous holder.
  3. updates the _owners mapping. All holders are simply mappings of the _owners.


  • So how to find out a particular user owns how many nfts? Do I have to query the whole blockchain transactions and search the transactions for the particular address then separate the erc721 transactions, etcc?
    – amit
    Mar 24 at 9:57
  • 1
    Yes, you'd have to query the blockchain and check how many NFTs have been minted and are held by each wallet. You can of course, also make a custom mapping or use an extension if you're coding your own. adds enumerability of all the token ids in the contract as well as all token ids owned by each account. github.com/OpenZeppelin/openzeppelin-contracts/blob/master/… Mar 24 at 13:47

Your Answer

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

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