Skip to content

Marcus-Rug-Intel/x402-trading-agent

Repository files navigation

x402 Safe Trading Agent 🛡️

An autonomous crypto trading agent that checks token risk before every trade — powered by Marcus Rug Intel via x402 payments.

Coinbase x402 Ecosystem

No API keys. No subscriptions. Just pay-per-request with USDC on Base or Solana.

What This Does

Agent sees token opportunity
    ↓
Pays $0.04 USDC via x402 → Marcus Rug Intel risk check
    ↓
Risk score 85+ → SKIP (saved from rug pull)
Risk score < 40 → TRADE (with confidence)
Risk score 40-85 → Deep analysis ($0.50) → decide

This is a reference implementation showing how any AI trading agent can integrate on-chain risk intelligence using the x402 payment protocol. Fork it, adapt it, ship it.

Why x402?

Traditional API integration requires: API keys, account creation, billing setup, rate limit management.

With x402: hit the endpoint, pay per request, get data. Your agent handles everything autonomously.

Architecture

┌──────────────────────────────────────────────────┐
│  Safe Trading Agent                              │
│                                                  │
│  ┌──────────┐  ┌──────────┐  ┌───────────────┐  │
│  │ Discovery │→│ Risk Gate │→│ Trade Decision │  │
│  │ (Bazaar)  │  │ (x402)   │  │ (LLM or rule) │  │
│  └──────────┘  └──────────┘  └───────────────┘  │
│       ↓              ↓              ↓            │
│  Find services  Pay & check    Buy / Skip / Deep │
└──────────────────────────────────────────────────┘
         ↕                ↕
    CDP Bazaar    Marcus Rug Intel
    (discovery)    (cryptorugmunch.app)

Quick Start

Prerequisites

  • Python 3.10+
  • A wallet with USDC on Base (even $1 is enough for ~25 risk checks)

Install

git clone https://github.com/CryptoRugMunch/x402-trading-agent.git
cd x402-trading-agent
pip install -r requirements.txt
cp .env.example .env
# Edit .env with your wallet private key

Run

# Check a single token before trading
python agent.py check So11111111111111111111111111111111111111112

# Run the autonomous trading loop (watches for new tokens, checks risk, decides)
python agent.py watch --chain solana

# Discover available Marcus Rug Intel endpoints via Bazaar
python agent.py discover

How It Works

1. Discovery (Optional)

The agent can discover Marcus Rug Intel endpoints dynamically via the x402 Bazaar:

from x402_client import discover_services

services = discover_services(category="crypto-security")
# Returns: check-risk, holder-deepdive, marcus-quick, etc.

2. Risk Check (x402 Payment)

Every token check costs $0.04 USDC, paid automatically:

from x402_client import check_risk

result = check_risk("7GCihgDB8fe6KNjn2MYtkzZcRjQy3t9GHdC8uHYmW2hr")
# Returns: {risk_score: 85, recommendation: "AVOID", risk_factors: [...]}

3. Trade Decision

if result["risk_score"] >= 80:
    print("🚨 HIGH RISK — skipping")
elif result["risk_score"] >= 40:
    # Get deeper analysis for borderline cases
    deep = marcus_forensics(token_address)
    decide_from_analysis(deep)
else:
    print("✅ LOW RISK — proceeding with trade")
    execute_trade(token_address, amount)

Available Endpoints

Endpoint Price Description
check-risk $0.04 Risk score (0-100), honeypot detection, recommendation
check-batch $0.30 Batch scan up to 20 tokens
holder-deepdive $0.10 Sniper detection, bundle analysis, whale tracking
deployer $0.06 Deployer history, serial rugger detection
token-intel $0.06 Full token intelligence (price, volume, LP lock)
marcus-quick $0.15 AI forensic verdict (Claude Sonnet 4)
marcus-forensics $0.50 Full AI investigation
marcus-ultra $2.00 Deep analysis (Claude Opus 4)
watch $0.20 7-day webhook monitoring for risk changes

Full endpoint list →

Configuration

# .env
WALLET_PRIVATE_KEY=0x...          # Your wallet private key (Base USDC)
RISK_THRESHOLD=70                  # Skip tokens above this score
DEEP_ANALYSIS_THRESHOLD=40         # Trigger deep analysis for scores 40-70
MAX_SPEND_PER_CHECK=0.50           # Max USDC per individual check
CHAIN=solana                       # Default chain
MRI_API_URL=https://cryptorugmunch.app  # API base URL

Cost Estimates

Strategy Checks/Day Daily Cost
Conservative (scan before every trade) 50 $2.00
Active trader (scan + deep on flags) 200 $10-15
Portfolio monitor (batch + watch) 10 batches $3.00 + $2.00 watches

Compare: One rug pull can cost $1K-$100K+. Risk checking costs pennies.

Extending

  • Add your own trading logic in strategies/
  • Swap the LLM — use Marcus AI tiers or bring your own
  • Multi-chain — works with Solana, Ethereum, Base, Arbitrum, Polygon, Optimism, Avalanche
  • Webhook alerts — use the watch endpoint for passive monitoring

Links

⚠️ Note: This project was formerly known as CryptoRugMunch. The $CRM token is not affiliated with Marcus Rug Intel.

License

MIT — use it however you want. If it saves you from a rug pull, consider it a win.


Built by Marcus Rug Intel — the only AI-powered crypto risk intelligence on x402.

About

Safe trading agent with Marcus Rug Intel x402 risk checks

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages