Skip to main content

Prerequisites

Before you begin working with Eco Routes Protocol, ensure you have the required tools installed.
1

Install Node.js

Install Node Version Manager (nvm) and Node.js v18.20.3:
# Install nvm (Node Version Manager)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash

# Install and use Node.js v18.20.3
nvm install v18.20.3
nvm use v18.20.3
Verify the installation:
node --version
# Should output: v18.20.3
2

Install Package Manager

Install Yarn package manager:
npm install -g yarn@1.22.19
Verify the installation:
yarn --version
# Should output: 1.22.19
3

Install Development Tools

Install Foundry for smart contract development (recommended):
# Install Foundry
curl -L https://foundry.paradigm.xyz | bash

# Update to latest version
foundryup
Alternatively, you can use Hardhat:
npm install -g hardhat
Foundry is recommended for the best development experience with Eco Routes, but Hardhat is also fully supported.

Project Setup

Once you have the prerequisites installed, set up the Eco Routes Protocol project.
1

Clone the Repository

Clone the Eco Routes repository and navigate to the project directory:
git clone https://github.com/eco/eco-routes.git
cd eco-routes
2

Install Dependencies

Install all project dependencies using Yarn:
yarn install
This will install all required packages including OpenZeppelin contracts, Hyperlane libraries, and testing frameworks.
3

Build the Project

Compile all smart contracts:
yarn build
A successful build indicates your environment is properly configured.
4

Run Tests

Verify everything is working by running the test suite:
yarn test
All tests should pass, confirming your setup is complete.

Environment Configuration

For deployment and testing on live networks, configure your environment variables.
1

Create .env File

Copy the example environment file:
cp .env.example .env
2

Configure RPC Endpoints

Add your RPC endpoints to the .env file:
.env
# RPC endpoints
MAINNET_RPC_URL=https://eth-mainnet.g.alchemy.com/v2/YOUR_API_KEY
TESTNET_RPC_URL=https://eth-sepolia.g.alchemy.com/v2/YOUR_API_KEY
Never commit your .env file to version control. It’s already included in .gitignore.
3

Add Private Keys

Add your deployer private key for contract deployment:
.env
# Private keys (without 0x prefix)
DEPLOYER_PRIVATE_KEY=your_private_key_here
Use a dedicated deployment wallet. Never use your main wallet’s private key.
4

Add API Keys for Verification

Add Etherscan API keys for contract verification:
.env
# Etherscan API keys for verification
ETHERSCAN_API_KEY=your_etherscan_api_key

Development Commands

Common commands for working with Eco Routes Protocol.

Building

# Build all contracts
yarn build

# Build with Foundry
forge build

# Build with Hardhat
npx hardhat compile

Testing

# Run all tests
yarn test

# Run Foundry tests
forge test

# Run with coverage
yarn coverage

# Run specific test file
forge test --match-contract IntentSourceTest

# Run with detailed output
forge test -vvv

# Run specific test function
forge test --match-test testPublishAndFund

Code Quality

# Format code
yarn format

# Run linting
yarn lint

# Run all quality checks
yarn lint && yarn test

Local Development

For local testing and development, you can deploy contracts to a local chain.
# Start local development chain (in a separate terminal)
anvil

# Deploy contracts locally
forge script script/Deploy.s.sol --broadcast --rpc-url localhost

# Run tests against deployed contracts
forge test --rpc-url localhost

Next Steps

Creating Intents

Learn how to create and publish cross-chain intents

Fulfilling Intents

Become a solver and fulfill intents for rewards

ERC-7683 Integration

Use the standard ERC-7683 interface

Proving Intents

Understand cross-chain proof validation

Build docs developers (and LLMs) love