Ernesto's Notes
  • Home
  • Glossary
  • ⛓️Blockchain
    • Solidity Compiler
    • Foundry
    • Gas Optimization
    • Resources
  • 💻Programming
    • Computational Complexity
    • JavaScript
      • Syntax
    • Python
      • Syntax
      • PIP
      • Poetry
    • ZSH
    • Git
  • 🚀Startups
    • Talking to Users
Powered by GitBook
On this page
  • Solidity Compiler Management
  • Installation
  • Usage
  • Compiler Version

Was this helpful?

  1. Blockchain

Solidity Compiler

Guide to managing Solidity compiler versions with svm-rs.

PreviousGlossaryNextFoundry

Last updated 11 months ago

Was this helpful?

Solidity Compiler Management

Alloy's is the easiest way to manage Solidity compiler versions on your machine. This is the version manager that uses, so if you already have Foundry installed, you can skip the installation steps.

Installation

  1. Install Rust (if not already installed):

curl https://sh.rustup.rs -sSf | sh
  1. Install the crate:

cargo install svm-rs

Usage

List installed and available versions:

svm list

Install a version:

svm install <VERSION>

Set global version from installed versions:

svm use <VERSION>

Remove an installed version:

svm remove <VERSION>

Compiler Version

Knowing the exact compiler version is important for verifying deployed contracts on block explorers, like Etherscan.

To list the exact solc commit, run the following in your terminal (replace x and y with your version numbers):

~/.svm/0.x.y/solc-0.x.y --version

Alternatively, you can view the exact solc commit used by your Foundry project by going to out/YourContract.sol/YourContract.json and looking at metadata.compiler.version, as shown below:

⛓️
svm-rs
Foundry
svm-rs