SOLL is a new compiler for generating Ewasm (Ethereum flavored WebAssembly) files from Solidity and Yul.
To support developers as many as possible, we design projects to not only support more smart contract programming languages, such as Rust and C++, but also support various VMs, such as Ewasm VM and evm. To achieve this goal, in the very first step, we develop SOLL, a compiler for Solidity-based smart contract running on Ewasm VM.
SOLL has two phases in the code generation flow. Generate LLVM IR files first, then leverage LLVM framework to generate Ewasm bytecode.
For application users, please refer to this document. You will know how to use SOLL to generate Ewasm bytecode from your Solidity smart contract or Yul language, and then deploy the Ewasm bytecode to Ethereum Ewasm TestNet.
For developers, we provide another document for explaining the design of SOLL and how to develop and test the functionality of SOLL, please refer to the Developer Guide for more details.
SOLL is still in early stage, and we’ve not fully supported Solidity and Yul. Please check features we’ve done and limitations in the following documents.
And SOLL integrates Solidity and Yul test contracts from ethereum/solidity.
Here is the pass rate of both language:
Solidity test suite (Total 75 tests from compilationTests):
Expected Passes : 22 # Solidity has 75 testing contract, and SOLL can pass 22.
Unsupported Tests : 53 # Unimplemented by SOLL
Pass Rate: 29%
Yul test suite (Total 499 tests from libyul):
Expected Passes : 293 # libyul has 499 testing contracts, and SOLL can pass 293.
Unsupported Tests : 206 # Unimplemented by SOLL
Pass Rate: 59%
To get started with our demonstration, you will need prepare two components at first.
- Pre-install Docker and pull our docker image
We provide an image include build and execute environment (recommend). If you don't want to use docker directly you will need below tools (cmake, llvm, xxd, wabt, node.js).
- Pull official docker image to get an already established build/execute environment.
> docker pull secondstate/soll
- Get Source Code from Github and checkout to the latest version, 0.0.5.
> git clone --recursive https://github.com/second-state/soll.git
> cd soll
> git checkout 0.0.5
Attach shell to container and bind volume with repositories' path.
> docker run -it --rm \
-v $(pwd)/soll:/root/soll \
secondstate/soll
Build SOLL(we use cmake with llvm library)
(docker) $ cd ~/soll && mkdir -p build && cd build
(docker) $ cmake .. && make
As above-mentioned, to compile Solidity Smart Contract code, SOLL will generate LLVM IR files(.ll), and then generate Ewasm bytecode(.wasm).
Create your smart contract files by copying from our demonstration contract "0-0-3.sol".
(docker) $ cd ~
(docker) $ cp ~/soll/doc/examples/0-0-3.sol ~/contract.sol
Execute SOLL to generate a LLVM IR file(.ll) for the next step.
(docker) $ ~/soll/build/tools/soll/soll contract.sol > contract.ll
(docker) $ ~/soll/utils/compile -v contract.ll
After compiling "contract.ll", SOLL compiler will generate two files:
- "contract.deploy.wasm": Contract bytecode with deployer. Use this for the deployment.
- "contract.wasm": Contract runtime bytecode only. You can execute it with Ewasm runtime directly.
We will use "contract.deploy.wasm" in the next section to deploy it to Ewasm TestNet.
To deploy our smart contract to TestNet, we need to convert the WASM files to Hex Code files.
(docker) $ xxd -p contract.deploy.wasm | tr -d $'\n'
Copy the Hex Code generated by the previous step.
Paste the Hex Code to Ewasm TestNet website and submit it.
Submit the Hex Code to Ewasm TestNet.
Check whether the latest activity is our contract or not.
Check the Bytecode of the latest activity.
Check the Ewasm code of the latest activity.
Check the Storage part of the latest activity.
Congratulations! Now you finished our user tutorial.