NeuyRouter + OpenClaw Agent Setup

Updated Feb 2026 - Step-by-step: prepare an AI agent to trade safely on-chain

This is a beginner-friendly tutorial that assumes you are intelligent, but new to trading bots and on-chain execution. We will go slowly and explain every step (even basic ones like opening Terminal and using cd). By the end, you will have an OpenClaw agent that can quote and swap using NeuyRouter.

0. Goal

You will prepare an OpenClaw AI agent to trade using NeuyRouter on Ethereum. The agent will do the standard safe swap flow:

  • Quote: getV2Quote
  • Compute slippage protection: minOut
  • Approve WETH if needed
  • Swap: dexV2Swap
  • Log tx hash and results
Important: We use a dedicated wallet (not your main wallet), we start with tiny funds, and we do quote-only tests first.

1. Mental model (simple and correct)

Think of your AI agent like a careful assistant. It should never "guess". It should do the same safe process every time:

  1. Ask NeuyRouter for a quote
  2. Protect the trade with slippage (minOut)
  3. Make sure it has permission to spend the token (approval)
  4. Execute the swap

Most bot failures happen when people skip one of those steps.

2. Create a dedicated wallet (do NOT skip)

This wallet is only for your agent. You do not use your main wallet.

2.1 MetaMask (recommended)

  1. Open MetaMask
  2. Click your account name at the top
  3. Click Add account
  4. Name it: Agent Wallet

2.2 Write down the seed phrase safely

If you do not know how backups work:

  • Do not store it in screenshots
  • Do not email it to yourself
  • Write it down and store it safely
Why: If your bot wallet is compromised, your main wallet stays safe.

3. Fund the wallet safely (start tiny)

Your agent wallet needs two things:

  • ETH (to pay gas)
  • WETH (the token we will trade in the example)

3.1 Suggested first funding amounts

  • ETH: enough for a few transactions (example $20)
  • WETH: a small amount to sell (example $20)

You can increase later. Start tiny until you trust the full flow.

4. Install the tools (OS-specific)

You need a command-line window to run OpenClaw and your agent scripts.

4.1 Mac

  1. Open Finder
  2. Go to Applications > Utilities
  3. Open Terminal

4.2 Windows

  1. Click the Start Menu
  2. Search: PowerShell
  3. Open Windows PowerShell

You can use Command Prompt too, but PowerShell is recommended.

4.3 Linux

  1. Open your app launcher
  2. Search: Terminal
  3. Open Terminal

5. Install OpenClaw (high-level)

OpenClaw is your agent framework. You install it like any other Node.js project.

5.1 Confirm Node.js is installed

In your terminal window, type:

node -v
npm -v

If you see version numbers, good. If you see "command not found", install Node.js first.

5.2 Install Node.js (if needed)

Install Node.js from the official Node site. Use the LTS version.

After installation, close and reopen Terminal/PowerShell and re-run node -v.

6. Create your bot folder (and learn cd)

We are going to create a folder on your computer to hold your agent project.

6.1 Choose where to store it

A good beginner location is your Desktop.

6.2 Mac / Linux commands

In Terminal, type:

# Go to Desktop
cd ~/Desktop

# Create a new folder
mkdir neuy_openclaw_agent

# Go into the folder
cd neuy_openclaw_agent

6.3 Windows PowerShell commands

In PowerShell, type:

# Go to Desktop
cd $env:USERPROFILE\Desktop

# Create a new folder
mkdir neuy_openclaw_agent

# Go into the folder
cd neuy_openclaw_agent
What cd means: it means "change directory". You are telling the computer which folder you are working in.

7. Set environment variables (safe secrets)

Your agent needs two secrets:

  • RPC URL (a blockchain connection endpoint)
  • PRIVATE KEY (the agent wallet key)
Warning: Never paste your main wallet key. Use the dedicated agent wallet only.

7.1 Create a file named .env

In your project folder, create a file called .env. This file holds secrets locally.

Mac/Linux

touch .env

Windows PowerShell

New-Item -ItemType File .env

7.2 Put values into .env

Open the file in a text editor and add:

RPC_URL=YOUR_ETHEREUM_RPC_URL
PRIVATE_KEY=YOUR_AGENT_WALLET_PRIVATE_KEY

Many people use a provider like Infura/Alchemy, or their own node.

8. NeuyRouter constants (Ethereum)

Item Value Notes
Chain ID 0x1 Ethereum mainnet
NeuyRouter
0xD3E73c2563fFCE65401DfdEcf66b699D4ce41fB9
V3 beta 4 (Ethereum)
WETH
0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
18 decimals
USDC
0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48
6 decimals

9. Teach the agent the flow (the 4-step loop)

Your agent should be taught to do the same safe loop every time. Here is the "mental script":

9.1 Quote

const [amountOut, route] = await router.getV2Quote(WETH, USDC, amountIn);

9.2 Slippage protection

// bps example: 200 = 2%
minOut = amountOut * (10000 - bps) / 10000

9.3 Approval check

if (allowance < amountIn) approve(router, amountIn)

9.4 Swap

await router.dexV2Swap(route, amountIn, minOut, WETH, USDC);
Important: The swap must use the same route returned by the quote.

10. Dry run (quote-only first)

Before you let an AI agent swap anything, you do a "dry run". Dry run means:

  • Connect
  • Quote
  • Compute minOut
  • Log it
  • Do not swap

Run quote-only tests until you trust the numbers.

11. Tiny swap test (smallest possible)

Now you test swapping with a tiny amount:

  • Example: 0.001 WETH

If it succeeds:

  • Check the tx hash on Etherscan
  • Check your USDC balance
  • Confirm the numbers match expectations

12. Safety checklist (read twice)

  • Dedicated wallet only (not your main wallet)
  • Start with tiny funds
  • Dry-run quote-only first
  • Never swap without slippage protection
  • Log every action
  • Keep the private key local and secret

13. Next steps

Once this flow works, the upgrade path is simple:

  • Switch quote: getV2Quote > getV3Quote
  • Switch swap: dexV2Swap > dexV3Swap
  • Try Split: getSplitV2Quote + dexSplitV2Swap
  • Add static verification (see Advanced tutorial)

Reference: NeuyRouter Dev Docs