0

I ask for your help! How do I get the Method ID for each transaction in a block.

I can get the following information

block = w3.eth.get_block('latest', True) print(list(block))

['difficulty', 'proofOfAuthorityData', 'gasLimit', 'gasUsed', 'hash', 'logsBloom', 'miner', 'mixHash', 'nonce', 'number', 'parentHash', 'receiptsRoot', 'sha3Uncles', 'size', 'stateRoot', 'timestamp', 'totalDifficulty', 'transactions', 'transactionsRoot', 'uncles']

And as I understand there is no information about the Method ID (Transfer, Multicall, Premint etc). What ideas might there be?

Thank you!

2 Answers 2

0

On pay is to use the first 4 bytes in the transaction's input field, they represent the method's id. Then you can use a database like Ethereum Signature Database to map the method id to the name of the method called.

Another alternative is to look at the events emitted by the transaction. Dex exchanges usually emit events that are well known.

Perhaps a better option is to mix both.

0

If the Contract input has not been decoded then the Method is within the Input Data

If you have the ABI code of the contract you can decode the input Data

1
  • As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Community Bot
    Dec 21, 2022 at 12:33

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.