Technical Documentation
UniAgent v1.0 — Cross-Chain Universal Trading
Overview
UniAgent is a cross-chain trading infrastructure powered by Universal Accounts from Particle Network. It enables seamless token swaps across 21+ chains without manual bridging, chain switching, or gas token management.
How Users Interact
Users talk naturally: "Buy $50 of ARB on Arbitrum" or "Send 10 USDC to 0x..."
The AI agent interprets this, executes the trade via the backend, and confirms the result.
No CLI, no commands, no technical knowledge required.
Chain Abstraction
Trade on any chain using a unified balance. No bridging, no wrapped tokens, no friction.
Universal Balance
USDC, USDT, ETH, SOL, BNB, BTC aggregated across all chains into one spendable balance.
Atomic Execution
Single-signature transactions that execute complex multi-chain operations atomically.
Self-Custody
Your private key never leaves your machine. All transactions are signed locally.
System Architecture
UniAgent consists of three core layers:
Dashboard (Next.js + wagmi)
- React 19 with App Router for server/client components
- wagmi + RainbowKit for wallet connection (17 EVM chains)
- Real-time portfolio, terminal, and activity views
- Framer Motion animations, Tailwind CSS v4 styling
Backend API (Express.js)
- RESTful endpoints for balance, trading, and history
- Particle Network Universal Account SDK integration
- Transaction building with automatic gas and route optimization
- UserOperation construction for ERC-4337 execution
Particle Network (Universal Accounts)
- Chain abstraction layer across 21+ networks
- Smart account derivation from EOA signature
- Cross-chain liquidity aggregation and routing
- Bundled transaction execution via ERC-4337
Universal Accounts
A Universal Account is a smart contract account derived deterministically from your EOA wallet. It provides:
- EVM Address — Single deposit address for all EVM chains (Ethereum, Base, Arbitrum, etc.)
- Solana Address — Native Solana deposit address
- Unified Balance — Assets across all chains aggregated into one view
- Cross-Chain Spend — Use ETH on Arbitrum to buy tokens on Base, automatically
Account Derivation
// 1. User connects EOA wallet (MetaMask, Rainbow, etc.)
const eoaAddress = "0xYourWalletAddress";
// 2. Sign a deterministic message
const signature = await wallet.signMessage("particle-ua-derivation");
// 3. Universal Account is derived
const ua = await particleSDK.deriveUniversalAccount(eoaAddress, signature);
// 4. Returns EVM + Solana deposit addresses
console.log(ua.evmAddress); // 0x...
console.log(ua.solanaAddress); // Base58...Backend Architecture
Note: Users don't need to install any SDK. Just install the skill on your agent and use the CLI commands. The backend handles all Particle Network integration automatically.
For developers who want to understand or contribute, here's how the backend works:
Backend Flow
// 1. User connects wallet in dashboard or runs CLI
// 2. Frontend sends EOA address to backend
POST /init { ownerAddress: "0x..." }
// 3. Backend (server.mjs) uses Particle SDK internally
// All SDK credentials are on the server - users never see them
// 4. Backend returns derived UA addresses
{ evmAddress: "0x...", solanaAddress: "...", balance: "1234.56" }
// 5. User funds their UA, trades via CLI/dashboard
// All signing happens locally, backend only sees signed transactionsWhat Users Actually Do
# Install the skill on your agent # Then just use natural language or CLI: node cli.mjs init # Creates wallet, derives UA node cli.mjs balance # Check balance node cli.mjs buy ... # Trade # That's it. No SDK, no API keys, no configuration. # Your private key stays local. Backend handles the rest.
API Reference
The backend exposes RESTful endpoints on port 3069:
/initInitialize Universal Account from EOA address
{
"ownerAddress": "0x..."
}{
"evmAddress": "0x...",
"solanaAddress": "...",
"balance": "1234.56"
}/balanceGet current balance and asset breakdown
{
"ownerAddress": "0x..."
}{
"total": "1234.56",
"assets": [],
"chains": []
}/buyBuy a token using unified balance
{
"ownerAddress": "0x...",
"chain": "base",
"token": "0x...",
"amount": 10
}{
"txHash": "0x...",
"status": "pending"
}/sellSell a token back to primary assets
{
"ownerAddress": "0x...",
"chain": "arbitrum",
"token": "0x...",
"amount": 100
}{
"txHash": "0x...",
"status": "pending"
}/convertConvert between primary assets
{
"ownerAddress": "0x...",
"chain": "ethereum",
"asset": "ETH",
"amount": 0.1
}{
"txHash": "0x...",
"status": "pending"
}/transferTransfer tokens to another address
{
"ownerAddress": "0x...",
"chain": "polygon",
"token": "0x...",
"amount": 50,
"to": "0x..."
}{
"txHash": "0x...",
"status": "pending"
}/chainsList all supported chains
[
{
"id": 1,
"name": "Ethereum",
"symbol": "ETH"
}
]/healthHealth check endpoint
{
"status": "ok",
"chains": 21
}Transaction Flow
When a user initiates a trade (e.g., "Buy $10 of ARB on Arbitrum"):
Request Parsing
Dashboard sends request to backend with ownerAddress, chain, token, amount
Route Calculation
SDK analyzes unified balance, finds optimal source assets (may span multiple chains)
UserOperation Building
Constructs ERC-4337 UserOperation with all necessary cross-chain calls
Local Signing
UserOp is returned to client, signed with user's private key (never sent to server)
Submission
Signed UserOp sent back to backend, submitted to Particle's bundler network
Execution
Bundlers execute the transaction atomically across all required chains
Confirmation
Transaction hash returned, balance updates reflected in real-time
Security Model
UniAgent follows a self-custody security model:
Local Key Storage
Private keys are stored in local .env file and never transmitted. All signing happens client-side.
Message Signing Only
Server only receives signed transactions, never raw private keys. Zero knowledge of user secrets.
Deterministic Derivation
Universal Account is derived from EOA signature, recoverable with same wallet on any device.
Smart Contract Security
Universal Account contracts are audited, battle-tested, and non-upgradeable.
Important: Never share your .env file or UA_PRIVATE_KEY. Anyone with access to your private key controls your Universal Account and all assets within.
Supported Chains
UniAgent supports 21 chains for trading, with more being added:
| Chain | CLI Name | Chain ID | Status |
|---|---|---|---|
| Ethereum | ethereum | 1 | Active |
| BNB Chain | bnb | 56 | Active |
| Base | base | 8453 | Active |
| Arbitrum | arbitrum | 42161 | Active |
| Avalanche | avalanche | 43114 | Active |
| Optimism | optimism | 10 | Active |
| Polygon | polygon | 137 | Active |
| Solana | solana | 101 | Active |
| Linea | linea | 59144 | Active |
| Sonic | sonic | 146 | Active |
| Berachain | berachain | 80094 | Active |
| Mantle | mantle | 5000 | Active |
| Monad | monad | 143 | Active |
| Merlin | merlin | 4200 | Active |
| HyperEVM | hyperevm | 999 | Active |
| Blast | blast | 81457 | Active |
| Manta | manta | 169 | Active |
| Mode | mode | 34443 | Active |
| Plasma | plasma | 9745 | Active |
| X Layer | xlayer | 196 | Active |
| Conflux | conflux | 1030 | Active |