Skip to content

Solidity compiler for ZKsync.

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

matter-labs/era-compiler-solidity

ZKsync Era: Solidity Compiler Toolchain

Logo

ZKsync Era is a Layer 2 rollup that uses zero-knowledge proofs to scale Ethereum without compromising on security or decentralization. As it is EVM-compatible (with Solidity/Vyper), the majority of Ethereum projects can be redeployed without refactoring and re-auditing. ZKsync Era uses an LLVM-based compiler toolchain that allows developers to design, implement, and optimize efficient language-specific features while benefiting from the extensive LLVM ecosystem.

This repository contains the ZKsync Compiler Toolchain for Solidity and Yul.

Installation

To install the zksolc compiler, follow the installation guide.

For local development, build zksolc from sources.

Usage

For the detailed usage guide, see the comprehensive documentation.

Testing

To run the unit and CLI tests, execute the following command from the repository root:

cargo test

Documentation

Documentation is using mdBook utility and is available in the docs/ directory. To build the documentation, follow the instructions.

Troubleshooting

If you have multiple LLVM builds in your system, ensure that you choose the correct one to build the compiler. The environment variable LLVM_SYS_170_PREFIX sets the path to the directory with LLVM build artifacts, which typically ends with target-llvm/build-final. For example:

export LLVM_SYS_170_PREFIX=~/repositories/era-llvm/target-llvm/build-final 

If you suspect that the compiler is not using the correct LLVM build, check by running set | grep LLVM, and reset all LLVM-related environment variables.

For reference, see llvm-sys and Local LLVM Configuration Guide.

License

The Solidity compiler is distributed under the terms of either

at your option.

Resources

Official Links

Disclaimer

ZKsync Era has been through extensive testing and audits, and although it is live, it is still in alpha state and will undergo further audits and bug bounty programs. We would love to hear our community's thoughts and suggestions about it! It's important to note that forking it now could potentially lead to missing important security updates, critical features, and performance improvements.