AegisAEGIS
EVM Chains

EVM Multi-Chain Integration

Native payments on Ethereum, Base, Polygon, Arbitrum, and Optimism — unified PaymentRouter with auto-chain selection for cost-optimized agent transactions.

Why EVM for Agents?

🔗

Unified PaymentRouter

Single API for all EVM chains — same code, any chain, auto-picks cheapest

Sub-cent L2 Fees

Base and Optimism transactions cost ~$0.001 — ideal for agent micropayments

🪙

USDC Native

USDC deployed natively on all major EVM chains for stable-value agent payments

📄

Receipt Anchoring

0-value calldata receipts on L2s cost ~$0.001 — permanent on-chain proof

📖

ENS Resolution

Pay to .eth names — agents use human-readable addresses for discovery

🤝

Contract Interactions

Generic ABI read/write for DeFi integrations and on-chain agent coordination


Supported Chains

ChainCAIP-2 IDNative TokenGas CostBest For
Ethereumeip155:1ETH~$2–10High-value, ENS
Base recommendedeip155:8453ETH~$0.001Agent micropayments
Polygoneip155:137POL~$0.01High throughput
Arbitrumeip155:42161ETH~$0.01DeFi ecosystem
Optimismeip155:10ETH~$0.005Superchain

Quick Start

Three lines to send a payment on any EVM chain. The PaymentRouter handles RPC selection, gas estimation, and signing.

Send a payment on Base
import { PaymentRouter } from "@aegis-ows/integrations";

const router = new PaymentRouter();
const result = await router.sendPayment({
  chain: "eip155:8453",       // Base
  to: "0xRecipient",
  amount: "5.00",
  token: "USDC",
});

// result.txHash — on-chain transaction hash
// result.chain  — "eip155:8453"
// result.fee    — gas cost in USD

Base is recommended for agent micropayments

At ~$0.001 per transaction, Base makes it economical for agents to pay for every API call. USDC is deployed natively on Base with no bridging required.


Auto-Chain Selection

sendPaymentAuto picks the cheapest chain from a preferred list at the time of the transaction — real-time gas comparison across all specified chains.

Auto-select cheapest chain
import { PaymentRouter } from "@aegis-ows/integrations";

const router = new PaymentRouter();
const result = await router.sendPaymentAuto({
  to: "0xRecipient",
  amount: "10.00",
  token: "USDC",
  chains: ["eip155:8453", "eip155:137", "eip155:42161"],
});

// Automatically picks the chain with lowest gas at execution time
// result.chain — which chain was selected
// result.feeUSD — gas cost in USD (usually <$0.02)

How auto-selection works

  1. Fetches current gas prices from each chain in parallel
  2. Estimates total fee in USD (gas units × gas price × ETH/USD or POL/USD)
  3. Selects chain with lowest total fee
  4. Executes the payment on the winning chain

ERC-20 Tokens

Built-in registry covers USDC, USDT, DAI, and WETH on all supported chains. For custom tokens, pass the contract address directly.

Built-in token registry
// Built-in tokens — no address needed
await router.sendPayment({ chain: "eip155:8453", to: "0x...", amount: "5.00", token: "USDC" });
await router.sendPayment({ chain: "eip155:1",    to: "0x...", amount: "0.01", token: "WETH" });
await router.sendPayment({ chain: "eip155:137",  to: "0x...", amount: "100",  token: "USDT" });
Custom ERC-20 token
// Custom token via contract address
await router.sendPayment({
  chain: "eip155:8453",
  to: "0xRecipient",
  amount: "50.00",
  token: "0xContractAddress",  // any ERC-20
});
TokenEthereumBasePolygonArbitrum
USDCNativeNativeNativeNative
USDTNativeBridgedNativeNative
DAINativeNativeNativeNative
WETHNativeNativeNativeNative

Gas Estimation

Estimate fees before committing a transaction. Useful for budget enforcement — agents can reject operations that exceed cost thresholds.

Estimate fees for a single payment
import { estimatePaymentFees } from "@aegis-ows/integrations";

const estimate = await estimatePaymentFees({
  chain: "eip155:8453",
  to: "0xRecipient",
  amount: "10.00",
  token: "USDC",
});

// {
//   gasUnits: 65000,
//   gasPriceGwei: "0.001",
//   feeETH: "0.000000065",
//   feeUSD: "0.00018"
// }
Compare fees across chains
import { compareFeesAcrossChains } from "@aegis-ows/integrations";

const comparison = await compareFeesAcrossChains({
  amount: "10.00",
  token: "USDC",
  chains: ["eip155:1", "eip155:8453", "eip155:137", "eip155:42161"],
});

// Returns sorted array, cheapest first:
// [
//   { chain: "eip155:8453",  feeUSD: "0.00018", name: "Base" },
//   { chain: "eip155:42161", feeUSD: "0.00850", name: "Arbitrum" },
//   { chain: "eip155:137",   feeUSD: "0.01200", name: "Polygon" },
//   { chain: "eip155:1",     feeUSD: "4.20000", name: "Ethereum" },
// ]

Receipt Anchoring

Every Aegis payment generates a SHA-256 receipt hash. The hash is anchored on-chain via a 0-value self-transfer with the receipt in calldata — costs ~$0.001 on L2s.

Anchor a receipt on Base
import { anchorReceiptEVM } from "@aegis-ows/integrations";

const proofTx = await anchorReceiptEVM({
  receiptHash: "sha256:abc123...",
  chain: "eip155:8453",         // Base — ~$0.001
  agentAddress: "0xAgent",
});

// proofTx.txHash — transaction on Base with receipt in calldata
// Anyone can inspect the calldata: AEGIS_RECEIPT:<hash>
// Verifiable on Basescan forever

Permanent proof, minimal cost

A 0-value self-transfer with calldata costs ~65,000 gas. On Base at sub-cent gas prices, that is roughly $0.001 per receipt — economical enough to anchor every single payment.


ENS Resolution

Use .eth names as payment addresses. Aegis resolves them to the underlying EVM address before sending.

Pay to an ENS name
import { resolveENS, PaymentRouter } from "@aegis-ows/integrations";

// Resolve a .eth name
const address = await resolveENS("analyst.eth");
// "0x1234...abcd"

// Or pass directly to PaymentRouter — it resolves automatically
const router = new PaymentRouter();
await router.sendPayment({
  chain: "eip155:1",        // ENS lives on Ethereum mainnet
  to: "analyst.eth",        // resolved automatically
  amount: "5.00",
  token: "USDC",
});

ENS resolution always queries Ethereum mainnet regardless of the payment chain. The resolved address is used for the payment on the target chain.


Contract Interactions

Generic ABI read and write for DeFi integrations and on-chain agent coordination. Read-only calls are free; writes cost gas.

Read from a contract
import { contractRead } from "@aegis-ows/integrations";

// Read USDC balance from any ERC-20
const balance = await contractRead({
  chain: "eip155:8453",
  address: "0xUSDCContractAddress",
  abi: ["function balanceOf(address) view returns (uint256)"],
  method: "balanceOf",
  args: ["0xAgentAddress"],
});
// balance: BigInt
Encode a contract write
import { encodeContractWrite } from "@aegis-ows/integrations";

// Encode calldata for a contract write
const calldata = encodeContractWrite({
  abi: ["function approve(address spender, uint256 amount)"],
  method: "approve",
  args: ["0xSpender", BigInt("1000000")],
});

// Send as a raw transaction via PaymentRouter
await router.sendRawTransaction({
  chain: "eip155:8453",
  to: "0xContractAddress",
  data: calldata,
});

Gate Integration

Multi-chain x402 middleware accepts payment proof from any of the specified EVM chains. The gate verifies the on-chain transaction before granting access.

Multi-chain x402 middleware
import { aegisGate } from "aegis-ows-gate";

app.use(aegisGate({
  price: "0.01",
  token: "USDC",
  agentId: "my-agent",
  acceptedChains: ["eip155:8453", "eip155:137"],
}));

// Clients can pay from Base or Polygon — gate accepts either
// Payment verified on-chain before access is granted
// Receipts anchored to the cheapest accepted chain
Client-side payment (payAndFetch)
import { payAndFetch } from "aegis-ows-gate";

const response = await payAndFetch("https://api.myservice.com/data", {
  network: "eip155:8453",    // Pay from Base
  walletAddress: "0xAgent",
});

Environment Variables

Set chain-specific RPC endpoints. EVM_RPC_URL is used as a fallback when no chain-specific URL is set. Public endpoints are used if no variables are configured.

VariableDescriptionRequired
EVM_RPC_URLFallback RPC for any EVM chainNo
ETHEREUM_RPC_URLEthereum mainnet RPC endpointNo
BASE_RPC_URLBase mainnet RPC endpointNo
POLYGON_RPC_URLPolygon mainnet RPC endpointNo
ARBITRUM_RPC_URLArbitrum One RPC endpointNo
OPTIMISM_RPC_URLOptimism mainnet RPC endpointNo
SEPOLIA_RPC_URLSepolia testnet RPC (for dev)No

Graceful degradation

Public RPC endpoints are used when no env vars are set. For production, configure dedicated RPC endpoints (Alchemy, Infura, QuickNode) to avoid rate limits and improve reliability.


Hackathon Ideas

\uD83E\uDD16

Agent Micropayments on Base

Deploy an agent economy where every API call is paid in USDC on Base. Near-zero fees make per-call billing economical at any scale.

$0.001 USDC per API call on Base

\uD83D\uDCC8

Cross-Chain Arbitrage Bots

Agents monitor price differences across chains and exploit arbitrage. Auto-chain selection optimizes net profit after gas.

router.sendPaymentAuto({ chains: [...] })

\u26FD

Gas-Optimized Payment Routing

Build a routing layer that always picks the cheapest chain for a given payment size. Agents save gas by routing dynamically.

compareFeesAcrossChains({ amount, chains })

\uD83E\uDD1D

DeFi Agent with Contract Interactions

Agents that interact with DeFi protocols (Uniswap, Aave) to earn yield on idle budget. Read balances, approve spends, execute swaps.

contractRead({ chain, address, method })