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?

Austin
  • 143
  • 3
  • 12

1 Answers1

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/

Richard
  • 4,934
  • 2
  • 7
  • 25