I would like to compile older versions of solc contract source code using a solc compiler on my local machine. Is there a website from which to download old solc compilers?

Google revealed a GitHub of old solcs, but I tried using node to run the .js. files without success (could be using this wrong).


I maintain a Python library called py-solc-x that allows you to install and use multiple versions of solc at the same time. It supports versions >=0.4.11. I've included some code examples below to give an idea of how it works.

Installing a new version of solc:

>>> from solcx import install_solc
>>> install_solc('v0.4.25')

Checking installed versions and versions can be installed:

>>> from solcx import get_installed_solc_versions, get_available_solc_versions
>>> get_installed_solc_versions()
['v0.4.25', 'v0.5.3', 'v0.6.0']
>>> get_available_solc_versions()
['v0.6.0', 'v0.5.15', 'v0.5.14', 'v0.5.13', 'v0.5.12', 'v0.5.11', 'v0.5.10', 'v0.5.9', 'v0.5.8', 'v0.5.7', 'v0.5.6', 'v0.5.5', 'v0.5.4', 'v0.5.3', 'v0.5.2', 'v0.5.1', 'v0.5.0', 'v0.4.25', 'v0.4.24', 'v0.4.23', 'v0.4.22', 'v0.4.21', 'v0.4.20', 'v0.4.19', 'v0.4.18', 'v0.4.17', 'v0.4.16', 'v0.4.15', 'v0.4.14', 'v0.4.13', 'v0.4.12', 'v0.4.11']

Setting the current solc version using a pragma statement:

>>> set_solc_version_pragma('^0.4.20 || >0.5.5 <0.7.0', check_new=True)
Using solc version 0.5.8
Newer compatible solc version exists: 0.6.0
  • Super cool product, but I am running Ubuntu, which is not supported by this tool. Thank you for sharing this with me. – Daniel Connelly Dec 23 '19 at 20:46
  • 1
    It's tested against and working on Ubuntu 18.04 :) – iamdefinitelyahuman Dec 23 '19 at 21:36
  • Wow, okay, this is really great. I must have entered something incorrectly beforehand. Thank you! – Daniel Connelly Dec 23 '19 at 23:07
  • 1
    For clarification: originally I visited the py-solc package instead of the py-solc-x package. The latter is superior, in my opinion. – Daniel Connelly Dec 25 '19 at 0:22

There are a couple of ways to do this and the Solidity documentation has a page on it:

Keep in mind you have the option to use the "cli binary" version (solc-bin) which is quite faster than the solcjs ( javascript implementation ).

In addition to all of these, if you use truffle, you can specify which version you would like to use with it in your truffle-config.js file.

  // Configure your compilers
  compilers: {
    solc: {
      version: "0.5.10" // Fetch exact version from solc-bin (default: truffle's version)
      // docker: true,        // Use "0.5.1" you've installed locally with docker (default: false)
      // settings: {
      //   // See the solidity docs for advice about optimization and evmVersion
      //   optimizer: {
      //     enabled: true,
      //     runs: 200
      //   }
      //   //  evmVersion: "byzantium"
      // }


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.