Intelligence Engine Active

Ethereum Intelligence
& Forensics Engine

Indexes Ethereum, reconstructs what happened, maps relationships, and detects unusual behavior. 392 blocks/sec pipeline (E1: mock RPC, zero latency, PG17 β€” see Benchmarks). 176 tests passing.

⚑
0
Blocks/sec
Pipeline throughput
πŸ”¬
0
Decode b/s
Pure CPU, no I/O
βœ…
0
Tests
0 failures, 0 warnings
🧠
10
Intelligence
Modules active
Performance

Benchmarks

E1 Replay: mock RPC fixtures, zero latency, single committer, PostgreSQL 17. Synthetic blocks (~1 tx/block). Hardware not recorded β€” see docs/BENCHMARKS.md for methodology and repro steps.

⚑
Pipeline Throughput

1 worker
392 b/s
2 workers
382 b/s
4 workers
376 b/s
8 workers
208 b/s
16 workers
60 b/s

Bottleneck is DB commit path (~2.5ms/block), not fetch workers.

πŸ”¬
Decode Latency

empty block
28ns
legacy tx
67ns
contract create
65ns
ERC-721
126ns
EIP-1559+ERC20
151ns
multi-tx+logs
242ns

Pure CPU β€” no I/O, no allocations beyond output vectors.

0
blocks/sec decode β€” Mock RPC, zero latency, no DB writes
4,250x
faster than pipeline
~0%
CPU at 100 b/s
O(n)
scales linearly
Design

Pipeline Architecture

Bounded channels, single-writer committer, structural backpressure.

πŸ‘οΈ
Head Watcher
Polls chain head
β†’
πŸ“‹
Scheduler
Dispatches blocks
β†’
βš™οΈ
Workers (N)
Fetch + Decode
β†’
πŸ“¦
Sequencer
Reorder ascending
β†’
πŸ’Ύ
Committer
Single PG tx/block
β†’
🐘
PostgreSQL
Durable storage
πŸ”„
Reorg Handler
Rollback + re-index
βœ“
Cursor in same transaction as dataCrash recovery = single SELECT
βœ“
Natural primary keysIdempotent writes, no sequences
βœ“
Hard-delete on reorgClean read paths, audit table preserves history
βœ“
Bounded channels throughoutStructural backpressure, no OOM
Intelligence Engine

Beyond Indexing

Turns raw blockchain data into explainable intelligence.

πŸ”

Transaction Explanation

Decodes ETH transfers, ERC-20/721/1155, DEX swaps (Uniswap V2/V3, 1inch), WETH, Aave, Compound.

πŸ“Š

Address Intelligence

Activity stats, ETH/token volumes, behavioral classification, relationship graph.

πŸ“‹

Contract Intelligence

Deployment info, unique callers, function selectors, interface detection.

⚑

MEV Detection

Sandwich patterns, arbitrage, priority fee anomalies, repeated protocol interactions.

βš™οΈ

Background Processing

Intelligence computed incrementally as blocks are indexed. API reads from pre-computed data.

⚠️

Anomaly Detection

Large transfers, activity spikes, new wallet high-value, coordinated activity.

πŸ•ΈοΈ

Relationship Graph

Bounded BFS traversal mapping address interactions with depth/limit controls.

πŸ“‘

WebSocket

Real-time updates for block commits, anomalies, MEV detection, and reorgs.

πŸ”—

Address Clustering

Groups related addresses by interaction patterns. Find contract deployers and token whales.

πŸ“Š

Export & Trends

CSV/JSON export for transactions and anomalies. Historical trend queries over time.

Capabilities

Core Features

Production-grade Ethereum infrastructure built in Rust.

⟠

ERC-20/721/1155

Transfer events decoded into typed tables. Token transfers indexed for fast queries.

πŸ”„

Reorg Handling

Detects chain reorganizations, identifies common ancestor, rolls back atomically.

πŸ“‘

Prometheus Metrics

20+ metrics: blocks/sec, tx/sec, intelligence ops, RPC latency, DB commit time.

🌐

Query API

Axum REST API with 20+ endpoints. Block, transaction, address, intelligence, anomalies, export.

πŸ›‘οΈ

Security

API key auth, rate limiting, read-only API, RedactedUrl prevents credential leaks.

🐳

Docker Ready

Multi-stage Dockerfile, production docker-compose, PostgreSQL + Prometheus + Grafana.

Quality

Test Results

232 tests, 0 clippy warnings.

All Tests Passing

194
Total
0
Failures
0
Warnings
config26
decode/block15
decode/erc2017
rpc/http4
rpc/retry9
rpc/ratelimit4
rpc/types6
store13
domain4
intelligence48
integration7
crash recovery5*
Status

Project Phases

All 9 implementation phases complete.

βœ“
1Indexer Core
βœ“
2Transaction Actions
βœ“
3Address Intelligence
βœ“
4Relationship Graph
βœ“
5Anomaly Detection
βœ“
6MEV Analysis
βœ“
7API Integration
βœ“
8Frontend
βœ“
9Testing & Polish
Interface

Query API

Axum-based REST API with keyset pagination.

EndpointDescription
GET /block/{number_or_hash}Block by number or hash
GET /transaction/{hash}Transaction by hash
GET /address/{address}/transactionsAddress history with keyset pagination
GET /contract/{address}/eventsContract events filtered by topic
GET /healthHealth check
GET /statusCursor position, finalized height, lag
Setup

Quick Start

Get running in 3 commands.

# Clone and configure
git clone https://github.com/VarunGore36/ChainLens.git
cd ChainLens
cp .env.example .env  # add your RPC endpoint

# Start PostgreSQL
docker compose up -d

# Run the indexer
cargo run --bin chainlens

# Run the API (separate terminal)
cargo run --bin api  # http://127.0.0.1:8080