I'd like to compile solidity in the browser. web3 has deprecated compile() features so you can't call web3.eth.compile.solidity() anymore.

I tried to browserify require('solc') / require('solc/wrapper') so that I could try to access compilation functions, but it seems to have issues.

I found one project that does this called browser-solc but it was last updated a year ago and I'm not sure I want to rely on it.

One option is just creating an endpoint to and executing it serverside, and returning the result to the user for use in smart contract deployment.

Any thoughts or solutions on the subject appreciated.

  • If your question has been answered could you please mark it as answered so that other users know? Thank you :)
    – Malone
    Commented Dec 5, 2017 at 17:54

2 Answers 2


For local development on small side projects I was using the online compiler, remix.

As the project progressed I started doing this computation server side with the Ethereum implementation that I was using: EthereumJ.

In my case, I only wanted to compile the contract once as it wasn't going to change. Your specific use case will likely determine where the binaries are produced.

I'd point you in the direction of solc-js. It works great for client-side compilation imo.


Truffle is how I do it.

npm i truffle

And it has its own geth engine, so no need to install testrpc to make it work. More info here: https://github.com/trufflesuite/truffle

  • I've used truffle, but that's for deploying on your localhost/server, right? I suppose I could write an endpoint script that executes truffle on my server end and sends the data back to the user.
    – user339946
    Commented Nov 3, 2017 at 18:03
  • Yes, We use truffle as a deployment based regression test. but it also allows you to use your own editors and linting tools to prevent simple syntax bugs and do code completion, Remix is ok for Single contract developments, but if you are doing a spiders web of contracts with data contract and library contract calls, you need to have a fully working environment like the one testrpc gives. you should not deploy development code onto testnet, only pre-production test should go there.
    – Cyberience
    Commented Nov 7, 2017 at 2:41

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.