Skip to main content

Overview

The Eco Routes Protocol is designed to support both EVM chains (Ethereum, Polygon, Arbitrum, etc.) and non-EVM chains (Solana, Sui, etc.) through a flexible type system and modular architecture.

Dual-Type System

The protocol supports two parallel type systems to accommodate different blockchain architectures:

EVM Intent Types

Optimized for Ethereum Virtual Machine chains using native address types (20 bytes):
contracts/types/Intent.sol
Benefits:
  • Familiar to Solidity developers
  • Gas-efficient on EVM chains
  • Native tooling support
  • Type safety for EVM addresses

Universal Intent Types

Designed for cross-VM compatibility using bytes32 for address identifiers:
Benefits:
  • Compatible with non-EVM chains (Solana, Sui, etc.)
  • Unified cross-chain addressing
  • Future-proof for new blockchain architectures
  • Same struct names simplify integration

bytes32 vs address Types

Technical Design

The dual-type approach leverages EVM’s ABI encoding:
Key insight: The bytes32 type can represent both:
  • EVM addresses (with zero-padding)
  • Non-EVM identifiers (using full 32 bytes)
This allows both type systems to be interchangeable at the binary level.

Claimant Identifiers

The protocol uses bytes32 for claimant identifiers to support cross-VM reward distribution:
contracts/Inbox.sol
On fulfillment:
  • EVM solver: Converts their address to bytes32
  • Non-EVM solver: Provides their native identifier as bytes32
On withdrawal:
  • Prover converts bytes32 claimant back to the appropriate address type
  • Rewards distributed using the native address format

Type Conversion

The protocol includes the AddressConverter library for converting between types:
contracts/libs/AddressConverter.sol
Usage example:
When converting from bytes32 to address, the upper 12 bytes must be zero for valid EVM addresses. The conversion extracts only the lower 20 bytes.

Modular Contract Structure

The protocol uses inheritance to separate EVM-specific and universal functionality:

Source Chain (IntentSource)

EVM-specific operations:
contracts/IntentSource.sol
Universal format support:
contracts/IntentSource.sol
  • Accepts route as bytes for cross-VM compatibility
  • Computes hash from encoded bytes: keccak256(route)
  • Allows non-EVM chains to create intents via encoding

Destination Chain (Inbox)

Universal fulfillment:
contracts/Inbox.sol
Claimant storage:
contracts/Inbox.sol
Stores claimant as bytes32, enabling:
  • EVM addresses (converted to bytes32)
  • Solana public keys (native bytes32)
  • Any other 32-byte identifier

Cross-Chain Prover Support

Provers handle the conversion between universal and EVM-specific types:
Prover responsibility:
  1. Receive bytes32 claimant from destination chain
  2. Convert to address for EVM source chain storage
  3. Store proof with converted address
  4. Enable withdrawal to EVM address
Conversion in withdraw:
contracts/IntentSource.sol
Provers act as the bridge between universal bytes32 identifiers on destination chains and EVM address types on source chains.

Integration Guidelines

For EVM-Only Applications

If your application only interacts with EVM chains:

For Cross-VM Applications

If your application needs to support non-EVM chains:
As a solver on Solana:

Chain ID Considerations

The protocol uses uint64 for chain IDs to support both EVM and non-EVM chains:
contracts/Inbox.sol
Examples:
  • Ethereum Mainnet: 1
  • Polygon: 137
  • Arbitrum One: 42161
  • Solana Mainnet: 1399811149
  • Sui Mainnet: 101
The destination chain ID must fit within a uint64. Most major chains, including Solana and Sui, use chain IDs that fit within this range.

CREATE2 Prefix Support

The protocol adapts to different CREATE2 implementations:
contracts/IntentSource.sol
Vault address calculation:
This ensures deterministic vault addresses across different EVM implementations:
  • Standard EVM (Ethereum, Polygon, etc.): 0xff prefix
  • TRON: 0x41 prefix

Best Practices

Recommendations for protocol integrators:
  1. Use the universal types (bytes32-based) for core protocol interactions if you need cross-VM support
  2. Use EVM-specific types for user-facing interfaces on EVM chains
  3. Convert at the boundaries of your application using AddressConverter
  4. Test conversions thoroughly, especially bytes32 ↔ address transformations
  5. Document which format your interface expects (EVM address vs. bytes32 identifier)
  6. Validate identifiers before conversion to avoid truncation errors
Remember: Reward claiming is always EVM-specific on the source chain, even if the intent was fulfilled on a non-EVM destination chain. Provers must convert universal identifiers to EVM addresses.