ON-CHAIN ANALYTICS

Power Your Agent with On-Chain Analytics

Real-time transaction graph analysis, address clustering, protocol revenue tracking, and token flow visualization โ€” built for autonomous AI agents operating across 5 blockchains.

Start Building View MCP Config
5
Chains Indexed
10B+
Transactions Indexed
< 200ms
Avg Query Latency
99.9%
Uptime SLA
Real-time
Data Freshness
Core Capabilities

Everything Your Agent Needs to Understand the Chain

From raw transaction data to actionable signals โ€” Purple Flea on-chain analytics extracts meaning from blockchain noise so your agent can act with confidence.

๐Ÿ”—

Transaction Graph Analysis

Trace fund flows across wallets, identify transaction clusters, and map entity relationships. Detect wash trading, mixer usage, and cross-chain bridges in milliseconds.

๐Ÿท๏ธ

Address Clustering & Entity Labeling

Group addresses belonging to the same entity using heuristic and ML-based clustering. 50M+ labeled addresses including CEXs, protocols, whales, and known bad actors.

๐Ÿ“Š

Protocol Revenue Tracking

Monitor real-time fee revenue, TVL, and usage metrics across 500+ DeFi protocols. Compare protocol health over time with historical breakdowns by day/week/month.

๐ŸŒŠ

Token Flow Visualization

See exactly where tokens are moving โ€” from whales to protocols, DEX to CEX, chain to chain. Identify accumulation and distribution phases before price moves.

โš ๏ธ

Address Risk Scoring

Real-time risk assessment on any address: sanctions exposure, hack involvement, mixer interaction, and abnormal transaction patterns. Score from 0โ€“100 in under 100ms.

๐Ÿ“ˆ

DEX Volume & Liquidity Analytics

Track volume, liquidity depth, and trading pairs across Uniswap, Curve, Raydium, and 200+ other DEXs. Identify volume spikes before they show up in price.

Data Sources

Multi-Chain Coverage

Unified analytics API across all major blockchains. Query once, get data from everywhere.

Ethereum
Solana
Bitcoin
Polygon
BNB Chain
API Reference

Analytics API Endpoints

RESTful API with consistent response shapes. All endpoints return JSON and support chain parameter for multi-chain queries.

Method Endpoint Description Key Params
GET /analytics/address Full address profile: balance history, tx count, entity label, risk score, connected addresses address, chain, depth
GET /analytics/protocol Protocol metrics: TVL, daily/weekly revenue, active users, fee breakdown by pool protocol, chain, period
GET /analytics/token-flows Token transfer heatmap: top receivers, senders, net flow direction, whale movements token, chain, window, min_usd
GET /analytics/dex-volume DEX volume breakdown by pair, protocol, and time window. Supports anomaly detection flag dex, pair, chain, anomaly
GET /analytics/risk-score Instant risk assessment: sanctions, mixer, hack, scam, abnormal patterns โ€” 0 to 100 score address, chain, verbose
GET /analytics/cluster Return all addresses in the same entity cluster. Includes exchange deposits, cold wallets, contracts address, chain, confidence
Risk Scoring

Address Risk Assessment

Each address gets a composite risk score built from multiple signal categories. Your agent can gate transactions based on counterparty risk.

Risk Breakdown โ€” 0xAb5C...4F2e
Sanctions Exposure
5
Mixer Interaction
0
Hack Association
12
Abnormal Pattern
31
Scam Association
0
Overall Risk Score 18 / 100
Low risk. Entity label: Institutional Wallet. 847 outbound txs. Active since 2021-04.
Use Cases

Built for Every Agent Workflow

Trading Signal Generation

Your trading agent reads on-chain data to build proprietary signals before price moves. Whale accumulation, exchange inflows, protocol revenue growth โ€” all become tradeable edges.

  • Detect whale wallet accumulation 6โ€“24 hours before breakouts
  • Monitor exchange inflows as early selling pressure signal
  • Track protocol revenue growth as fundamental value signal
  • Alert on unusual DEX volume concentration in specific pairs
Signal Dashboard โ€” ETH/USDC
Whale Accumulation (24h) +$42M โ†‘
Exchange Inflow (24h) +$18M โ†‘
DEX Volume Spike +340% vs avg
Composite Signal BULLISH (0.72)

Compliance & Risk Management

Escrow agents and payment agents must verify counterparty risk before releasing funds. Our risk API integrates directly into payment flows for real-time AML screening.

  • Screen every counterparty address before accepting payments
  • Block transactions with mixer-tainted or sanctioned funds
  • Auto-escalate high-risk addresses for human review
  • Export audit trail for compliance reporting
Compliance Gate โ€” Incoming Payment
Sender0x7c3D...9A1b
Amount500 USDC
Risk Score3 / 100
Entity LabelClean Wallet
โœ“ CLEARED โ€” Payment Accepted
Code Example

Python Agent Using On-Chain Signals

A complete example showing how an AI trading agent uses on-chain analytics to generate and execute trade decisions on Purple Flea.

Python on_chain_trading_agent.py
import requests
import time
from dataclasses import dataclass
from typing import Optional

# Purple Flea API configuration
BASE_URL = "https://purpleflea.com"
API_KEY  = "pf_live_your_key_here"

HEADERS = {
    "Authorization": f"Bearer {API_KEY}",
    "Content-Type": "application/json"
}

@dataclass
class OnChainSignal:
    token: str
    whale_accumulation_usd: float
    exchange_inflow_usd: float
    dex_volume_ratio: float   # current / 30d avg
    risk_score: int
    composite_score: float    # -1.0 (bearish) to +1.0 (bullish)


def fetch_on_chain_signal(token: str, chain: str = "ethereum") -> OnChainSignal:
    """Fetch composite on-chain signal for a token."""

    # Get token flow data
    flows = requests.get(
        f"{BASE_URL}/analytics/token-flows",
        params={"token": token, "chain": chain, "window": "24h"},
        headers=HEADERS
    ).json()

    # Get DEX volume (compare to 30d average)
    dex = requests.get(
        f"{BASE_URL}/analytics/dex-volume",
        params={"pair": f"{token}/USDC", "chain": chain, "anomaly": "true"},
        headers=HEADERS
    ).json()

    whale_net    = flows.get("whale_net_usd", 0)
    exch_inflow  = flows.get("exchange_inflow_usd", 0)
    vol_ratio    = dex.get("volume_vs_30d_avg", 1.0)

    # Build composite signal:
    # +whale_acc, -exchange_inflow, +dex_spike
    composite = 0.0
    if whale_net > 5_000_000:
        composite += 0.35
    if exch_inflow < 2_000_000:
        composite += 0.25
    if vol_ratio > 2.5:
        composite += 0.20
    if exch_inflow > 15_000_000:
        composite -= 0.40

    return OnChainSignal(
        token=token,
        whale_accumulation_usd=whale_net,
        exchange_inflow_usd=exch_inflow,
        dex_volume_ratio=vol_ratio,
        risk_score=0,
        composite_score=max(-1.0, min(1.0, composite))
    )


def execute_trade_if_signal_strong(signal: OnChainSignal, threshold: float = 0.5):
    """Open a perp position if signal is strong enough."""

    if signal.composite_score >= threshold:
        side = "long"
        notional = 1000   # USDC
    elif signal.composite_score <= -threshold:
        side = "short"
        notional = 1000
    else:
        print(f"Signal too weak ({signal.composite_score:.2f}), holding.")
        return None

    # Submit via Purple Flea Trading API
    order = requests.post(
        f"{BASE_URL}/trading/perps/open",
        json={
            "symbol": f"{signal.token}-PERP",
            "side": side,
            "notional_usdc": notional,
            "leverage": 3,
            "signal_source": "on-chain-analytics"
        },
        headers=HEADERS
    ).json()

    print(f"Opened {side} {signal.token} | "
          f"Score: {signal.composite_score:.2f} | "
          f"Order ID: {order.get('order_id')}")
    return order


# Main agent loop
WATCHLIST = ["ETH", "SOL", "BTC", "MATIC"]

if __name__ == "__main__":
    while True:
        for token in WATCHLIST:
            signal = fetch_on_chain_signal(token)
            print(f"{token}: composite={signal.composite_score:.2f}, "
                  f"whale={signal.whale_accumulation_usd/1e6:.1f}M, "
                  f"vol_ratio={signal.dex_volume_ratio:.1f}x")
            execute_trade_if_signal_strong(signal)
        time.sleep(3600)  # Re-evaluate every hour

Start Reading the Chain Today

Get your API key, connect to the on-chain analytics endpoints, and give your agent the data edge it needs.

Get API Access Explore Wallet API