{"name":"r55: Integrating RISC-V Smart Contracts with EVM on Ethereum","description":"R55 is an experimental Ethereum Execution Environment designed to seamlessly integrate RISC-V smart contracts alongside traditional EVM smart contracts. This innovative approach allows for dual support over the same Ethereum state, enabling pure Rust smart contracts and opening the Ethereum development space to a vast Rust developer community. It leverages standard tooling like Rust, Cargo, and LLVM, simplifying development and integration.","github":"https://github.com/r55-eth/r55","url":"https://osrepos.com/repo/r55-eth-r55","source":"osrepos.com","sourceDescription":"This repository profile is provided by osrepos.com, an open source repository discovery platform.","repositoryProfile":"https://osrepos.com/repo/r55-eth-r55","generatedFor":"open source discovery and AI-assisted research","markdown":"https://osrepos.com/repo/r55-eth-r55.md","json":"https://osrepos.com/repo/r55-eth-r55.json","topics":["Rust","Ethereum","Smart Contracts","RISC-V","EVM","Blockchain","Web3","Development"],"keywords":["Rust","Ethereum","Smart Contracts","RISC-V","EVM","Blockchain","Web3","Development"],"stars":null,"summary":"R55 is an experimental Ethereum Execution Environment designed to seamlessly integrate RISC-V smart contracts alongside traditional EVM smart contracts. This innovative approach allows for dual support over the same Ethereum state, enabling pure Rust smart contracts and opening the Ethereum development space to a vast Rust developer community. It leverages standard tooling like Rust, Cargo, and LLVM, simplifying development and integration.","content":"## Introduction\n\nR55 is an experimental Ethereum Execution Environment that seamlessly integrates RISC-V smart contracts alongside traditional EVM smart contracts. This dual support operates over the same Ethereum state, allowing communication via ABI-encoded calls. On a high level, R55 enables the use of pure Rust smart contracts, opening the door for a vast Rust developer community to engage in Ethereum development with minimal barriers to entry and increasing language and compiler diversity. On a low level, RISC-V code allows for optimization opportunities distinct from the EVM, including the use of off-the-shelf ASICs, which can be particularly advantageous in specialized domains.\n\nR55 relies on standard tooling that programmers are accustomed to, such as Rust, Cargo, and LLVM. This directly enables existing tooling like linters, static analyzers, testing, fuzzing, and formal verification tools to be applied to these smart contracts without extra development and research.\n\n## Installation\n\nTo get started with R55, you'll need to install some prerequisites.\n\n### macOS\n\nshell\nbrew tap riscv-software-src/riscv\nbrew install riscv-gnu-toolchain gettext\n\n\nYou'll also need to install Rust's RISC-V toolchain:\n\nconsole\n$ rustup install nightly-2024-02-01-x86_64-unknown-linux-gnu\n\n\n## Examples\n\nR55 allows for pure and clean Rust smart contracts, enabling users to code in `no_std` Rust. The `#[contract]` macro is the only special treatment required, handling init code and function dispatching. Rust `pub` methods are exposed as public functions in the deployed contract, similar to Solidity's `public` functions.\n\nHere's an example of a basic ERC20 token implementation:\n\nrust\n#![no_std]\n#![no_main]\n\nuse core::default::Default;\n\nuse contract_derive::contract;\nuse eth_riscv_runtime::types::Mapping;\n\nuse alloy_core::primitives::Address;\n\n#[derive(Default)]\npub struct ERC20 {\n    balance: Mapping<Address, u64>,\n}\n\n#[contract]\nimpl ERC20 {\n    pub fn balance_of(&self, owner: Address) -> u64 {\n        self.balance.read(owner)\n    }\n\n    pub fn transfer(&self, from: Address, to: Address, value: u64) {\n        let from_balance = self.balance.read(from);\n        let to_balance = self.balance.read(to);\n\n        if from == to || from_balance < value {\n            revert();\n        }\n\n        self.balance.write(from, from_balance - value);\n        self.balance.write(to, to_balance + value);\n    }\n\n    pub fn mint(&self, to: Address, value: u64) {\n        let to_balance = self.balance.read(to);\n        self.balance.write(to, to_balance + value);\n    }\n}\n\n\nYou can run the end-to-end test to see R55 in action, compiling and deploying the ERC20 contract to an internal `revm-r55` instance:\n\nconsole\n$ cargo test --package r55 --test e2e -- erc20 --exact --show-output\n\n\n## Why use R55?\n\nR55 offers several compelling reasons for adoption:\n\n*   **Pure Rust Smart Contracts**: Develop smart contracts using `no_std` Rust, leveraging the language's safety and performance features.\n*   **Standard Tooling**: Integrate seamlessly with existing Rust, Cargo, and LLVM tools, reducing the learning curve and enabling robust development practices.\n*   **RISC-V Optimization**: Explore new optimization opportunities distinct from the EVM, including the potential use of off-the-shelf ASICs for specialized tasks.\n*   **EVM Compatibility**: Maintain compatibility with the existing Ethereum state and EVM smart contracts, ensuring a smooth transition and interoperability.\n*   **Client Integration**: R55 is a fork of [revm](https://github.com/bluealloy/revm){:target=\"_blank\"} without API changes, allowing seamless integration into clients like Anvil/Reth for testnet/network deployment with RISC-V support.\n\n## Links\n\nFor more information and related projects, check out these links:\n\n*   [r55 GitHub Repository](https://github.com/r55-eth/r55){:target=\"_blank\"}\n*   [revm-R55](https://github.com/r0qs/revm){:target=\"_blank\"}\n*   [rvemu-R55](https://github.com/r55-eth/rvemu){:target=\"_blank\"}\n*   [R55 Ethereum Runtime](https://github.com/r55-eth/r55/tree/main/eth-riscv-runtime){:target=\"_blank\"}\n*   [R55 Compiler](https://github.com/r55-eth/r55/tree/main/r55){:target=\"_blank\"}","metrics":{"detailViews":5,"githubClicks":13},"dates":{"published":null,"modified":"2025-10-30T20:01:35.000Z"}}