Skip to content

paritytech/revive

CI Docs

revive

Yul recompiler to LLVM, targetting RISC-V on PolkaVM.

Check the docs or visit contracts.polkadot.io to learn more about revive and contracts on Polkadot!

Status

This is experimental software in active development and not ready just yet for production usage. Please do report any compiler related issues or missing features that are not yet known to us here.

Discussion around the development is hosted on the Polkadot Forum.

Installation

Building Solidity contracts for PolkaVM requires installing the following two compilers:

resolc binary releases

resolc is distributed as a standalone binary (with solc as the only external dependency). Please download one of our binary releases for your target platform and mind the platform specific instructions below.

MacOS users

MacOS users need to clear the downloaded attribute from the binary and set the executable flag.

xattr -rc resolc-universal-apple-darwin
chmod +x resolc-universal-apple-darwin
Linux users

Linux users need to set the executable flag.

chmod +x resolc-x86_64-unknown-linux-musl

resolc NPM package

We distribute the revive compiler as node.js module and hardhat plugin.

Note: The solc dependency is bundled via NPM packaging and defaults to the latest supported version.

Building from source

Building revive requires a stable Rust installation and a C++ toolchain for building LLVM on your system.

LLVM

revive depends on a custom build of LLVM v18.1.8 with the RISC-V embedded target, including the compiler-rt builtins. You can either download a build from our releases (recommended for older hardware) or build it from source.

Download from our LLVM releases

Download the latest LLVM build from our releases.

MacOS users need to clear the downloaded attribute from all binaries after extracting the archive:

xattr -rc </path/to/the/extracted/archive>/target-llvm/gnu/target-final/bin/*

After extracting the archive, point $LLVM_SYS_181_PREFIX to it:

export LLVM_SYS_181_PREFIX=</path/to/the/extracted/archive>/target-llvm/gnu/target-final
Building from source

The Makefile provides a shortcut target to obtain a compatible LLVM build, using the provided revive-llvm utility. Once installed, point $LLVM_SYS_181_PREFIX to the installation afterwards:

make install-llvm
export LLVM_SYS_181_PREFIX=${PWD}/target-llvm/gnu/target-final

The resolc Solidity frontend

To build the resolc Solidity frontend executable, make sure you have obtained a compatible LLVM build and did export the LLVM_SYS_181_PREFIX environment variable pointing to it (see above).

To install the resolc Solidity frontend executable:

make install-bin
resolc --version

Development

Please consult the Developer Guide to learn more about how contribute to the project.

Acknowledgements

The revive compiler project, after some early experiments with EVM bytecode translations, decided to fork the era-compiler framework. Frontend, code generator and some supporting libraries are based of ZKSync zksolc. I'd like to express my gratitude and thank the original authors for providing a useable code base under a generous license.

About

Solidity compiler for Polkadot, targetting PolkaVM in pallet-revive

Topics

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 15