I am confused as to what is the difference between method id, event id and abi signature. I got the abi signature of a token transfer function according to the following web3js function

const signature = web3.eth.abi.encodeEventSignature("Transfer(address indexed _from, address indexed _to, uint256 indexed _tokenId)");

If I want the method id of the token transfer function of ERC721 tokens should I just consider the value returned from the above code, or it is the first four bytes of the answer returned according to this. Will the same value also be called its event id?

  • 1. It's a web3.js function, not a web3j function. 2. You should get rid of the indexed parts, the parameter names and the spaces before/after the commas. In other words, you should use "Transfer(address,address,uint256)". – goodvibration Feb 15 at 15:15
  • okay but I still don't know the difference between method id event id and ABI signature – mahamzaidi Feb 15 at 15:21
  • The method and the event are two different things. Why didn't you post both prototypes here? (i.e., in Solidity; I can understand what the event prototype is but please post the function prototype as well). – goodvibration Feb 15 at 17:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.