I have a simple ERC721 NFT smart contract. I need to do something if the owner of any of my minted NFT changes. How can I trigger an action in my smart contract if the owner of my NFT changes?

I guess this can be done via oracles. I can (somehow) keep track of NFT owners off-chain (like Etherscan) and send that information to my contract (or to oracle contract). Is there any other way to do this? (I am asking this because there is a function named ownerOf which returns the owner address of the given token ID)

1 Answer 1


In solidity you can just subbscribe to events for a specific smart contract so you can emit an event from nft contract and listen for events in your server(node) and trigger some other function calls . example would bee something like this :

const instance = Web3.eth.contract(ABI).at(ADDRESS); instance.FooEvent().watch((err, response) => { 
 console.log (response); 

In response you will have all events emited from fooEvent().

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.