This question is regarding the bytecode-optimizer of the solidity-compiler, not the yul-optimizer:

Is there any way to separately optimize bytecode? Normally the solidity-compiler optimizes the deployment-bytecode while compiling solidity-code as one of the last steps.

When I have unoptimized (deployment-)bytecode, how would you optimize the existing bytecode? Re-compiling the solidity-code is unfortunately not an option.

Is there another solution apart from rewriting the compiler?

I would be really happy for any hint :)

  • 2
    Probably nothing other than modifying the compiler's (open) source code for your specific needs. However, you might want to elaborate on how you've got to a situation where you have the bytecode without its source code (which is quite reasonable), and you want to optimize it (which is quite unreasonable considering the fact that you don't have the source code, hence you are not the author of this contract). If you do so, then someone here might be able to suggest an alternative solution to the original problem which has led you to try optimizing a source-less bytecode. – goodvibration May 18 at 23:35
  • 1
    Thanks for your response:) I want to analyse all the bytecodes (deployment or runtime) of the contracts on the blockchain. I want to check how many of them are redundant due to missing optimization. So, therefore, I wanted to optimize the bytecode with the ConstantOptimizer & Deuplicater (since these Optimizers only run with the optimize-flags). Or simply re-run the whole optimizer, if this would work. Don't know yet how to exactly do it. – jonasgeb May 18 at 23:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.