eil-rs
It is a rewrite of the eil-sdk(typescript) in rust to enable use of the EIL in rust programs.
Problem Statement
EIL Rust SDKA type-safe Rust implementation of the Ethereum Interoperability Layer (EIL) SDK for trustless cross-chain operations on Ethereum L2s.OverviewThe 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 operationsSingle-Signature Cross-Chain Operations: Sign once, execute across multiple L2sType-Safe Builder Pattern: Compile-time prevention of invalid operationsCross-Chain Gas Payment: XLPs (Cross-chain Liquidity Providers) front gas on destination chainsRuntime Variables: Dynamic on-chain value computation for complex workflows
Solution
This project is a Rust implementation of the Ethereum Interoperability Layer (EIL) SDK, originally written in TypeScript. The development process involved:Reference Analysis PhaseThe 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 pointpackages/sdk/src/CrossChainBuilder.ts - Builder pattern implementationpackages/sdk/src/BatchBuilder.ts - Batch construction logicpackages/sdk/src/Actions/ - Action system (Transfer, Approve, FunctionCall, etc.)packages/sdk/src/voucher/ - Voucher coordination systempackages/accounts/src/MultiChainSmartAccount.ts - Account abstractionThe 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 TranslationThe 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 Selectionalloy (v0.8): Ethereum primitives, ABI encoding, RPC providers - chosen as the modern Rust successor to ethers-rstokio: Async runtime matching TypeScript's Promise-based async/awaitserde: JSON serialization matching TypeScript's native JSON supportthiserror: Structured error types replacing JavaScript Error classes
Hackathon
ETHGlobal Buenos Aires
2025
Contributors
- meetmangukiya
1 contributions