Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Web3 python: how can I decode Input Data

using web3 (python3) I am trying to decode InputData of the BSC transaction as seen on BscScan enter image description here

In some solutions I've found code below is being used:

import web3
from web3.contract import Contract
...
contract = web3.eth.contract(address=Web3.toChecksumAddress(tokenAddress), abi=abi)
contract.functions.decode_function_input(transaction.input)

However, the abi's doesn't seem to have this function "decode_function_input" defined, as I am getting an error:

"web3.exceptions.ABIFunctionNotFound: ("The function 'decode_function_input' was not found in this contract's abi. ", 'Are you sure you provided the correct contract abi?')"

I am 100% that the abi is correct. Also, on BscScan contract raw view, the function 'decode_function_input' indeed is not present.

Any other solutions, how to decode the Input Data?

like image 645
Penko_Mlakar Avatar asked Jul 04 '26 20:07

Penko_Mlakar


1 Answers

It's not contract.functions.decode_function_input, it is contract.decode_function_input()

like image 176
Mr. AdityaYT Avatar answered Jul 08 '26 11:07

Mr. AdityaYT



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!