0

I tied to decode transaction's input for the specific contract Contract source code is unknown and ABI is unknown too. At BSCscan contract isn't verified and built-in decompiling returns a mess

Contract address (BSC) - 0x22726abde7ad5496f7cdb12c1356772e847e6996

example tx hash: 0x51a0035fd27270ed1966731a575aa8161b37fac20cb5cdfdd05cf835e15cd610

So I want to find a way to see the tx data as it displayed in BSCscan. (https://bscscan.com/tx/0x51a0035fd27270ed1966731a575aa8161b37fac20cb5cdfdd05cf835e15cd610)

2
  • Without ABI / source code, its not possible to decode the input
    – pbsh
    Jan 25, 2022 at 19:44
  • If it is impossible - how BSCscan itself decode input and return all tx data in human-readable format? Jan 26, 2022 at 7:07

1 Answer 1

1

Technically, it's not possible to decode the input data without the ABI. Your ABI specified what data and data type in encoded in the function parameters. That said, you might have seen etherscan/bscscan with decoded input parameters. Thanks to sources like https://www.4byte.directory/, we have a list of known function signatures and their parameter types. These block explorers likely use something similar to decode known functions. So if the function call you are trying to decode is known in the signature database, you can technically decode it. For example, lets say the input data is 0x2e1a7d4d0000000000000000000000000000000000000000000000000038d7ea4c680000.

In that, the first 4 bytes are the function signature - 0x2e1a7d4. The remaining are input parameters.

We could then lookup in https://www.4byte.directory/ for the signature (link). It says the function is withdraw(uint256).

Now that we have the function definition, we can easily decode the input. You can do it via libraries like web3 or ethers, or some web tools to do the same. In this case, the input is 0x38d7ea4c680000 which is the hex for 16000000000000000. So the function call was withdraw(16000000000000000).

But like said, this worked only because the function signature of withdraw(256) was known. If it's a new function signature that is not previously known, it's impossible to decode the input. You can read more about how input is encoded here.

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.