Skip to main content
Local deployment allows you to test the Eco Routes Protocol in a controlled environment before deploying to testnets or mainnet.

Prerequisites

Required Tools

1

Install Node.js

2

Install Yarn

3

Install Foundry

Clone and Setup

Local Environment Setup

Start Local Chain

Start a local Ethereum node using Anvil (part of Foundry):
Anvil will output:
  • Available accounts with private keys
  • Chain ID
  • RPC endpoint (default: http://127.0.0.1:8545)

Configure Environment

Create a .env file for local deployment:
.env

Deployment Methods

Method 1: Direct Forge Script

Deploy using Foundry’s forge script directly:

Method 2: Using Deployment Script

For multi-chain local testing (e.g., two Anvil instances):

Method 3: Minimal Portal-Only Deployment

Deploy only the Portal contract for basic testing:

Verify Deployment

Check Deployed Contracts

After deployment, verify the contracts were deployed:
Expected output:

Interact with Deployed Contracts

Use cast to interact with deployed contracts:

Testing Against Local Deployment

Run Integration Tests

Run tests against the deployed contracts:

Manual Testing Workflow

1

Deploy Contracts

Deploy the protocol contracts to your local Anvil instance.
2

Fund Test Accounts

Anvil provides pre-funded accounts. Use these for testing intents.
3

Create Intent

Use cast or scripts to create a test intent on the Portal.
4

Fund Intent

Fund the intent with reward tokens.
5

Fulfill Intent

Execute the intent fulfillment from a solver account.
6

Verify State

Check contract state to verify the intent lifecycle.

Development Workflow

Iterative Development

For rapid development iteration:

Reset Local State

To start fresh:

Common Issues

Port Already in Use

If port 8545 is already in use:

Nonce Too High Error

If you get nonce errors after restarting Anvil:
  • This happens because Anvil resets but your deployment script remembers the old nonce
  • Restart Anvil to reset the blockchain state
  • Or use --reset flag when running forge script

Gas Estimation Failed

If deployment fails with gas estimation errors:

Next Steps

Run Tests

Run the test suite against your local deployment

Testnet Deployment

Deploy to public testnets after local testing