Skip to content

Repository files navigation

PhylaX - AI Execution Firewall for OKX X Layer

PhylaX - Before users sign, PhylaX checks the trade.

Shield: PhylaX is an AI execution firewall for OKX X Layer. Before users sign, PhylaX checks the trade.

Built for the Build X-Agent Hackathon
Participant ID: 2054917885347762176


What It Does

You type: "Swap 50 USDC to OKB on X Layer"

PhylaX does:

  1. Parses your intent via AI agent planning
  2. Scans both tokens for honeypots & rug risks (OKX Security skill)
  3. Fetches optimal quote across 500+ DEX routes (OKX DEX Swap skill)
  4. Checks allowance and generates approval tx if needed
  5. Builds unsigned transaction — server never broadcasts, you sign
  6. Confirms on-chain after your wallet submits

Note: For this hackathon, X Layer is the only active executable chain. PhylaX is not a multi-chain live product yet, and features like OKX Agentic Wallet or x402 are future extensions, not part of current demo scope.


OKX Skills Integration

Skill What PhylaX Uses It For CLI Command
okx-dex-signal Discover trending tokens on X Layer onchainos signal list
okx-security Dual token risk scan before every trade onchainos security token-scan
okx-dex-swap Get quotes + build swap transactions onchainos swap quote
okx-dex-token Resolve token addresses by symbol onchainos token search
okx-wallet-portfolio Check wallet balances before execution onchainos portfolio token-balances
okx-onchain-gateway Gas estimation + transaction simulation onchainos gateway gas, gateway simulate
okx-agentic-wallet Wallet status and account info onchainos wallet status
okx-audit-log Audit log path for troubleshooting Local path resolution

The codebase integrates directly with the OKX Onchain OS through lib/okx.ts at runtime.


Why PhylaX Is Different

  • Agentic Proactive UX — instead of a passive prompt-box, the agent proactively asks clarifying questions to guide users through swap intent formation.
  • DeepSeek & Claude Fallback — built-in dual-LLM provider abstraction. Uses Anthropic Claude as primary, with automatic zero-downtime fallback to DeepSeek V4 if credits exhaust.
  • Dual token scan — scans both fromToken AND toToken before any quote. Most agents scan only once.
  • Robust Token Resolution — hardcoded shortcuts and decimal fallbacks for major assets (USDC, USDT, WETH).
  • No-broadcast guarantee — /api/execute returns only unsigned txData. Server never touches your funds.
  • Approval replay prevention — each approval ID is one-time use, expires in 5 minutes, consumed atomically via Redis.
  • Onchain tx verification — verifies approval tx from, to, and method selector before proceeding.
  • Kill switch — operator can pause all live execution instantly via environment flag without redeploying.

Quick Start

git clone https://github.com/Rzbyte/PhylaX
cd PhylaX
npm install
cp .env.example .env
npm run dev

Environment Variables

Variable Purpose
ANTHROPIC_API_KEY Primary LLM provider
DEEPSEEK_API_KEY Fallback LLM provider
REDIS_URL Approval token storage
OKX_* OKX Onchain OS credentials

Architecture

User intent
    -> AI Agent (Claude / DeepSeek fallback)
    -> Security scan (dual token, okx-security)
    -> Quote fetch (500+ DEX routes, okx-dex-swap)
    -> Allowance check + approval tx (Redis, 5min TTL)
    -> Unsigned tx returned to user
    -> User signs + broadcasts
    -> On-chain confirmation (okx-onchain-gateway)

License

MIT

About

AI execution firewall for OKX X Layer. Scans both tokens for rug risk, fetches optimal DEX routes, builds unsigned transactions. Server never broadcasts. Built for Build X-Agent Hackathon.

Topics

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages