This tutorial walks through moving stablecoins from one blockchain to another using the Eco Routes CLI. By the end, you'll have published a cross-chain intent and tracked its fulfillment.
We'll move USDC from Optimism to Base. The same pattern works for any supported chain pair and any supported stablecoin (USDT, USDT0, USDG, USDC.e, and others).
Prerequisites
Step 1: Install the CLI
Clone the Routes CLI repo and build it:
git clone https://github.com/eco/routes-cli.git
cd routes-cli
pnpm install
pnpm build
Optionally, run pnpm link to make the CLI available globally as eco-routes-cli.
Step 2: Configure your environment
Copy the example environment file and add your private keys:
cp .env.example .env
Edit .env with your keys. You only need the key type for the chains you're using:
# Required for EVM chains (Ethereum, Optimism, Base, Arbitrum, Polygon, etc.) EVM_PRIVATE_KEY=0x...
# Required for Solana SVM_PRIVATE_KEY=...
# Optional: custom RPC endpoints
EVM_RPC_URL=https://eth-mainnet.g.alchemy.com/v2/...
SVM_RPC_URL=https://api.mainnet-beta.solana.com
Never commit your .env file. Add it to .gitignore.
Step 3: Check supported chains and tokens
Before publishing, confirm your source and destination chains are supported:
# List all supported chains pnpm dev chains
# List available tokens pnpm dev tokens
Eco Routes supports 14+ chains including Ethereum, Optimism, Base, Arbitrum, Polygon, Solana, Celo, Unichain, Ink, Sonic, and World Chain.
Step 4: Publish an intent
Run the publish command with your source and destination chains:
pnpm dev publish --source optimism --destination base
This launches an interactive wizard that walks you through:
Token selection — choose which stablecoin to send and receive
Amount — how much to transfer on the destination chain (the route amount) and how much to offer as a reward to solvers on the source chain
Deadlines — route deadline (default: 2 hours) and reward deadline (default: 3 hours)
Quote — the CLI fetches a real-time quote from the solver network showing optimal pricing
Confirmation — review the full intent details before signing
Once you confirm, the CLI approves the token transfer to the Portal Contract and publishes your intent onchain. You'll receive an intent hash — save this to track fulfillment.
The intent structure has two parts:
Route: What the solver delivers on the destination chain (token, amount, deadline)
Reward: What the solver earns on the source chain for fulfilling it (token, amount, deadline, prover address)
Solvers in the network see your published intent and compete to fulfill it. The solver delivers the tokens on the destination chain, then proves fulfillment to claim the reward on the source chain.
Step 5: Track fulfillment
Check whether your intent has been fulfilled using the intent hash:
# One-time status check pnpm dev status <intentHash> --chain base
# Live polling — checks every 10 seconds until fulfilled pnpm dev status <intentHash> --chain base --watch
# JSON output (useful for scripting) pnpm dev status <intentHash> --chain base --json
The status command queries the destination chain's Portal Contract directly for the IntentFulfilled event. When fulfilled, you'll see the claimant (solver) address and the destination transaction hash.
Variations
Cross-chain to Solana
The CLI supports EVM-to-Solana and Solana-to-EVM transfers. Make sure your SVM_PRIVATE_KEY is set in .env:
pnpm dev publish --source optimism --destination solana
Testnet
Test on Sepolia before going to mainnet:
pnpm dev publish --source base-sepolia --destination optimism-sepolia
Dry run
Validate everything without actually publishing onchain:
pnpm dev publish --source optimism --destination base --dry-run
Programmatic integration via REST API
If you need to integrate intent publishing into your own application rather than using the CLI interactively, Eco Routes exposes a REST API:
# Get a quote POST /api/v3/quotes/single
# Get exact-input quotes POST /api/v3/quotes/exactIn
# Get exact-output quotes POST /api/v3/quotes/exactOut
# Submit a gasless intent POST /api/v3/quotes/initiateGaslessIntent
# Check intent status POST /api/v3/intents/intentStatus
See the full API reference for request/response schemas.
What happens under the hood
When you publish an intent through the CLI, here's the actual flow:
The CLI fetches a quote from the solver network
You approve the source token to the Portal Contract
The intent is published onchain — your tokens are escrowed in the Portal Contract
Solvers see the intent and compete to fulfill it on the destination chain
The winning solver delivers tokens to the recipient on the destination chain
The proof is verified and the solver claims the reward from escrow on the source chain
If no solver fulfills the intent before the deadline, the escrowed tokens are returned to you automatically. No funds are at risk in any failure case.
Next steps
CLI source code: github.com/eco/routes-cli
Full documentation: eco.com/docs
Try it without code: Eco Portal — bridge stablecoins through the web UI to see the routing in action
Contact: contact@eco.com for integration support
