Securing cross-chain communication from Ethereum to the Internet Computer with an on-chain Light Client

DFINITY
The Internet Computer Review
3 min readSep 19, 2023

--

Originally published at https://www.eiger.co.

The Internet Computer (ICP) continues to evolve with sights set on becoming a hub for decentralized applications and services in a multichain world. Chain-key signatures, which are unique to ICP, allow canister smart contracts to sign transactions, while HTTPS outcalls enable them to fetch state from other chains.

To increase the security of the latter for high-value applications, a team from Eiger has worked on porting an Ethereum light client to ICP.

What’s a Light Client and Helios?

A light client is a specialized piece of software that enables a blockchain node to interact with another blockchain without downloading and validating the entire blockchain’s history. Instead, it relies on cryptographic proofs and a limited subset of data to verify transactions and access relevant information. Light clients are designed to be efficient and fast, making them suitable for resource-constrained environments like the Internet Computer.

Helios, a nascent Ethereum light client implemented in Rust, is the centerpiece of this integration. It’s a software component that can be integrated into the canister smart contracts on the Internet Computer to enable interactions with the Ethereum blockchain. Helios leverages Merkle proofs and sync committees to efficiently verify Ethereum state and events, eliminating the need for complete blockchain validation. This lightweight approach aligns perfectly with the Internet Computer’s architecture and goals.

Why a Light Client on the ICP?

ICP aims for a native integration with the Ethereum network by running Ethereum nodes co-located with ICP nodes. However, in its current state, the integration is based on JSON-RPC calls to one or several RPC API providers like Infura or Alchemy. Adding an Ethereum light client increases the security of this integration because all data fetched from RPC providers gets cryptographically verified.

Experience from Porting Helios on the ICP

ICP provides a powerful WASM-based computing platform. This allows developers to write smart contracts in a variety of programming languages and makes it possible to port applications like Helios, which is implemented in Rust, without having to rewrite the application from scratch.

Still, porting Helios onto the ICP required several significant changes and optimizations to ensure its compatibility and efficiency. Some notable changes include:

  • Upgrading Helios to be compatible with the Rust stable toolchain.
  • Removing dependencies on browser-related WebAssembly (WASM) components.
  • Eliminating Tokio-related code that is incompatible with wasm.
  • Leveraging the ethers-core library and removing ethers-providers.
  • Replacing reqwest with HTTPS outcalls when targeting wasm.

These changes were made to adapt Helios to the ICP’s unique requirements, making it a suitable component for Ethereum canister on the Internet Computer.

How to Use It?

To use the Ethereum canister on the ICP for accessing Ethereum blockchain data, you can follow these steps:

Running and using the Ethereum canister:

dfx start --clean --background --artificial-delay 100
# deploy
dfx deploy
# start it
dfx canister call ethereum_canister setup 'record {
network = variant { Mainnet };
execution_rpc_url = "https://ethereum.publicnode.com";
consensus_rpc_url = "https://www.lightclientdata.org";
}'
# utilize it
dfx canister call ethereum_canister erc20_balance_of 'record {
contract = "0xdAC17F958D2ee523a2206206994597C13D831ec7";
account = "0xF977814e90dA44bFA03b6295A0616a897441aceC";
}'
(2_100_000_000_000_000 : nat) # canister's output‍

Running end-to-end canister tests:

dfx start --clean --background --artificial-delay 100

cargo test --target x86_64-unknown-linux-gnu
# or using nextest
cargo nextest run --target x86_64-unknown-linux-gnu

Our goal is for the Ethereum canister to provide a comprehensive API for interacting with Ethereum data, so you can refer to the API definition in the candid.did file for more details on available functions and their usage.

Summary

The implementation of an Ethereum light client, specifically Helios, on the Internet Computer aims to enhance decentralized applications and services by allowing canisters, apps, services, and smart contracts to independently access Ethereum data, ensuring secure data retrieval from Ethereum. It also showcases the unique capabilities of the Internet Computer and its powerful computing environment which allows running applications incomparable to those of other decentralized platforms.

You can locate the project on our GitHub repository.

Originally published at https://www.eiger.co.

--

--

DFINITY
The Internet Computer Review

The Internet Computer is a revolutionary blockchain that hosts unlimited data and computation on-chain. Build scalable Web3 dapps, DeFi, games, and more.