Skip to content

A script to quickly switch between Solidity compiler versions

License

Notifications You must be signed in to change notification settings

ivanvpan/solc-select

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

solc-select

A script to quickly switch between Solidity compiler versions.

It is becoming increasingly hard to run older versions of solc, particularly on macOS since there are no official binary releases. Versions prior to 0.5.0 no longer compile on macOS and are not maintained. This is a problem because older Ethereum contracts no longer compile on modern versions of Solidity. solc-select is a utility that allows one to run any legacy version of Solidity simply by setting an environment variable.

Quickstart

docker pull trailofbits/solc-select
docker run --read-only -i --rm --entrypoint='/bin/sh' trailofbits/solc-select:latest -c 'cat /usr/bin/install.sh' | bash -e

This will install solc globally. If solc is already installed, you will be prompted to overwrite it.

To install solc to a different directory, run the docker command with the environment variable PREFIX set; solc will be installed to ${PREFIX}/bin/solc.

Alternatively, manually copy the special solc script to your desired location.

Usage

The desired version of solc can be specified using the SOLC_VERSION environment variable. By default, the latest version is used.

$ solc --version
solc, the solidity compiler commandline interface
Version: 0.5.2+commit.1df8f40c.Linux.g++
$ SOLC_VERSION=0.4.24 solc --version
solc, the solidity compiler commandline interface
Version: 0.4.24+commit.e67f0147.Linux.g++

You can list all available versions with the special --versions argument:

$ solc --versions
0.4.11
0.4.12
0.4.13
0.4.14
0.4.15
0.4.16
0.4.17
0.4.18
0.4.19
0.4.20
0.4.21
0.4.22
0.4.23
0.4.24
0.4.25
0.5.0
0.5.1
0.5.2
0.5.3
0.5.4
0.5.5
nightly

Upgrading

Once installed, simply run

solc --upgrade

to automatically upgrade solc-select. This will automatically pull the latest Docker image and upgrade the local solc script, if necessary. The DockerHub image for solc-select will automatically update every time Solidity is updated, which will typically be nightly.

Installation from Source

$ git clone https://github.com/trailofbits/solc-select.git
$ cd solc-select
$ docker build -t trailofbits/solc-select:latest .
$ bin/solc --install

Getting Help

Feel free to stop by our Slack channel for help on using or extending solc-select.

License

solc-select is licensed and distributed under the AGPLv3 license. Contact us if you’re looking for an exception to the terms.

About

A script to quickly switch between Solidity compiler versions

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 67.0%
  • Dockerfile 33.0%