ChainPulse
ChainPulse is a real-time blockchain event notification and visualization system that integrates smart account functionality (ERC-4337), event indexing (Envio), real-time notifications (WebSocket), an
视频
描述
# ChainPulse - Real-time Blockchain Event Notification & Visualization System
## 🚀 Project Overview
**ChainPulse** is a comprehensive Web3 platform that provides real-time blockchain event monitoring, smart account integration, and data visualization. The system combines event indexing, instant notifications, and interactive dashboards to deliver seamless blockchain interaction experiences.
### 🎯 Core Value Proposition
- **Real-time Monitoring**: Instant notifications for on-chain events (transfers, swaps, NFT mints, etc.)
- **Smart Account Integration**: ERC-4337 Account Abstraction with automated response capabilities
- **Comprehensive Visualization**: Dynamic charts and dashboards for blockchain activity analysis
- **Multi-channel Notifications**: Web, Telegram, and Discord integration
- **Extensible Architecture**: Support for multiple chains and event types
---
## 🏗️ System Architecture
### Technology Stack
#### Frontend
- **Framework**: Next.js 15.2.4 with App Router
- **Language**: TypeScript 5.x
- **Styling**: Tailwind CSS 4.1.9 with custom animations
- **UI Components**: Shadcn/UI (50+ components) + Radix UI
- **Web3**: Wagmi + Viem + RainbowKit for wallet integration
- **Charts**: Recharts for data visualization
- **Real-time**: Socket.IO client for WebSocket connections
#### Backend
- **Runtime**: Node.js with Express.js
- **Language**: TypeScript
- **Database**: PostgreSQL with Prisma ORM
- **Authentication**: JWT with wallet signature verification
- **Real-time**: Socket.IO server for WebSocket communication
- **GraphQL**: Apollo Server for data queries
- **Rate Limiting**: Express-rate-limit for API protection
#### Blockchain & Indexing
- **Smart Contracts**: Solidity with ERC-4337 Account Abstraction
- **Indexer**: Envio for real-time event indexing
- **Networks**: Ethereum, Polygon, Arbitrum, Optimism, Base, Monad Testnet
- **Development**: Hardhat framework with comprehensive testing
#### Infrastructure
- **Database**: PostgreSQL (Local/Supabase)
- **Deployment**: Docker containerization ready
- **Monitoring**: Winston logging with structured logs
---
## ✅ Completed Features
### 🎨 Frontend (100% Complete)
- ✅ **Complete UI/UX Design**: Modern glass-morphism design with dark/light themes
- ✅ **Wallet Integration**: RainbowKit with multi-wallet support
- ✅ **Authentication Flow**: Signature-based login with persistent sessions
- ✅ **Dashboard Components**:
- Smart Account Status panel
- Event Subscriptions management
- Notification center with filtering
- Real-time activity feed
- Analytics charts (4 types)
- ✅ **Responsive Design**: Mobile-first approach with adaptive layouts
- ✅ **Internationalization**: English/Chinese language support
- ✅ **Animation System**: Framer Motion with smooth transitions
- ✅ **50+ UI Components**: Complete Shadcn/UI integration
### 🔧 Backend (95% Complete)
- ✅ **RESTful API**: 52 endpoints across 7 modules
- Authentication (3 endpoints)
- User Management (4 endpoints)
- Smart Accounts (8 endpoints)
- Event Subscriptions (7 endpoints)
- Notifications (6 endpoints)
- Analytics (12 endpoints)
- Automation Rules (6 endpoints)
- Integrations (6 endpoints)
- ✅ **WebSocket Server**: Real-time event broadcasting
- ✅ **Database Schema**: 10 tables with proper relationships
- ✅ **Authentication System**: JWT + wallet signature verification
- ✅ **Rate Limiting**: API protection with configurable limits
- ✅ **Error Handling**: Comprehensive error management
- ✅ **Logging System**: Structured logging with Winston
- ✅ **Data Validation**: Zod schemas for all endpoints
### 🗄️ Database (100% Complete)
- ✅ **Schema Design**: Complete ERD with 10 tables
- ✅ **Relationships**: Proper foreign keys and constraints
- ✅ **Indexing**: Optimized queries with strategic indexes
- ✅ **Partitioning**: Monthly partitioning for large tables
- ✅ **Security**: Row Level Security (RLS) policies
- ✅ **Seed Data**: Comprehensive mock data for testing
- ✅ **Migration Scripts**: Prisma-based database migrations
### 📊 Smart Contracts (90% Complete)
- ✅ **ERC-4337 Implementation**: SimpleAccount with factory pattern
- ✅ **Account Abstraction**: Gas abstraction and batch transactions
- ✅ **Security Features**: Multi-signature and social recovery
- ✅ **Testing Suite**: Comprehensive Hardhat tests
- ✅ **Deployment Scripts**: Automated deployment with verification
- ✅ **Gas Optimization**: Efficient contract design
### 🔍 Event Indexing (90% Complete)
- ✅ **Envio Configuration**: Complete schema and event handlers
- ✅ **GraphQL Schema**: Structured data queries
- ✅ **Event Processing**: Real-time blockchain event capture
- ✅ **Multi-chain Support**: Configuration for 6+ networks
- ✅ **Data Aggregation**: Event statistics and analytics
### 🔗 Integration (85% Complete)
- ✅ **Frontend-Backend**: Complete API integration
- ✅ **Authentication Flow**: Wallet connection and session management
- ✅ **Real-time Updates**: WebSocket event streaming
- ✅ **Mock Data System**: Comprehensive test data generation
- ✅ **Development Tools**: Prisma Studio, API documentation
---
## 🚧 Pending Features
### 🌐 Deployment (0% Complete)
- ⬜ **Smart Contract Deployment**: Deploy to testnets and mainnet
- ⬜ **Envio Cloud Deployment**: Production indexer deployment
- ⬜ **Frontend Deployment**: Vercel/Netlify hosting
- ⬜ **Backend Deployment**: Railway/Heroku hosting
- ⬜ **Database Hosting**: Production PostgreSQL setup
### 🔧 Advanced Features (20% Complete)
- ⬜ **Automation Engine**: Smart contract interaction automation
- ⬜ **Advanced Analytics**: Complex data aggregation and insights
- ⬜ **Multi-chain Expansion**: Additional blockchain networks
- ⬜ **Mobile App**: React Native mobile application
- ⬜ **API Rate Plans**: Tiered access with usage limits
### 🔌 Third-party Integrations (30% Complete)
- ⬜ **Telegram Bot**: Automated notification bot
- ⬜ **Discord Webhook**: Server notification integration
- ⬜ **Email Notifications**: SMTP-based email alerts
- ⬜ **Slack Integration**: Workspace notification system
### 🧪 Testing & Quality (60% Complete)
- ✅ **Unit Tests**: Backend service layer testing
- ✅ **Smart Contract Tests**: Comprehensive Hardhat test suite
- ⬜ **Integration Tests**: End-to-end API testing
- ⬜ **Frontend Tests**: React component testing
- ⬜ **Performance Tests**: Load testing and optimization
---
## 📊 Development Progress
```
Overall Progress: ████████████████████░ 85%
Frontend: ████████████████████ 100% ✅
Backend: ███████████████████░ 95% ✅
Database: ████████████████████ 100% ✅
Smart Contracts: ██████████████████░░ 90% ✅
Event Indexing: ██████████████████░░ 90% ✅
Integration: █████████████████░░░ 85% ✅
Deployment: ░░░░░░░░░░░░░░░░░░░░ 0% ⬜
Testing: ████████████░░░░░░░░ 60% 🔄
```
### Key Achievements
- **52 REST API endpoints** implemented and tested
- **50+ UI components** with modern design system
- **Complete database schema** with 10 tables and relationships
- **ERC-4337 smart contracts** with factory pattern
- **Real-time WebSocket** communication system
- **Comprehensive mock data** for development and testing
- **Multi-language support** (English/Chinese)
- **Responsive design** for all screen sizes
---
## 🚀 Quick Start
### Prerequisites
- Node.js 20+
- PostgreSQL 14+
- Git
### Installation
```bash
# Clone repository
git clone https://github.com/gerrardLT/ChainPulse.git
cd ChainPulse
# Install dependencies
npm install
# Setup database
cd backend
npm run prisma:migrate
npm run db:seed
# Start development servers
npm run dev # Backend (port 4000)
# In new terminal
cd frontend
npm run dev # Frontend (port 3000)
```
---
## 📁 Project Structure
```
ChainPulse/
├── frontend/ # Next.js application
│ ├── app/ # App Router pages
│ ├── components/ # React components
│ ├── hooks/ # Custom React hooks
│ ├── lib/ # Utilities and API clients
│ └── public/ # Static assets
├── backend/ # Node.js API server
│ ├── src/ # Source code
│ ├── prisma/ # Database schema and migrations
│ └── tests/ # Test suites
├── contracts/ # Smart contracts
│ ├── contracts/ # Solidity contracts
│ ├── scripts/ # Deployment scripts
│ └── test/ # Contract tests
├── indexer/ # Envio indexer
│ ├── config.yaml # Indexer configuration
│ ├── schema.graphql # GraphQL schema
│ └── src/ # Event handlers
├── database/ # SQL scripts
└── docs/ # Documentation
```
---
## 🎯 Next Steps
### Immediate Priorities (Next 2 weeks)
1. **Smart Contract Deployment**: Deploy to Monad Testnet and Ethereum Sepolia
2. **Envio Indexer Deployment**: Set up production event indexing
3. **Integration Testing**: End-to-end functionality verification
4. **Performance Optimization**: Database query optimization and caching
### Medium-term Goals (1-2 months)
1. **Production Deployment**: Full system deployment to cloud platforms
2. **Advanced Analytics**: Complex data visualization and insights
3. **Mobile Application**: React Native app development
4. **Third-party Integrations**: Telegram and Discord bots
### Long-term Vision (3-6 months)
1. **Multi-chain Expansion**: Support for additional blockchain networks
2. **Enterprise Features**: Advanced automation and workflow management
3. **API Monetization**: Tiered access plans and usage-based pricing
4. **Community Features**: User-generated content and social features
---
### Development Guidelines
- **Code Quality**: TypeScript strict mode, ESLint, Prettier
- **Testing**: Unit tests for all business logic
- **Documentation**: Comprehensive inline and external documentation
- **Git Workflow**: Feature branches with detailed commit messages
### Key Documentation
- [Product Requirements](docs/产品需求文档.md)
- [Technical Architecture](docs/系统技术架构.md)
- [Database Design](docs/数据库设计.md)
- [API Documentation](docs/API设计.md)
- [Development Tasks](docs/开发任务清单.md)
---
## 📄 License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
---
本次黑客松进展
- **Real-time Monitoring**: Instant notifications for on-chain events (transfers, swaps, NFT mints, etc.) - **Smart Account Integration**: ERC-4337 Account Abstraction with automated response capabilities - **Comprehensive Visualization**: Dynamic charts and dashboards for blockchain activity analysis - **Multi-channel Notifications**: Web, Telegram, and Discord integration - **Extensible Architecture**: Support for multiple chains and event types
技术栈
React
Next
Web3
Ethers