Use solc-select in Ubuntu to manage multiple Solidity compilers and switch between them at will (availability has been verified under Ubuntu 20.04)

There are multiple versions of Ethereum smart contracts written in Solidity. The compiler version specified by the smart contract is in the header of the smart contract. for example:

pragma solidity ^0.4.16;
    contract test{
                function(){......}
    }

The first line of statements indicates that the solidity compiler version used is 0.4.16. In this case, the middle digit of the version number must be the same as the version number to be compiled (the middle digit must be 4) and the rightmost version number is higher than or equal to the specified version number of the smart contract to be compiled (the rightmost version number must be 4). The number must be greater than or equal to 16) compiler. For example, a compiler with version number 0.4.16 or 0.4.17 or 0.4.26.

Sometimes the smart contracts we compile have different version numbers, in which case we need to download different versions of compilers. A project on Github provides an open source solc package management tool , which is very easy to use.

There are two installation methods. After personal trial, I recommend the method that is easier to use and more stable. Enter the following command in the terminal:

pip3 install solc-select==0.2.0

After the installation is successful, enter the following command to view the installable version number:

solc-select install

The installable version number is displayed:

Guess you like

Origin blog.csdn.net/k1nh00/article/details/123112828