Self-Auditing Verifiable Protection Agent for Autonomous AI Trading
A trustless AI trading protection layer that cryptographically proves its safety before moving any capital.
Most AI trading systems operate as black boxes — the agent reasons, acts, and moves capital with no external verifiability. VeriShield-8004 solves this with a five-stage verifiable pipeline:
PRISM Signal → AI Reasoning (5-step) → Risk Audit (4 guardrails) → EIP-712 Sign → Execute
Every decision is logged with full cryptographic trail — approved or blocked, with reasoning, signal data, and signature visible in the dashboard in real time.
| Feature | Description |
|---|---|
| Autonomous Trading Mode | Runs continuously every 30 seconds — no manual clicking needed |
| AI Decision Engine | 5-step reasoning: RSI → MACD Crossover → Momentum → Volatility → Consensus |
| EIP-712 Safety Attestation | Cryptographic proof-of-safety signed before every trade |
| 4 Risk Guardrails | Max 10% position, 4%/$2,000 daily loss limit, volatility circuit breaker, AI confidence gate |
| Capital Preservation Mode | Auto-blocks and suggests low-risk yield when guardrails breach |
| Performance Metrics | Win rate, Sharpe ratio, max drawdown, avg confidence, win/loss streak |
| Trade History Log | Full timestamped record with RSI, MACD, PnL, outcome per cycle |
| Exportable Reports | One-click CSV export and printable PDF report with full trade log |
| Dual Execution Mode | Sandbox (on-chain ERC-8004) or Kraken CLI (paper/live trading) |
| ERC-8004 Agent Identity | On-chain identity with reputation and audit endpoint on Sepolia |
| Human Override | Force Pause button — agent stops immediately, logged in audit trail |
graph TD
A[Strykr PRISM API<br/>RSI · MACD · Momentum · Price] --> B(VeriShield Agent)
B --> C[AI Decision Engine<br/>5-Step Reasoning]
C --> C1[Step 1: RSI Analysis]
C --> C2[Step 2: MACD Crossover]
C --> C3[Step 3: Momentum]
C --> C4[Step 4: Volatility Check]
C --> C5[Step 5: Consensus]
C5 -->|HOLD| D1[BLOCKED — logged transparently]
C5 -->|BUY or SELL| D[Risk Audit — 4 Guardrails]
D -->|Guardrail Breach| E[Capital Preservation Mode<br/>Suggest low-risk yield]
D -->|All Passed| F[EIP-712 Safety Attestation<br/>Signed by agent wallet]
F --> G{Execution Mode}
G -->|Sandbox| H[Sepolia Risk Router<br/>On-chain ERC-8004 record]
G -->|Kraken Paper| I[Kraken CLI — paper trade<br/>wsl kraken paper buy/sell XBTUSD]
G -->|Kraken Live| J[Kraken CLI — live order<br/>Guardrails still enforced]
| Layer | Technology |
|---|---|
| Frontend | Next.js 16 (App Router), Tailwind CSS v4, shadcn/ui |
| Blockchain | Solidity 0.8.28, Hardhat, Viem (EIP-712 signing) |
| Signals | Strykr PRISM API (api.prismapi.ai) |
| Execution | Kraken CLI v0.2.3 via WSL child_process.execSync |
| Identity | ERC-8004 / ERC-721 on Sepolia |
| Language | TypeScript throughout |
- Node.js 18+
- WSL (Windows) or Linux/Mac for Kraken CLI (optional)
git clone https://github.com/your-username/VeriShield.git
cd VeriShield
npm installcp .env.example .env.localEdit .env.local:
# Get your key at https://prismapi.ai
STRYKR_PRISM_KEY=your_prism_key_here
# For contract deployment (optional — already deployed)
PRIVATE_KEY=your_wallet_private_key
SEPOLIA_RPC_URL=https://eth-sepolia.g.alchemy.com/v2/your_keynpm run dev
# Open: http://localhost:3000Click ▶ Start Autonomous — the agent runs every 30 seconds automatically:
- Fetches live BTC price, RSI, MACD from PRISM API
- Runs 5-step AI reasoning
- Checks 4 risk guardrails
- Signs EIP-712 attestation if approved
- Executes via Sandbox or Kraken CLI
Click Force Pause at any time to stop immediately.
- Uses Sepolia testnet for on-chain validation
- No real funds required
- Full ERC-8004 reputation and audit artifact produced
- Perfect for testing and demonstrations
Paper Trading — Simulated balances with live Kraken prices. Kraken paper PnL shown live in the dashboard.
Live Trading — Executes real market orders on Kraken. Requires API key with write permissions. VeriShield risk guardrails always enforced.
# WSL / Linux / Mac
curl -sSf https://raw.githubusercontent.com/krakenfx/kraken-cli/main/install.sh | sh
# Or via Cargo
cargo install kraken-cli
# Initialize paper trading account
kraken paper init- Log in at kraken.com → Security → API → Create API Key
- For monitoring only: enable
Query Funds,Query Orders - For live trading: additionally enable
Create & Modify Orders - In the dashboard → Settings → Kraken Mode → paste key & secret → Test Connection
The agent uses a deterministic 5-step reasoning process (designed to be swappable with an LLM):
| Step | Name | Logic |
|---|---|---|
| 1 | RSI Analysis | Overbought (>70) → bearish, Oversold (<30) → bullish |
| 2 | MACD Crossover | Positive/strong positive → bullish; negative → bearish |
| 3 | Momentum Confirmation | PRISM AI momentum aligned with direction |
| 4 | Volatility Risk Check | Vol Index >70 → reduces confidence, warns |
| 5 | Consensus Decision | Net score decides BUY / SELL / HOLD at confidence % |
HOLD signals are blocked before the risk audit even runs — zero unnecessary attestations.
All 4 checks run before the EIP-712 attestation is signed. A failed check = no signature = no execution.
| Guardrail | Default | Behaviour |
|---|---|---|
| Max position size | 10% of capital | Position scaled by AI confidence |
| Daily loss limit | 4% or $2,000 | Triggers Capital Preservation Mode |
| Volatility circuit breaker | Index ≥ 80 | Triggers Capital Preservation Mode |
| AI confidence gate | ≥ 55% | Rejects low-conviction signals |
| Per-trade stop-loss | 1.5–3% (dynamic) | Wider in high volatility |
The dashboard tracks live:
- Win Rate — Executed trades that closed positive
- Sharpe Ratio — Annualized risk-adjusted return (daily returns rolling window)
- Max Drawdown — Peak-to-trough capital decline
- Avg Confidence — Mean AI conviction across all cycles
- Win / Loss Streak — Consecutive outcomes
Export to CSV (full trade log) or PDF (formatted report) with one click.
// VeriShieldAgent.sol — ERC-8004 + ERC-721
contract VeriShieldAgent is ERC721, Ownable {
struct AgentInfo {
address agentWallet;
string validationUrl;
bool isCompliant;
uint256 totalAudits;
}
}Deployed on Sepolia:
0xE8AC62b071541ad07ba00a37a46Ca41f5Da1f5ab
To deploy your own:
node --env-file=.env.local scripts/deploy_raw.jsnpm i -g vercel
vercel --prodSet in Vercel → Project → Settings → Environment Variables:
STRYKR_PRISM_KEY = your_key
Note: Kraken CLI requires a local binary via WSL. On Vercel's serverless environment the system automatically uses Sandbox mode. To use Kraken Mode, run locally or on a VPS with the CLI installed.
VeriShield/
├── contracts/
│ └── VeriShieldAgent.sol # ERC-8004 agent identity contract
├── scripts/
│ ├── deploy_raw.js # Standalone deployment
│ └── test-prism.js # API connectivity test
├── src/
│ ├── app/
│ │ ├── api/
│ │ │ ├── run-agent/ # POST: trigger agent cycle
│ │ │ ├── metrics/ # GET: performance data + trade history
│ │ │ ├── settings/ # GET/POST: read & write config
│ │ │ └── kraken-status/ # POST: test Kraken connection
│ │ ├── globals.css
│ │ ├── layout.tsx
│ │ └── page.tsx # Main dashboard (autonomous mode + all panels)
│ └── lib/
│ └── agent/
│ ├── ai-decision.ts # 5-step AI reasoning engine
│ ├── audit.ts # EIP-712 attestation signing
│ ├── execution.ts # Agent cycle pipeline
│ ├── kraken.ts # Kraken CLI wrapper
│ ├── metrics.ts # Win rate, Sharpe, drawdown tracking
│ ├── risk.ts # 4-guardrail risk module
│ ├── settings.ts # In-memory settings store
│ └── signal.ts # Strykr PRISM integration
├── public/
│ ├── favicon.png
│ ├── screenshot-dashboard.png
│ └── screenshot-ai-reasoning.png
├── .env.example # Safe template — copy to .env.local
├── .gitignore # Excludes .env.local and all secrets
├── hardhat.config.js
├── LICENSE # MIT
└── README.md
MIT — see LICENSE

