Interact with EVM blockchains from the Internet Computer.
EVM RPC is an Internet Computer canister smart contract for communicating with Ethereum and other EVM blockchains using an on-chain API.
This canister facilitates API requests to JSON-RPC services such as CloudFlare, Alchemy, Ankr, or BlockPI using HTTPS outcalls. This enables functionality similar to traditional Ethereum dapps, including querying Ethereum smart contract states and submitting raw transactions.
Beyond the Ethereum blockchain, this canister also has partial support for Polygon, Avalanche, and other popular EVM networks. Check out ChainList.org for an extensive list of networks and RPC providers.
You can read more about the inner workings of the EVM RPC canister here.
You can find extensive documentation for the EVM RPC canister in the ICP developer docs.
The EVM RPC canister runs on the fiduciary subnet with the following principal: 7hfb6-caaaa-aaaar-qadga-cai.
Refer to the Reproducible Builds section for information on how to verify the hash of the deployed WebAssembly module.
Add the following to your icp.yaml config file:
canisters:
- name: evm_rpc
init_args: "(record {})"
build:
steps:
- type: pre-built
url: https://github.com/internet-computer-protocol/evm-rpc-canister/releases/latest/download/evm_rpc.wasm.gzRun the following commands to deploy the canister in your local environment:
# Start the local network
icp network start -d
# Locally deploy the `evm_rpc` canister
icp deploy evm_rpcTo call the canister already deployed on the IC mainnet, use the principal 7hfb6-caaaa-aaaar-qadga-cai directly — no local deployment required.
icp canister call 7hfb6-caaaa-aaaar-qadga-cai request '(variant {Chain=0x1},"{\"jsonrpc\":\"2.0\",\"method\":\"eth_gasPrice\",\"params\":[],\"id\":1}",1000)' --cycles 1000000000 --network icManaged local networks include a proxy canister that forwards calls with cycles attached. Retrieve its principal from icp network status:
PROXY=$(icp network status --json | jq -r .proxy_canister_principal)
# Use a custom provider
icp canister call evm_rpc request '(variant {Custom=record {url="https://cloudflare-eth.com"}},"{\"jsonrpc\":\"2.0\",\"method\":\"eth_gasPrice\",\"params\":[],\"id\":1}",1000)' --proxy "$PROXY" --cycles 1000000000
icp canister call evm_rpc request '(variant {Custom=record {url="https://ethereum.publicnode.com"}},"{\"jsonrpc\":\"2.0\",\"method\":\"eth_gasPrice\",\"params\":[],\"id\":1}",1000)' --proxy "$PROXY" --cycles 1000000000
# Use a specific EVM chain
icp canister call evm_rpc request '(variant {Chain=0x1},"{\"jsonrpc\":\"2.0\",\"method\":\"eth_gasPrice\",\"params\":[],\"id\":1}",1000)' --proxy "$PROXY" --cycles 1000000000The EVM RPC canister supports reproducible builds:
- Ensure Docker is installed on your machine.
- Run
scripts/docker-buildin your terminal. - Run
sha256sum evm_rpc.wasm.gzon the generated file to view the SHA-256 hash.
In order to verify the latest EVM RPC Wasm file, please make sure to download the corresponding version of the source code from the latest GitHub release.
Contributions are welcome! Please check out the contributor guidelines for more information.
Run the following commands to set up a local development environment:
# Clone the repository and install dependencies
git clone https://github.com/internet-computer-protocol/evm-rpc-canister
cd evm-rpc-canister
npm install
# `icp`, `ic-wasm`, and `mops` are installed as versioned devDependencies.
# Put them on PATH, or prefix invocations with `npx`.
export PATH="$PWD/node_modules/.bin:$PATH"
# Deploy to the local network
icp network start -d
npm run generate
icp deploy evm_rpc
# Alternatively, deploy and run test suite
icp network start -d
scripts/e2escripts/e2e and npm run generate:declarations also require didc on PATH.
Regenerate language bindings with the generate npm script:
npm run generateevm-rpc-canister-types: Rust types for interacting with the EVM RPC canister.ic-evm-utils: A convenience crate for interacting with the EVM RPC Canister from canisters written in Rust.- chain-fusion-starter: starter template leveraging chain fusion technology to build EVM coprocessors on the Internet Computer Protocol.
- Bitcoin canister: interact with the Bitcoin blockchain from the Internet Computer.
- ckETH: a canister-issued Ether twin token on the Internet Computer.
- ICP 🔗 ETH: a full-stack starter project for calling Ethereum smart contracts from an IC dapp.