Architecture Overview
The Ethereum integration leverages the IC’s HTTP outcalls feature to communicate with Ethereum JSON-RPC providers:- EVM RPC Canister: Provides reliable Ethereum JSON-RPC access via multiple providers
- Chain-Key ECDSA: Enables canisters to sign Ethereum transactions
- ckETH Minter: Converts ETH to ckETH and vice versa
- Ledger Suite Orchestrator: Manages ckERC20 token ledgers
EVM RPC Integration
The Ethereum integration uses HTTPS outcalls to query multiple JSON-RPC providers, achieving decentralization without running full Ethereum nodes.
Key Capabilities
Smart Contract Calls
Query and call Ethereum smart contracts
Block Data
Fetch blocks, transactions, and receipts
Event Logs
Scrape and process Ethereum event logs
Transaction Submission
Submit signed transactions to the network
RPC Provider Configuration
The EVM RPC canister aggregates responses from multiple providers:- Query Ethereum block heights
- Fetch event logs from helper contracts
- Estimate gas fees for transactions
- Submit signed withdrawal transactions
Chain-Key ECDSA for Ethereum
Canisters can control Ethereum addresses through chain-key ECDSA signatures.ECDSA Key Management
Signing Ethereum Transactions
Canisters can sign EIP-1559 transactions:EIP-1559 Transaction Fields
EIP-1559 Transaction Fields
- chain_id: Ethereum network identifier (1 for mainnet, 11155111 for Sepolia)
- nonce: Transaction sequence number for the sender
- max_priority_fee_per_gas: Tip paid to miners (priority fee)
- max_fee_per_gas: Maximum total fee willing to pay per gas
- gas_limit: Maximum gas units the transaction can consume
- to: Destination Ethereum address
- value: Amount of ETH to transfer (in wei)
- data: Contract call data or empty for simple transfers
Ethereum Network Support
Supported Networks
| Network | Chain ID | Purpose |
|---|---|---|
| Mainnet | 1 | Production Ethereum transactions |
| Sepolia | 11155111 | Testing with Sepolia testnet ETH |
Sepolia replaced Goerli as the primary Ethereum testnet. Use Sepolia for testing ckETH integration.
Helper Smart Contracts
The Ethereum integration uses helper smart contracts to facilitate deposits and event tracking.ETH Helper Contract
The helper contract emits events when users deposit ETH:Contract Addresses
- Mainnet
- Sepolia
ETH Helper Contract:
0x18901044688D3756C35Ed2b36D93e6a5B8e00E68View on EtherscanEvent Log Scraping
The ckETH minter continuously scrapes Ethereum event logs to detect deposits.Scraping Configuration
Log Processing Flow
Event Log Structure
The helper contract emits structured events:Gas Fee Estimation
The minter estimates gas fees for Ethereum transactions using EIP-1559 pricing.Fee Structure
The minter queries multiple RPC providers to get reliable gas fee estimates and uses conservative values to ensure transaction inclusion.
Gas Limit by Operation
| Operation | Typical Gas Limit |
|---|---|
| ETH Transfer | 21,000 |
| ERC-20 Transfer | ~65,000 |
| Contract Interaction | Variable |
| Helper Contract Deposit | ~33,000 |
Transaction Management
The minter manages Ethereum transaction lifecycle:Transaction States
Nonce Management
- Maintains sequential nonce for all outgoing transactions
- Handles nonce gaps through transaction resubmission
- Supports manual nonce override via upgrade args
Block Height Tracking
Block Tags
Block Tag Selection
Block Tag Selection
- Latest: Most recent block, may be reorganized
- Safe: Safe from short-term reorganizations (recommended)
- Finalized: Fully finalized, safest but may lag behind
Security Considerations
Event Validation
- Verify event source (helper contract address)
- Validate principal and subaccount format
- Check minimum deposit amounts
- Confirm transaction finality before minting
Transaction Security
- All transactions signed via threshold ECDSA
- Gas price limits to prevent overpaying
- Transaction replay protection via nonces
- Failed transaction reimbursement
RPC Provider Security
- Query multiple providers for consensus
- Detect and handle inconsistent responses
- Automatic fallback to alternative providers
- Rate limiting and retry logic
Performance Optimizations
Parallel Processing
The minter processes deposits and withdrawals in parallel:Caching Strategy
- Cache recent block data to reduce RPC calls
- Store processed event logs to avoid reprocessing
- Maintain gas fee estimates between updates
Related Components
ckETH Minter
Chain-key Ethereum token implementation
ckBTC Minter
Chain-key Bitcoin token implementation
Source Code Reference
Key files in the Ethereum integration:rs/ethereum/cketh/minter/src/lib.rs- Main minter constants and modulesrs/ethereum/cketh/minter/src/eth_rpc.rs- Ethereum RPC abstractionsrs/ethereum/cketh/minter/src/eth_rpc_client.rs- RPC client implementationrs/ethereum/cketh/minter/src/eth_logs/- Event log parsingrs/ethereum/cketh/minter/src/deposit.rs- Deposit processingrs/ethereum/cketh/minter/src/withdraw.rs- Withdrawal handlingrs/ethereum/cketh/minter/src/tx.rs- Transaction management