AI decides. Reactive executes.
AI-native autonomous trading agent on Base. Connect any wallet, enable Session Key, and let the AI trade for you — swap, stop-loss, take-profit, all on-chain. Reactive Smart Contracts execute your orders 24/7, even if the frontend goes offline.
Live Demo: enderzcxai.duckdns.org
Traditional DEX stop-loss requires a centralized backend to monitor prices. Server down = orders don't execute.
Reactive Smart Contracts fix this. They subscribe to on-chain events and autonomously trigger callbacks — no backend, no keeper, no bot.
┌─────────────────────────────────────────────────────┐
│ USER CONNECTS WALLET │
│ │ │
│ ┌────────────┴────────────┐ │
│ ▼ ▼ │
│ No Session Key Session Key Active │
│ (Manual Mode) (Auto Mode) │
│ │ │ │
│ AI returns unsigned tx AI executes directly │
│ User signs in MetaMask No signature needed │
│ │ │ │
│ └────────────┬────────────┘ │
│ ▼ │
│ On-chain execution │
│ Uniswap V2 / Reactive SL/TP │
└─────────────────────────────────────────────────────┘
Every 15 min — Intelligence Pipeline
│
├── Crucix (27+ OSINT sources)
├── OpenNews / 6551.io (AI-scored crypto news)
├── OnchainOS (on-chain analytics)
└── LLM: analyze → { action, confidence, push_worthy }
│
├── Conservative: FLASH signals only, confidence > 70
└── Aggressive: PRIORITY+ signals, confidence > 50
│
▼
SessionManager.executeSwap() on-chain
SSE push → Chat displays decision + TX hash
User: "Set stop-loss at $1800"
│
├── Approve WETH to Callback (Base)
└── AI deploys Reactive contract (RNK 1597, client = user)
│
│ Monitors Uniswap WETH/USDC Sync events forever
│ Every swap: "Is price <= $1800?"
│
└── YES → StopOrderCallback.execute() on Base
├── Re-verify price (double check)
├── Swap WETH → USDC
└── Send to user wallet
RIFI aggregates multiple real-time data sources to power AI trading decisions:
| Source | Repository / Link | Data | Required |
|---|---|---|---|
| Crucix | github.com/enderzcx/Crucix | 27+ OSINT sources: FRED (VIX/CPI/yields), GDELT/ACLED (geopolitics), energy (WTI/gas), Reddit, Telegram, satellite, weather | Optional — AI uses fallback signals without it |
| OpenNews | 6551.io | AI-scored crypto news with sentiment (0-100) and directional signal (long/short/neutral) | Optional — requires API token |
| OnchainOS | OKX OnchainOS | On-chain analytics: whale movements, holder distribution, smart money flows | Optional — basic data from Crucix fallback |
| Uniswap V2 | On-chain (Base) | Real-time WETH/USDC price from pool reserves | Built-in — no config needed |
| Reactive Network | reactive.network | Cross-chain event monitoring for decentralized order execution | Built-in — contracts pre-deployed |
| Tool | Source | Purpose |
|---|---|---|
get_market_signals |
Crucix + OpenNews → LLM | 27-source AI-analyzed market summary |
get_crypto_news |
OpenNews / 6551.io | Raw AI-scored crypto news with clickable links |
get_crucix_data |
Crucix OSINT Engine | Raw macro data: VIX, BTC, oil, conflicts, TG alerts |
get_onchain_data |
OnchainOS | On-chain analytics: whales, holders, smart money |
get_price |
Uniswap V2 (Base) | Real-time WETH/USDC price + pool reserves |
get_portfolio |
Base RPC | User wallet balances (WETH, USDC, ETH) |
market_swap |
Uniswap V2 | Execute swap (auto or manual signing) |
session_swap |
SessionManager | Autonomous swap within budget |
set_stop_loss |
Reactive Network | Deploy decentralized stop-loss contract |
set_take_profit |
Reactive Network | Deploy decentralized take-profit contract |
get_active_orders |
OrderRegistry | List active SL/TP orders |
cancel_order |
OrderRegistry | Cancel specific order |
get_session |
SessionManager | Check session budget and status |
update_memory |
Local storage | Persist user preferences and trading patterns |
- Node.js 18+
- An OpenAI-compatible LLM API endpoint (OpenAI, local Ollama, etc.)
- A wallet with ETH on Base (for gas)
- Foundry (for contract deployment only)
git clone https://github.com/enderzcx/RIFI.git
cd RIFI/web
cp .env.example .env.local
npm install# Required
LLM_ENDPOINT=http://your-llm:8080/v1 # Any OpenAI-compatible API
LLM_API_KEY=your-key
PRIVATE_KEY=0x_your_wallet_key # Backend executor wallet
# Optional — for full intelligence pipeline
VPS_API_URL=http://your-vps:3200 # If running VPS intelligenceContract addresses are pre-filled — you can reuse the deployed contracts on Base.
npm run devOpen localhost:3000 → Connect wallet → Start chatting.
For full Sentinel Mode with 27+ data sources:
# Terminal 1: Start Crucix (see github.com/enderzcx/Crucix)
cd /path/to/Crucix && node server.mjs
# Terminal 2: Start VPS API
cd RIFI
cp vps-api/.env.example vps-api/.env
# Edit vps-api/.env with your API keys
node vps-api-index.mjscurl -L https://foundry.paradigm.xyz | bash && foundryup
forge install
# Deploy on Base
forge script script/DeployBaseStopOrder.s.sol:DeployBase \
--rpc-url $BASE_RPC_URL --private-key $PRIVATE_KEY --broadcast -vvvv
# Deploy on Reactive Network
forge script script/DeployBaseStopOrder.s.sol:DeployReactive \
--rpc-url $REACTIVE_RPC --private-key $PRIVATE_KEY --broadcast -vvvv| Feature | Without VPS | With VPS |
|---|---|---|
| Chat with AI | ✅ | ✅ |
| Check price | ✅ | ✅ |
| View portfolio | ✅ | ✅ |
| Market swap | ✅ | ✅ |
| Stop-loss / Take-profit | ✅ | ✅ |
| Session Key auto-trading | ✅ | ✅ |
| Market intelligence signals | ✅ Real-time 27-source | |
| Crypto news | ❌ | ✅ |
| Crucix macro data | ❌ | ✅ |
| Sentinel Mode auto-trade | ❌ | ✅ |
| Contract | Address |
|---|---|
| StopOrderCallback | 0x9702...f3 |
| OrderRegistry | 0xcE97...98 |
| SessionManager | 0x5810...0e |
| Callback Proxy | 0x0D3E...47 |
| Contract | Address |
|---|---|
| PairOrderManager | 0x3421...11 |
| Step | Chain | TX |
|---|---|---|
| Deploy Reactive | RNK (1597) | 0xbCee0509... |
| Stop-loss executed | Base | 0x600e7eaa... |
Sold 0.001 WETH → 2.112 USDC, block 43860043
| Step | Chain | TX |
|---|---|---|
| Deploy Reactive | Lasna | 0x5c9b6b60... |
| Price trigger | Sepolia | 0x6f11c03e... |
| Callback | Sepolia | 0x114096dc... |
| File | Purpose |
|---|---|
StopOrderCallback.sol |
Callback: double price verify, configurable slippage, try-catch swap with token refund |
PairOrderManager.sol |
Reactive: subscribes to Uniswap Sync events, multi-order state, single-trigger protection |
OrderRegistry.sol |
Order ledger, OCO (one-cancels-other) linked orders |
SessionVault.sol |
Session key budget enforcement (maxPerTrade, totalBudget, expiry) |
- Multi-wallet: Any wallet connects and trades with its own assets
- Dual mode: Session Key (AI auto-executes) or Manual (MetaMask signs each tx)
- Sentinel Mode: Conservative / Aggressive autonomous trading
- Reactive SL/TP: Decentralized, runs forever without backend
- Session Key: On-chain budget enforcement (per-trade limit, total cap, expiry)
- Streaming UI: Tool execution visible step-by-step in real-time
- 14 AI tools: Independent access to news, macro data, on-chain analytics, trading, and memory
- AI Memory: Learns user preferences, risk tolerance, and trading patterns across sessions
| Layer | Technology |
|---|---|
| Frontend | Next.js, React 19, TypeScript, Tailwind CSS |
| Web3 | Wagmi, Viem, ConnectKit |
| AI | OpenAI-compatible LLM |
| Blockchain | Base (8453) + Reactive Network (1597) |
| Contracts | Solidity 0.8+, Foundry, OpenZeppelin |
| Real-time | Server-Sent Events (SSE) |
| Intelligence | Crucix, OpenNews, OnchainOS |
MIT — see LICENSE