How to compile OpCode to ByteCode?

Hello!
I’m facing a use case where I don’t have an original solidity contract, but I have opcodes.
It is possible to produce the bytecode from these opcodes using solc?
The documentation mentions a --strict-assembly but I am failing to to it.
So given a list of Opcodes (something like “PUSH1 0x1 PUSH1 0x1 STOP”) can I produce the bytecode?
Thank you!

1 Like

Not at this point. --strict-assembly is for compiling Yul code (the intermediate language you usually see in inline assembly blocks). We have a feature planned to import raw EVM assembly in the format used by solc --asm-json but that’s not done yet.

Maybe try some external tools. For example ETK provides an assembler and might be able to handle your contract.

2 Likes

Super! Thank you Cameel

1 Like