Solidity: Using solc on Windows

The solc command line compiler is a C++ implementation of the Solidity compiler that can output opcodes for interpretation by the Ethereum Virtual Machine (EVM). There are plenty of excellent resources available covering Solidity, including the Solidity documentation. This article will step through the basics of getting started with solc on Windows.

Install Solc on Windows

  1. Download the Windows binary from

  2. Extract the into a new folder

  3. Launch a command prompt and cd into the directory where solc.exe was extracted to

  4. First check the version

    solc --version

    solc version

  5. We can also check the usage

    solc --help
  6. If you plan to make extensive use of solc, I recommend adding it to you PATH variable:

    • Click Start and type system. From the search results select System (Control Panel)

      Start System

    • From the System window on the left click Advanced system settings

    • On the Advanced tab click Environmental variables

    • Under User variables for… select Path and click Edit

    • Add the path to your solc installation, then click OK, OK, and OK to save. Close and reopen any command prompts for the change to be reflected.

Compiling a contract

Now we want to try compiling a smart contract written in Solidity.

  1. Open a text editor, such as Notepad++, and create a new file helloworld.sol in the same directory as solc.exe.

    pragma solidity ^0.4.9;
    contract helloworld {
        address owner;
        function helloworld() {
            owner = msg.sender;
  2. Go back to the command prompt and use solc to compile the contract.

    solc helloworld.sol

    If the code is free of errors, solc should return with no output.

  3. We also have a few options for compiler output. As per the help, solc --asm will output EVM assembly:

    solc --asm helloworld.sol

    The output will be a long list of opcodes:

    ======= helloworld.sol:helloworld =======
    EVM assembly:
      mstore(0x40, 0x60)
    ... */ "helloworld.sol":25:125  contract helloworld {
      jumpi(tag_1, iszero(callvalue))
  4. We can also output in bytecode (hex) using the --bin option:

    solc --bin helloworld.sol

    Again, here is a sample of the output:

    ======= helloworld.sol:helloworld =======

Further reading