Page properties |
---|
Project | SVG Out |
---|
scaleX | 200px |
---|
name | Hyperledger_Solang.svg |
---|
| The body area can be used to replace links in the SVG and to add tool tips to them. Please read the SVG Out documentation for details. |
| Status |
Status |
---|
| |
---|
colour | Blue |
---|
title | Incubation |
---|
| ACTIVE | CII Badge | | Description | Solang is a portable compiler for the Solidity language that targets Solana and Substrate (Polkadot). It is written in Rust, and leverages the LLVM infrastructure for the compiler backend. |
|
Marked |
---|
URL | https://raw.githubusercontent.com/hyperledger/solang/main/README.md |
---|
|
The Solidity language is the most popular programming language for smart contracts. However, the existing Solidity compiler only targets the Ethereum virtual machine. The Solang project aims to make Solidity available for other blockchains, and focuses on maintaining source code compatibility with Solc, so that developers can use their existing codebase for blockchains other than Ethereum with minimal modifications.
The purpose of Solang is two-fold: first of all, developers with Solidity language knowledge can develop new smart contracts for non-ethereum blockchains in Solidity, so they do not have to learn a new language. Secondly, there is a large amount of existing Solidity contracts available, which can be recompiled for a different blockchain.
Currently, Solang targets the following blockchains:
- Solana
- Substrate
At the time of writing, these chains are the 9th, and 11th by market capitalization according coinmarketcap.com (the coins are listed by market cap).
Any other blockchain that wishes to have Solidity language support is welcome to add a new target to the Solang project. The cosmos blockchain grant foundation has said it would support a grant for adding CosmWasm support.
The goal of Solang is to bring the Solidity language to as many blockchains as possible. Writing a production quality compiler is a complex task, so collaboration between blockchains will be hugely beneficial.
The success of the project can be measured by the number of projects that use Solang as a compiler.
Key Characteristics
Hyperledger Solang is a compiler: it knows how to transform Solidity source code into a binary program (or contract) which can be directly deployed on a blockchain. Hyperledger Solang does not provide tooling for this, however we do provide documentation on how to deploy and interact with your Solidity contracts, see the block-chain specific documentation below.
Hyperledger Solang has the following stages:
- Parser stage. This parser Solidity. This is in the `solang-parser` crate. This crate is used by another project: foundry uses it for its Solidity code formatter.
- Semantic Analysis Stage (sema). This validates that the source code is valid, and produces the AST. This is used by the Language Server.
- Code generation (codegen). This transforms the AST into a CFG (control flow graph). This deals with contract inheritance too, and includes a few code optimization passes.
- LLVM IR emit (emit). This transforms the CFG into LLVM IR.
- LLVM Backend. The LLVM Libraries further optimize and compile the code into optimized binary files
- LLD Linker. The LLVM Linker produces the final file.
Documentation
https://Solang.readthedocs.io/en/latest/
How to run Solang on command line: https://Solang.readthedocs.io/en/latest/running.html
Blockchain-specific instructions for:
Solana: https://solang.readthedocs.io/en/latest/targets/solana.html
Substrate: https://solang.readthedocs.io/en/latest/targets/substrate.html
Project Management and Issue Tracking
All Solang projects use GitHub for receiving issues, receiving pull requests and tracking releases. The links to the GitHub repos for the project are below.
Repositories
https://github.com/hyperledger/solang
https://github.com/hyperledger/homebrew-solang
Communication
Mailing List