eil-rs

It is a rewrite of the eil-sdk(typescript) in rust to enable use of the EIL in rust programs.

eil-rs

Created At

ETHGlobal Buenos Aires

Project Description

EIL Rust SDK

A type-safe Rust implementation of the Ethereum Interoperability Layer (EIL) SDK for trustless cross-chain operations on Ethereum L2s.

Overview

The EIL SDK enables users to execute complex multi-chain operations with a single signature, abstracting away the complexity of L2 fragmentation. Built with Rust's strong type system and zero-cost abstractions, this SDK provides:

  • Trustless Interoperability: No third-party trust required for cross-chain operations
  • Single-Signature Cross-Chain Operations: Sign once, execute across multiple L2s
  • Type-Safe Builder Pattern: Compile-time prevention of invalid operations
  • Cross-Chain Gas Payment: XLPs (Cross-chain Liquidity Providers) front gas on destination chains
  • Runtime Variables: Dynamic on-chain value computation for complex workflows

How it's Made

This project is a Rust implementation of the Ethereum Interoperability Layer (EIL) SDK, originally written in TypeScript. The development process involved:

Reference Analysis Phase

The TypeScript reference implementation was thoroughly analyzed from the /home/dmnt/dev/fr/open-source/eil-sdk/ repository. Key files studied included:

  • packages/sdk/src/CrossChainSdk.ts - Main SDK entry point
  • packages/sdk/src/CrossChainBuilder.ts - Builder pattern implementation
  • packages/sdk/src/BatchBuilder.ts - Batch construction logic
  • packages/sdk/src/Actions/ - Action system (Transfer, Approve, FunctionCall, etc.)
  • packages/sdk/src/voucher/ - Voucher coordination system
  • packages/accounts/src/MultiChainSmartAccount.ts - Account abstraction

The TypeScript codebase provided the architectural blueprint: builder pattern for constructing multi-chain operations, voucher system for cross-chain token transfers via XLPs, ERC-4337 account abstraction for UserOperations, and action-based transaction encoding.

Architecture Translation

The Rust implementation maintains feature parity while leveraging Rust's type system for enhanced safety:

Type-State Pattern: The TypeScript builder's runtime state checks were replaced with compile-time type-states (Building → ReadyToBuild → Signed), preventing invalid operation sequences at compile time.

Trait-Based Abstractions: TypeScript interfaces became Rust traits (Action, MultiChainSmartAccount, SourcePaymaster), using async-trait for async methods and trait objects for runtime polymorphism.

Error Handling: JavaScript exceptions became typed Result<T, EilError> using thiserror, providing exhaustive error handling.

Technical Stack Selection

  • alloy (v0.8): Ethereum primitives, ABI encoding, RPC providers - chosen as the modern Rust successor to ethers-rs
  • tokio: Async runtime matching TypeScript's Promise-based async/await
  • serde: JSON serialization matching TypeScript's native JSON support
  • thiserror: Structured error types replacing JavaScript Error classes
background image mobile

Join the mailing list

Get the latest news and updates