BlockScoutLens

AI-powered blockchain analysis bot using Blockscout MCP. Ask questions, get insights! 🔍⛓️

BlockScoutLens

Created At

ETHOnline 2025

Project Description

BlockscoutLens is an AI-powered Telegram bot that makes blockchain data accessible through natural language conversations. Instead of navigating complex blockchain explorers, users simply ask questions and receive intelligent, contextual answers.

The Problem

Traditional blockchain explorers present raw data (transaction hashes, hex values, gas fees) that requires technical expertise to interpret. Users must navigate multiple pages, understand complex terminology, and manually piece together information.

Our Solution

BlockscoutLens combines OpenAI's GPT-4o model with Blockscout's MCP (Model Context Protocol) server to provide:

  • Natural Language Queries: Ask "Is vitalik.eth a trader or holder?" instead of manually analyzing transaction history
  • AI Reasoning: Not just data dumps - the bot identifies patterns, assesses risks, and explains what the data actually means
  • Multi-Chain Support: One interface for Ethereum, Optimism, Base, Arbitrum, Polygon, and more
  • Instant Insights: "This wallet appears to be a long-term DeFi holder based on its interaction patterns" vs just showing numbers

Technical Implementation

The bot uses OpenAI's Responses API with native MCP support to connect to Blockscout's MCP server. This is crucial: we're using the Model Context Protocol (not raw REST APIs) which allows the AI to intelligently discover tools, chain multiple queries, and reason about blockchain data contextually.

Flow:

  1. User asks a question via Telegram
  2. OpenAI Responses API receives the query
  3. AI connects to Blockscout MCP server and discovers available tools
  4. AI intelligently selects and calls relevant tools (get_address_info, get_transactions, etc.)
  5. AI analyzes the returned blockchain data
  6. Bot delivers synthesized insights to the user

Why MCP matters: It's designed for AI consumption with structured schemas and clear tool descriptions, enabling better reasoning than raw API calls. Blockscout can track our MCP usage through their analytics, validating proper implementation.

Key Features

  • Wallet behavior analysis (trader/holder/bot detection)
  • Transaction explanations in simple terms
  • Smart contract interaction breakdown
  • Multi-chain blockchain queries
  • Pattern and anomaly detection
  • Risk assessment

Tech Stack

Node.js, OpenAI Responses API (GPT-4o), Blockscout MCP Server, Model Context Protocol, Telegram Bot API

Impact

Makes blockchain data accessible to everyone - from newcomers learning about crypto to experienced traders needing quick analysis. Demonstrates practical AI reasoning over blockchain data using standardized protocols (MCP), not just API wrappers.

How it's Made

Tech Stack

Core Technologies:

  • Node.js - Runtime environment
  • OpenAI Responses API - LLM with native MCP support (GPT-4o model)
  • Blockscout MCP Server - Blockchain data via Model Context Protocol
  • Telegram Bot API - User interface (node-telegram-bot-api)

Architecture

The bot follows a simple three-layer architecture:

Telegram User → Bot (Node.js) → OpenAI Responses API → Blockscout MCP Server → Blockchain Data

Key Implementation Detail: We use OpenAI's native MCP integration through the Responses API, not custom REST wrappers. This is critical because:

  • The AI automatically discovers available tools from Blockscout
  • It can intelligently chain multiple MCP tool calls
  • Results in better reasoning vs traditional function calling

Code Flow

// Simple but powerful - OpenAI handles all MCP communication
const resp = await openai.responses.create({
  model: "gpt-4o",
  tools: [{
    type: "mcp",
    server_url: "https://mcp.blockscout.com/mcp",
    // AI discovers and calls tools automatically
  }],
  input: userQuestion
});

The magic happens behind the scenes: OpenAI connects to the MCP server, discovers 18+ tools (get_address_info, get_transactions, get_tokens, etc.), and intelligently selects which ones to call based on the user's natural language query.

Smart Prompt Engineering

We crafted a system prompt that makes the AI context-aware:

  • For simple queries (latest block) → concise answers
  • For complex queries (wallet analysis) → deep insights
  • Automatically detects when analysis adds value vs when it's just fluff

This prevents the AI from over-explaining simple data points while ensuring complex questions get thorough analysis.

Partner Technology: Blockscout MCP

Using Blockscout's official MCP server (mcp.blockscout.com) gave us:

  • 18+ blockchain tools out of the box (address lookup, transaction analysis, token data, NFTs, contract ABIs, etc.)
  • Multi-chain support without writing any chain-specific code
  • Validated implementation - Blockscout tracks MCP usage through their analytics, proving we're using the protocol correctly

Notable/Hacky Bits

Markdown Fallback: Telegram's Markdown parsing can be strict. We try to send with Markdown formatting first, then gracefully fallback to plain text if it fails:

try {
  await bot.sendMessage(chatId, answer, { parse_mode: 'Markdown' });
} catch {
  await bot.sendMessage(chatId, answer); // Fallback to plain text
}

Zero Custom Blockchain Code: The entire bot is ~100 lines. No web3 libraries, no RPC calls, no chain-specific logic. Everything is handled through the MCP protocol - we just ask questions and get intelligent answers.

Why This Approach Works

Traditional approach would require:

  • Multiple blockchain libraries (ethers.js, viem, etc.)
  • RPC endpoint management
  • Chain-specific logic for each network
  • Custom data parsing and formatting
  • Separate AI integration

Our approach:

  • One API call to OpenAI
  • MCP handles all blockchain complexity
  • AI does the reasoning automatically
  • Works across all Blockscout-supported chains

The result: more time building features, less time wrestling with blockchain infrastructure.

background image mobile

Join the mailing list

Get the latest news and updates