BlockGuardian is a comprehensive blockchain security and monitoring platform that helps organizations protect their blockchain assets, detect vulnerabilities, and ensure compliance with regulatory requirements.
- Overview
- Project Structure
- Key Features
- Architecture
- Technology Stack
- Installation & Setup
- Key Scripts
- Infrastructure
- Testing
- CI/CD Pipeline
- Documentation
- Contributing
- License
BlockGuardian provides a robust set of tools for monitoring blockchain networks, analyzing smart contract vulnerabilities, detecting suspicious transactions, and ensuring compliance with regulatory requirements. The platform combines advanced security techniques with user-friendly interfaces to make blockchain security accessible to organizations of all sizes.
The project is organized into several main components:
BlockGuardian/
├── code/ # Core backend logic, services, and shared utilities
├── docs/ # Project documentation
├── infrastructure/ # DevOps, deployment, and infra-related code
├── mobile-frontend/ # Mobile application
├── web-frontend/ # Web dashboard
├── scripts/ # Automation, setup, and utility scripts
├── LICENSE # License information
└── README.md # Project overview and instructions
- Real-time Transaction Monitoring: Track and analyze blockchain transactions as they occur
- Anomaly Detection: Identify suspicious patterns and potential security threats
- Smart Contract Auditing: Automated and manual auditing tools for smart contract code
- Vulnerability Scanning: Detect common security vulnerabilities in blockchain applications
- Regulatory Compliance: Tools to ensure adherence to relevant regulations (GDPR, AML, KYC)
- Audit Trail: Immutable record of all security-related activities
- Risk Assessment: Evaluate and quantify security risks in blockchain implementations
- Governance Framework: Establish and enforce security policies for blockchain operations
- Security Dashboards: Visualize security metrics and KPIs
- Incident Response: Tools for managing and responding to security incidents
- Forensic Analysis: Investigate security breaches and unauthorized activities
- Compliance Reporting: Generate reports for regulatory compliance
- Secure Development Guidelines: Best practices for blockchain development
- Code Analysis: Static and dynamic analysis tools for smart contracts
- Testing Framework: Comprehensive testing tools for blockchain applications
- Security Plugins: Integrations with popular development environments
BlockGuardian follows a modular architecture with the following components:
BlockGuardian/
├── Core Services
│ ├── Monitoring Engine
│ ├── Analysis Engine
│ ├── Alert System
│ └── Reporting Service
├── Frontend Applications
│ ├── Web Dashboard
│ └── Mobile App
├── Blockchain Connectors
│ ├── Ethereum Connector
│ ├── Bitcoin Connector
│ ├── Solana Connector
│ └── Other Chain Connectors
└── Infrastructure
├── Database Cluster
├── Message Queue
├── Cache Layer
└── API Gateway
- Languages: Python, Rust, Go
- Frameworks: FastAPI, Actix, Gin
- Database: PostgreSQL, MongoDB, Redis
- Message Queue: Kafka, RabbitMQ
- Blockchain: Web3.py, ethers.js, Solidity
- Framework: React with TypeScript
- State Management: Redux Toolkit
- Data Visualization: D3.js, Recharts
- Styling: Tailwind CSS, Styled Components
- Web3: ethers.js, web3.js
- Framework: React Native
- Navigation: React Navigation
- State Management: Redux Toolkit
- UI Components: React Native Paper
- Containerization: Docker
- Orchestration: Kubernetes
- CI/CD: GitHub Actions
- Monitoring: Prometheus, Grafana
- Infrastructure as Code: Terraform, Ansible
- Docker and Docker Compose
- Node.js (v16+)
- Python (v3.9+)
- Go (v1.18+)
- Rust (latest stable)
The easiest way to set up the development environment is to use the provided setup script:
# Clone the repository
git clone https://github.com/quantsingularity/BlockGuardian.git
cd BlockGuardian
# Run the setup script
./setup_blockguardian_env.sh
# Start the application
./run_blockguardian.sh-
Backend (
backend/):- Navigate to the
backenddirectory:cd backend - Create a virtual environment:
python -m venv venv - Activate the virtual environment:
source venv/bin/activate(Linux/Mac) orvenv\Scripts\activate(Windows) - Install dependencies:
pip install -r requirements.txt - Set up environment variables:
cp .env.example .envand edit as needed - Run the development server:
uvicorn main:app --reload
- Navigate to the
-
Mobile Frontend (
mobile-frontend/):- Navigate to the
mobile-frontenddirectory:cd mobile-frontend - Install dependencies:
npm installoryarn install - Start the development server:
npm startoryarn start - Run on Android or iOS:
yarn android # or npx react-native run-android yarn ios # or npx react-native run-ios
- Navigate to the
-
Web Frontend (
web-frontend/):- Navigate to the
web-frontenddirectory:cd web-frontend - Install dependencies:
npm install - Run in development mode:
npm run dev(usually accessible athttp://localhost:3000) - Build for production:
npm run build - Start production server:
npm run start
- Navigate to the
A docker-compose.yml file is provided at the root to simplify running the core services (backend, web-frontend). Other services like blockchain nodes or data analysis environments might need separate management or integration into the Docker Compose setup if desired.
# From the project root directory
docker-compose up --buildThe repository includes several utility scripts to simplify common tasks:
setup_blockguardian_env.sh: Sets up the development environmentrun_blockguardian.sh: Starts the applicationlint-all.sh: Runs linting on all codevalidate_code_quality.py: Validates code quality and security
The project maintains comprehensive test coverage across all components to ensure reliability and security.
| Component | Coverage | Status |
|---|---|---|
| Backend Services | 82% | ✅ |
| Smart Contracts | 90% | ✅ |
| Blockchain Connectors | 75% | ✅ |
| Web Frontend | 72% | ✅ |
| Mobile Frontend | 68% | ✅ |
| Overall | 79% | ✅ |
- Backend API endpoint tests
- Smart contract function tests
- Frontend component tests
- Blockchain connector tests
- End-to-end workflow tests
- Cross-service integration tests
- API contract tests
- Blockchain interaction tests
- Smart contract vulnerability scans
- Penetration testing
- Dependency vulnerability scanning
- Access control testing
To run tests:
# Backend tests
cd backend
pytest
# Smart contract tests
cd blockchain-contracts
npx hardhat test
# Frontend tests
cd web-frontend
npm testBlockGuardian uses GitHub Actions for continuous integration and deployment:
| Stage | Control Area | Institutional-Grade Detail |
|---|---|---|
| Formatting Check | Change Triggers | Enforced on all push and pull_request events to main and develop |
| Manual Oversight | On-demand execution via controlled workflow_dispatch |
|
| Source Integrity | Full repository checkout with complete Git history for auditability | |
| Python Runtime Standardization | Python 3.10 with deterministic dependency caching | |
| Backend Code Hygiene | autoflake to detect unused imports/variables using non-mutating diff-based validation |
|
| Backend Style Compliance | black --check to enforce institutional formatting standards |
|
| Non-Intrusive Validation | Temporary workspace comparison to prevent unauthorized source modification | |
| Node.js Runtime Control | Node.js 18 with locked dependency installation via npm ci |
|
| Web Frontend Formatting Control | Prettier checks for web-facing assets | |
| Mobile Frontend Formatting | Prettier enforcement for mobile application codebases | |
| Documentation Governance | Repository-wide Markdown formatting enforcement | |
| Infrastructure Configuration | Prettier validation for YAML/YML infrastructure definitions | |
| Compliance Gate | Any formatting deviation fails the pipeline and blocks merge |
For detailed documentation, please refer to the following resources:
| Document | Path | Description |
|---|---|---|
| README | README.md |
High-level overview, project scope, and quickstart |
| API Reference | API.md |
Detailed documentation for all API endpoints |
| CLI Reference | CLI.md |
Command-line interface usage, commands, and examples |
| Installation Guide | INSTALLATION.md |
Step-by-step installation and environment setup |
| User Guide | USAGE.md |
Comprehensive guide for end-users, workflows, and examples |
| Contributing Guidelines | CONTRIBUTING.md |
Contribution process, coding standards, and PR requirements |
| Architecture Overview | ARCHITECTURE.md |
System architecture, components, and design rationale |
| Configuration Guide | CONFIGURATION.md |
Configuration options, environment variables, and tuning |
| Feature Matrix | FEATURE_MATRIX.md |
Feature capabilities, coverage, and roadmap alignment |
| Troubleshooting | TROUBLESHOOTING.md |
Common issues, diagnostics, and remediation steps |
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
