https://github.com/paritytech/revive
Solidity compiler for Polkadot, targetting PolkaVM in pallet-revive
https://github.com/paritytech/revive
blockchain compiler polkadot-sdk solidity
Last synced: 5 days ago
JSON representation
Solidity compiler for Polkadot, targetting PolkaVM in pallet-revive
- Host: GitHub
- URL: https://github.com/paritytech/revive
- Owner: paritytech
- License: apache-2.0
- Created: 2023-12-07T19:36:37.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2026-02-04T02:25:09.000Z (7 days ago)
- Last Synced: 2026-02-04T05:41:33.628Z (7 days ago)
- Topics: blockchain, compiler, polkadot-sdk, solidity
- Language: Rust
- Homepage: https://paritytech.github.io/revive/
- Size: 25.4 MB
- Stars: 96
- Watchers: 3
- Forks: 24
- Open Issues: 27
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE-APACHE
- Security: SECURITY.md
- Roadmap: docs/roadmap.html
Awesome Lists containing this project
- awesome-compilers - revive - Solidity compiler and YUL recompiler to LLVM, targetting RISC-V on PolkaVM. (Solidity / Other dialects and variants)
README

[](https://paritytech.github.io/revive/)
# revive
Yul recompiler to LLVM, targetting RISC-V on [PolkaVM](https://github.com/koute/polkavm).
Check the [docs](https://paritytech.github.io/revive/) or visit [contracts.polkadot.io](https://docs.polkadot.com/develop/smart-contracts/) to learn more about `revive` and contracts on Polkadot!
Discussion around the development is hosted on the [Polkadot Forum](https://forum.polkadot.network/t/contracts-update-solidity-on-polkavm/6949#a-new-solidity-compiler-1).
> [!WARNING]
>
> Solidity on PVM is running on the `pallet-revive` runtime. This introduces **observable semantic differences** in comparison with the EVM.
>
> Study the [differences](https://paritytech.github.io/revive/user_guide/differences.html) section carefully. **Ignoring these differences may lead to defunct contracts.**
>
> Notable examples:
> - The 63/64 gas rule isn't implemented in the pallet (introduces potential DoS vector when calling other contracts)
> - Contract instantiation works differently (by hash instead of by code)
> - The gas model implemented by `pallet-revive` differs from Ethereum
> - The heap size is fixed instead of gas-metered and there's a fixed amount of stack size (contracts working fine on EVM may trap on PVM)
## Installation
Building Solidity contracts for PolkaVM requires installing the following two compilers:
- `resolc`: The revive Solidity compiler Yul frontend and PolkaVM code generator (provided by this repository).
- `solc`: The [Ethereum Solidity reference compiler](https://github.com/ethereum/solidity/) implemenation.`resolc` uses `solc` during the compilation process, please refer to the [Ethereum Solidity documentation](https://docs.soliditylang.org/en/latest/installing-solidity.html) for installation instructions.
### `resolc` binary releases
`resolc` is distributed as a standalone binary (with `solc` as the only external dependency). Please download one of our [binary releases](https://github.com/paritytech/revive/releases) for your target platform and mind the platform specific instructions below. We also provide [nightly builds](https://paritytech.github.io/resolc-bin/#nightly).
MacOS users
> **MacOS** users need to clear the `downloaded` attribute from the binary and set the executable flag.
> ```sh
> xattr -rc resolc-universal-apple-darwin
> chmod +x resolc-universal-apple-darwin
> ```
Linux users
> **Linux** users need to set the executable flag.
> ```sh
> chmod +x resolc-x86_64-unknown-linux-musl
> ```
### `resolc` NPM package
We distribute the revive compiler as [node.js module](https://www.npmjs.com/package/@parity/resolc) and [hardhat plugin](https://www.npmjs.com/package/@parity/hardhat-polkadot-resolc).
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](https://rustup.rs/) and a C++ toolchain for building [LLVM](https://github.com/llvm/llvm-project) 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](https://github.com/paritytech/revive/releases?q=LLVM+binaries+release&expanded=true) from our releases.
> **MacOS** users need to clear the `downloaded` attribute from all binaries after extracting the archive:
> ```sh
> xattr -rc /target-llvm/gnu/target-final/bin/*
> ```
After extracting the archive, point `$LLVM_SYS_181_PREFIX` to it:
```sh
export LLVM_SYS_181_PREFIX=/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](crates/llvm-builder/README.md) utility. Once installed, point `$LLVM_SYS_181_PREFIX` to the installation afterwards:
```sh
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](#LLVM)).
To install the `resolc` Solidity frontend executable:
```sh
make install-bin
resolc --version
```
## Development
Please consult the [Developer Guide](https://paritytech.github.io/revive/developer_guide/contributing.html) 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](https://github.com/matter-labs/era-compiler-solidity), [code generator](https://github.com/matter-labs/era-compiler-llvm-context) 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.