Is there any way to see the exported functions of a smart contract deployed by somebody else given the address of the contract? I tried in explorer and all I was able to see was the compiled code. Thank you!
Asked
Active
Viewed 77 times
0
-
1I think the only way to list the endpoints without the source code is to have the abi.json. Otherwise you can also execute the transaction you want via a dapp (like maiar exchange) and see what is sent in the explorer. – Bast May 14 '22 at 21:01
1 Answers
0
Easiest way would be to have access to the contract's .abi.json
file.
If you don't have it, then the "reverse engineer" way would be to take the contract's bytecode from the explorer and open it with a web assembly interpreter (e.g. the WebAssembly VSCode extension).
Thus you'll be able to see the contract's interpreted web assembly functions and their opcodes. You should be able to find a list of entries like export "function_name" (func $rust_function_name)
.
From this point on, you'll either have to employ some educated guesses to figure out endpoints from views along with their corresponding parameters... or try them out exhaustively.

Brother Jder
- 415
- 2
- 9