3

If I look in the past transactions of a smart contract that called a function, I can see the MethodID being used.

enter image description here

If the function was never used in the past, I would never know what was the method ID. Is there any way I could generate this?

1 Answer 1

7

The function selector or method id is the first 4 bytes of the hash of the method name and the parameters. This is documentend here https://solidity-by-example.org/function-selector/

More details are also available here What is a function selector? There are also database where you can look these up. For example https://www.4byte.directory/

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.