Native payments on Ethereum, Base, Polygon, Arbitrum, and Optimism — unified PaymentRouter with auto-chain selection for cost-optimized agent transactions.
Single API for all EVM chains — same code, any chain, auto-picks cheapest
Base and Optimism transactions cost ~$0.001 — ideal for agent micropayments
USDC deployed natively on all major EVM chains for stable-value agent payments
0-value calldata receipts on L2s cost ~$0.001 — permanent on-chain proof
Pay to .eth names — agents use human-readable addresses for discovery
Generic ABI read/write for DeFi integrations and on-chain agent coordination
| Chain | CAIP-2 ID | Native Token | Gas Cost | Best For |
|---|---|---|---|---|
| Ethereum | eip155:1 | ETH | ~$2–10 | High-value, ENS |
| Base recommended | eip155:8453 | ETH | ~$0.001 | Agent micropayments |
| Polygon | eip155:137 | POL | ~$0.01 | High throughput |
| Arbitrum | eip155:42161 | ETH | ~$0.01 | DeFi ecosystem |
| Optimism | eip155:10 | ETH | ~$0.005 | Superchain |
Three lines to send a payment on any EVM chain. The PaymentRouter handles RPC selection, gas estimation, and signing.
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 USDBase 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.
sendPaymentAuto picks the cheapest chain from a preferred list at the time of the transaction — real-time gas comparison across all specified chains.
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)Built-in registry covers USDC, USDT, DAI, and WETH on all supported chains. For custom tokens, pass the contract address directly.
// 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 token via contract address
await router.sendPayment({
chain: "eip155:8453",
to: "0xRecipient",
amount: "50.00",
token: "0xContractAddress", // any ERC-20
});| Token | Ethereum | Base | Polygon | Arbitrum |
|---|---|---|---|---|
| USDC | Native | Native | Native | Native |
| USDT | Native | Bridged | Native | Native |
| DAI | Native | Native | Native | Native |
| WETH | Native | Native | Native | Native |
Estimate fees before committing a transaction. Useful for budget enforcement — agents can reject operations that exceed cost thresholds.
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"
// }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" },
// ]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.
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 foreverPermanent 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.
Use .eth names as payment addresses. Aegis resolves them to the underlying EVM address before sending.
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.
Generic ABI read and write for DeFi integrations and on-chain agent coordination. Read-only calls are free; writes cost gas.
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: BigIntimport { 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,
});Multi-chain x402 middleware accepts payment proof from any of the specified EVM chains. The gate verifies the on-chain transaction before granting access.
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 chainimport { payAndFetch } from "aegis-ows-gate";
const response = await payAndFetch("https://api.myservice.com/data", {
network: "eip155:8453", // Pay from Base
walletAddress: "0xAgent",
});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.
| Variable | Description | Required |
|---|---|---|
| EVM_RPC_URL | Fallback RPC for any EVM chain | No |
| ETHEREUM_RPC_URL | Ethereum mainnet RPC endpoint | No |
| BASE_RPC_URL | Base mainnet RPC endpoint | No |
| POLYGON_RPC_URL | Polygon mainnet RPC endpoint | No |
| ARBITRUM_RPC_URL | Arbitrum One RPC endpoint | No |
| OPTIMISM_RPC_URL | Optimism mainnet RPC endpoint | No |
| SEPOLIA_RPC_URL | Sepolia 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.
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
Agents monitor price differences across chains and exploit arbitrage. Auto-chain selection optimizes net profit after gas.
router.sendPaymentAuto({ chains: [...] })
Build a routing layer that always picks the cheapest chain for a given payment size. Agents save gas by routing dynamically.
compareFeesAcrossChains({ amount, chains })
Agents that interact with DeFi protocols (Uniswap, Aave) to earn yield on idle budget. Read balances, approve spends, execute swaps.
contractRead({ chain, address, method })