2

I wrote a contract into bare assembly (no solidity or Vhyper syntax and with all address being static).

How to convert it into bytecode? If possible using the new http://remix.ethereum.org or another web service where nothing has to be compiled.

7
  • No difference from a contract written in any other language. Run solc --bin --abi --optimize --optimize-runs=200 --output-dir=YourArtifactsFolder YourContractFileName. – goodvibration Sep 28 '19 at 19:21
  • 2
    Unless I'm mistaken, the Solidity compiler only accepts Solidity code as input. – user19510 Sep 28 '19 at 19:37
  • @smarx Like in C Solidity has an assembler directive where you can write assembly. But in such directive, you still need to use solidity variables and you can’t be sure of the address of the instructions. – user2284570 Sep 28 '19 at 21:23
  • @goodvibration do you know an online service for it? – user2284570 Sep 28 '19 at 21:24
  • @user2284570 Yes, I'm aware that Solidity allows inline assembly, but you specifically said you weren't using Solidity. – user19510 Sep 28 '19 at 21:30
3

In addition to @mafrasi2's answer, geth ships with a binary called evm. evm compile <filename> can compile "easm" source. You haven't said what sort of assembly you were writing (or given a sample), so I'm not sure if that meets your needs.

2
1

I've used this assembler in the past, but it's unmaintained and you would need to update it yourself if you want to use any constantinople instructions. I didn't test it, but this one appears to be up to date and a bit more mature. You will have to do some simple preprocessing beforehand, though.

Your Answer

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

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