0

Is there any method to retrieve compilable YUL from EVM byte code?

I've found EVMToEWasmTranslator.cpp at Solidity main repo, but it seems to be designed to translate between YUL dialects.

Maybe there is some possibility to achieve this via LLVM (evmjit or EthSema)? There is also some paper (Solidify, An LLVM pass to compile LLVM IR into Solidity).

I don't need the target to be human-readable, just recompilable.

5
  • have you checked online decompiler at Etherscan? awesome thing, checks input signatures vs ethereum signature database and labels the function as it is coded in the original source
    – Nulik
    Commented Feb 1, 2023 at 14:27
  • Maybe via IR helps. Commented Feb 1, 2023 at 15:11
  • @PaulRazvanBerg, I wouldn't ask this question if I had access to Sol source. Commented Feb 1, 2023 at 16:02
  • @Nulik, unfortunately all existing decompilers (this one included) doesn't provide full semantics for the purpose of recompilation. Commented Feb 1, 2023 at 16:06
  • @AlexandrTenson then I would suggest digging into machine learning decompiling algorithms since Yul is also high level language.
    – Nulik
    Commented Feb 1, 2023 at 16:19

2 Answers 2

1

heimdall, an advanced EVM toolkit which aims to make dealing with smart contracts on EVM based chains easier, provides a module to decompile EVM bytecode into Solidity.

More info about the decompile module can be found here. The wiki also provides examples, see here.

0

This tool is not perfect, but at least able to recompile some examples.

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
    Commented May 9, 2023 at 6:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.