Syntra - AI-Powered Blockchain Data Querying Platform
Syntra is an intelligent blockchain data querying platform that combines the power of Hypersync with AI-driven interfaces to make blockchain data easily accessible and queryable. The platform consists of a FastAPI backend for blockchain data operations and a Next.js frontend with an AI chat interface.
Data Flow Diagram
Getting Started
Prerequisites
- Python 3.8+
- Node.js 16+
- npm or yarn
- Access to Hypersync API (bearer token configured in backend)
Backend Setup
- Navigate to the backend directory:
cd syntra-api- Create a virtual environment (recommended):
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies:
pip install -r requirements.txt- Configure Hypersync (optional, if you need a different endpoint):
Edit config/hypersync_client.py to update the URL and bearer token.
- Run the backend server:
uvicorn main:app --reload --port 8000The API will be available at http://localhost:8000 with documentation at http://localhost:8000/docs.
Frontend Setup
- Navigate to the frontend directory:
cd syntra-next- Install dependencies:
npm install- Run the development server:
npm run devThe frontend will be available at http://localhost:3000.
Features
Backend (FastAPI)
- Blockchain Data Queries: Access Ethereum blockchain data through Hypersync
- MCP Integration: Model Context Protocol (MCP) support for AI tool calling
- REST API: Comprehensive REST endpoints for blockchain data
- Available Operations:
- Transaction lookups by hash - Block data queries - ERC20 transfer tracking - Contract event logs - Wallet activity monitoring - Uniswap swap event tracking - Call decoding for contract interactions - Block rewards calculation - And more...
Frontend (Next.js)
- AI Chat Interface: Natural language interaction for blockchain queries
- MCP Chat Integration: Connects to backend via Model Context Protocol
- Real-time Updates: Live connection status and query results
- Dark Mode: Built-in theme support
- Responsive Design: Modern, mobile-friendly UI
- Quick Tasks: Pre-defined query templates for common operations
Usage
Backend API
The backend provides multiple endpoints for blockchain data queries. Here are some examples:
Get Transaction by Hash
POST /api/hypersync/txn_by_id
{
"tx_hash": "0x1234567890abcdef1234567890abcdef..."
}Get ERC20 Transfers
POST /api/hypersync/erc20_transfers
{
"from_block": 17000000,
"to_block": 17000050,
"contract_address": "0xdAC17F958D2ee523a2206206994597C13D831ec7"
}Get Wallet Activity
POST /api/hypersync/wallet_activity
{
"wallet_address": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
"from_block": 17000000,
"to_block": 17000050,
"include_erc20": true
}Full API documentation is available at http://localhost:8000/docs when the backend is running.
Frontend Chat Interface
- Start both the backend and frontend servers
- Navigate to
http://localhost:3000 - Use the chat interface to query blockchain data in natural language
- Example queries:
- "Get transactions for block 17000000" - "Show me ERC20 transfers for USDT in the last 100 blocks" - "What's the activity for wallet 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045?"
MCP Integration
The backend exposes an MCP endpoint at /mcp that allows AI systems to call blockchain querying tools. The frontend uses this integration to enable intelligent conversation about blockchain data.
Available MCP Operations:
txn_by_id- Look up a transaction by its hashblocks_transactions_hashes- Get block and transaction hasheserc20_transfers- Track ERC20 token transferscontract_logs- Get logs from specific contractsblock_data- Get detailed block informationchain_info- Get blockchain informationwallet_activity- Monitor wallet transactionserc20_transfers_and_approvals- Track transfers and approvalsblock_rewards- Calculate block rewardsblocks_and_transactions- Get full block and transaction dataevent_logs- Query specific event logsuniswap_swaps- Track Uniswap DEX swapscall_decoder- Decode contract function calls
Development
Backend Structure
syntra-api/
├── main.py # FastAPI app with MCP integration
├── routers/
│ └── hypersync_router.py # Route definitions and request models
├── functions/ # Query functions
│ ├── txn_by_id.py
│ ├── erc20_transfers.py
│ ├── wallet_activity.py
│ └── ...
└── config/
└── hypersync_client.py # Hypersync client singletonFrontend Structure
syntra-next/
└── app/
├── components/
│ ├── mcp-chat/ # Chat components
│ ├── Navbar.tsx
│ ├── QuickTasks.tsx
│ └── ThemeWrapper.tsx
├── contexts/
│ └── ThemeContext.tsx # Theme management
├── api/
│ └── mcp-chat/ # Chat API route
└── types/
└── mcp-chat.ts # TypeScript typesExample Queries
Check out the syntra-api/examples/ directory for comprehensive example scripts:
tx-by-hash.py- Query a transaction by hashall-erc20-transfers.py- Get all ERC20 transfers in a rangewallet.py- Monitor wallet activityuniswap-pool-swap-events.py- Track Uniswap swapsblock-data.py- Get detailed block information- And more...
Configuration
Backend Configuration
Edit syntra-api/config/hypersync_client.py to configure:
- Hypersync API URL
- Bearer token for authentication
Frontend Configuration
The frontend connects to the backend at http://localhost:8000. Update the MCP URL in MCPChat.tsx if your backend runs on a different address.
