百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
S

SOLL

> 编程语言
开源

SOLL 是一个用于从 Solidity 和 Yul 生成 Ewasm 的新编译器。请参阅演示:https://asciinema.org/a/ezJqNLicn5fya02zwu4VXIo8a

374 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

SOLL 是一个用于从 Solidity 和 Yul 生成 Ewasm 的新编译器。请参阅演示:https://asciinema.org/a/ezJqNLicn5fya02zwu4VXIo8a

1. Introduction

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 contracts running on Ewasm VM.

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.

2. Current Status and Limitations

SOLL is still in an early stage, and we’ve not fully supported Solidity and Yul. Please check the features we’ve done and limitations in the following documents.

  • Feature Guide for Solidity
  • Feature Guide for Yul
  • Known Issues

And SOLL integrates Solidity and Yul test contracts from ethereum/solidity.

Here is the pass rate of both language:

The solidity test suite (Total 80 tests from compilation tests):

bash
Expected Passes    : 27 # Solidity has 80 testing contract, and SOLL can pass 27.
Unsupported Tests  : 53 # Unimplemented by SOLL
Pass Rate: 34%

Yul test suite (Total 499 tests from libyul):

bash
Expected Passes    : 393 # libyul has 499 testing contracts, and SOLL can pass 393.
Unsupported Tests  : 106 # Unimplemented by SOLL
Pass Rate: 79%

3. Getting Started

To get started with our demonstration, you will need to 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, binaryen, xxd, wabt, node.js).

  • SOLL https://github.com/second-state/soll

  • If you want to set up the working environment by yourself, please install the following dependencies:

    • Our docker image is based on Ubuntu 20.04
    • llvm-10-dev
    • llvm-10-tools
    • liblld-10-dev
    • cmake
    • make
    • wget
    • python-psutil
    • binaryen
    • wabt
    • clang-10 or g++-9
  • After SOLL 0.1.1, we use llvm-10 instead of llvm-8, if you want to build the older version of SOLL, please use this docker image: secondstate/soll:0.1.0.

3.1 Preparation

  • Pull official docker image to get an already established build/execute environment.
bash
> docker pull secondstate/soll
  • Get Source Code from Github and checkout to the latest version, 0.1.1.
bash
> git clone --recursive https://github.com/second-state/soll.git
> cd soll
> git checkout 0.1.1

3.2 Launch Environment

Attach shell to container and bind volume with repositories' path.

bash
> docker run -it --rm \
      -v $(pwd)/soll:/root/soll \
      secondstate/soll

3.3 Build SOLL

Build SOLL(we use cmake with llvm library)

bash
(docker) $ cd ~/soll && mkdir -p build && cd build
(docker) $ cmake .. && make

3.4 Tutorial: Compile ERC20 contracts and deploy them on Ewasm testnet

Our original tutorial will deploy Ewasm bytecode on the official TestNet. Unfortunately, the Ewasm TestNet is unavailable now. We’ve moved the original tutorial into Deploy an ERC20 smart contract to Ewasm official TestNet.

For demonstration propose, we provide another Ewasm TestNet which is launched by our DevChain.

DevChain The Second State DevChain features a powerful and easy-to-use virtual machine that can quickly get you started with smart contracts and DApp development. Our devchain supports Ewasm by hera through EVMC interface.

3.4.1 Compile an ERC20 smart contract

SOLL supports two frontend languages including Solidity and Yul. You can use SOLL to generate Ewasm bytecode(.wasm) directly.

3.4.1-1 For Solidity contracts

Create your smart contract files by copying from our demonstration contract "0-0-3.sol". And execute SOLL to generate Ewasm bytecode(.wasm) and contract ABI.

…

We will use "0-0-3.wasm" in the next section to deploy it to Ewasm TestNet.

3.4.1-2 For Yul contracts

Create your smart contract files by copying from our demonstration contract "0-0-6.yul". And execute SOLL to generate Ewasm bytecode(.wasm) and contract ABI.

…

We will use "0-0-6.wasm" in the next section to deploy it to Ewasm TestNet.

3.4.2 Convert Ewasm bytecodes into text format.

3.4.2-1 Solidity Part: 0-0-3.sol

bash
(soll docker) $ xxd -p ~/soll/docs/examples/0-0-3.wasm | tr -d $'\n'

The result should be the same as the following content. (This will be used later)

…

3.4.2-2 Yul Part: 0-0-6.yul

bash
(soll docker) $ xxd -p ~/soll/docs/examples/0-0-6.wasm | tr -d $'\n'

The result should be the same as the following content. (This will be used later)

…

Then exit SOLL container goto next step.

3.4.3 Attach to our Ewasm DevChain

  • Pull our devchain docker image.
bash
> docker pull secondstate/devchain:devchain
  • Attach to testnet
bash
> docker run -it secondstate/devchain:devchain attach https://rpc.parastate.io:8545

Welcome to the Travis JavaScript console!

instance: vm/v1.9.2/linux-amd64/go1.10.3
coinbase: 0x7eff122b94897ea5b0e2a9abf47b86337fafebdc
at block: 1115129 (Tue, 07 Apr 2020 06:51:46 UTC)
 modules: cmt:1.0 eth:1.0 net:1.0 personal:1.0 rpc:1.0 web3:1.0
  • Unlock the demo account with a long expiration time.
javascript
> personal.unlockAccount(cmt.accounts[0], '1234', 9999999)

Please note: You can obtain network tokens (STATE tokens) for the aforementioned ParaState Testnet by visiting the testnet's faucet at https://testnet.faucet.parastate.io:8001/faucet.

There is also a YouTube Video which demonstrates how to use the faucet.


3.4.4 Deploy and execute Ewasm

3.4.4-1 Solidity: 0-0-3.wasm

  • Deploy Ewasm bytecode generated from 0-0-3.sol that has been seen before.
…
  • Check the transaction receipt of contract deployment.
…
  • You can check the contract deployed was success by getCode(contract address)
javascript
> cmt.getCode(contractAddress)

// The result should similar to the following content.
"0x0061736d01000000..." (omitted, runtime Ewasm bytecode)
  • Send the transaction to execute a contract function transfer. In this example, we want to transfer 123 tokens from account A to account B

  • Setup transaction parameters:

javascript
// Get contract instance via contract address
> var contractInstance = contract.at(contractAddress);

// Setup transaction parameters
> var txnObject = {
    from: fromAccount,
    gas: 5000000
};

// Set second account as token receiver
> var toAccount = personal.listAccounts[1];

// Set send 123 tokens
> var sendValue = 123
  • Before we send the transaction, checking their balances first.
javascript
// Get original balance of fromAccount and toAccount
> contractInstance.balanceOf.call(fromAccount);
100000000

> contractInstance.balanceOf.call(toAccount);
0
  • Call ERC20.transfer(receiver, value)
javascript
> contractInstance.transfer.sendTransaction(toAccount, sendValue, txnObject,
    function(error, result){
        if(error){
            console.log("Error: " + error);
        } else {
            txhash = result;
            console.log("txhash: " + txhash);
        }
});
// The result should similar to the following content.
txhash: 0x566211fa5850ad759c001941eec060f48e0108eac06bbbeb17ad08684cf6c9d9
  • Check their balances again.
javascript
// Get after balance of fromAccount and toAccount
> contractInstance.balanceOf.call(fromAccount);
99999877
> contractInstance.balanceOf.call(toAccount);
123
  • Verfiy transfer by getTransactionReceipt.
…

3.4.4-2 Yul: 0-0-6.wasm

All steps are the same with 3.4.4-1. You only need to replace the Ewasm bytecode with 0-0-6.wasm.

(Omitted)

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

C++blockchaincompilerewasmllvm

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言