Production-grade crypto/blockchain client skeleton in modern C++ (C++20/23)
- Quick Start
- Architecture
- Development
- Docker Services
- Monitoring & Observability
- Project Structure
- Documentation
- Development Guidelines
- Security Features
- Performance
- CI/CD Pipeline
- Roadmap
- Contributing
- Docker & Docker Compose - Container orchestration
- CMake 3.20+ - Build system
- Conan 2.0+ - Dependency management
- C++20 compiler - GCC 11+, Clang 14+, MSVC 2019+
# Start all services
docker compose up -d
# Build the project
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Debug
make -j$(nproc)
# Run tests
ctest --output-on-failure
# Run specific tests
ctest -R "core_tests" --output-on-failure| Service | Purpose | Port | Status |
|---|---|---|---|
| PostgreSQL | Persistent blockchain data | 5432 | Ready |
| Redis | Caching layer for explorer | 6379 | Ready |
| chainforge-node | Full node service | 8080, 8545 | Building |
| chainforge-explorer | Blockchain explorer API | 8081, 4000 | Building |
| Prometheus | Metrics collection | 9090 | Ready |
| Grafana | Metrics visualization | 3000 | Ready |
| Jaeger | Distributed tracing | 16686 | Ready |
┌─────────────────────────────────────────────────────────────┐
│ ChainForge System │
├─────────────────────────────────────────────────────────────┤
│ Explorer API │ Node Service │ Tools Service │
├─────────────────────────────────────────────────────────────┤
│ RPC Server │ P2P Network │ Consensus │
├─────────────────────────────────────────────────────────────┤
│ Execution │ Storage │ Core Models │
├─────────────────────────────────────────────────────────────┤
│ Crypto │ Mempool │ Metrics │
└─────────────────────────────────────────────────────────────┘| Category | Technology | Purpose |
|---|---|---|
| Language | C++20/23 | Core implementation |
| Build | CMake + Conan | Build system & deps |
| Container | Docker | Application packaging |
| Orchestration | Kubernetes | Production deployment |
| Database | RocksDB + PostgreSQL | Storage & persistence |
| Cache | Redis | Performance optimization |
| Networking | Boost.Asio + libp2p | P2P communication |
| Security | OpenSSL + libsecp256k1 | Cryptographic operations |
| Monitoring | Prometheus + Grafana | Observability |
| Tracing | Jaeger + OpenTelemetry | Distributed tracing |
# Configure build
cmake -B build -S . -DCMAKE_BUILD_TYPE=Release
# Build all targets
cmake --build build --parallel
# Run tests
cmake --build build --target test
# Install
cmake --build build --target install
# Clean build
cmake --build build --target clean# Code formatting
make format
# Linting
make lint
# Testing
make test
# Docker operations
make docker-up
make docker-down
make docker-logs
# Security checks
make security-check
# SBOM generation
make sbom- Prometheus:
http://localhost:9090- Metrics collection - Grafana:
http://localhost:3000- Dashboards & visualization - Jaeger:
http://localhost:16686- Distributed tracing - Node Metrics:
http://localhost:8080/metrics- ChainForge metrics - Explorer Metrics:
http://localhost:8081/metrics- Explorer metrics
| Metric | Description | Target |
|---|---|---|
| Block Height | Current blockchain height | Real-time |
| Transaction Rate | TPS (Transactions per second) | >10,000 TPS |
| Active Peers | Connected P2P nodes | >50 peers |
| Memory Usage | System memory consumption | <4GB |
| CPU Usage | System CPU utilization | <80% |
| Network Latency | P2P communication delay | <100ms |
ChainForge/
├─ CMakeLists.txt # Root CMake configuration
├─ conanfile.txt # Conan dependencies
├─ cmake/ # CMake modules and presets
├─ .github/workflows/ # CI/CD pipelines
├─ documentation/ # Project documentation
├─ modules/ # Core modules
│ ├─ core/ # Domain models (blocks, tx, hashing)
│ ├─ crypto/ # Cryptographic primitives
│ ├─ storage/ # Database abstraction
│ ├─ p2p/ # Peer-to-peer networking
│ ├─ consensus/ # Consensus algorithms
│ ├─ execution/ # State machine execution
│ ├─ mempool/ # Transaction pool management
│ ├─ rpc/ # RPC server implementation
│ ├─ node/ # Node composition root
│ └─ explorer/ # Blockchain explorer
├─ tools/ # Utility tools
├─ tests/ # Test suite
└─ deploy/ # Deployment configurations
├─ docker/ # Docker configurations
├─ helm/ # Kubernetes Helm charts
├─ prometheus/ # Monitoring setup
└─ grafana/ # Dashboard configurations| Document | Description | Audience |
|---|---|---|
| ROADMAP | 60+ development milestones | Product, Engineering |
| PROJECT_OVERVIEW | System architecture & vision | Architects, Stakeholders |
| MILESTONE_TEMPLATE | Milestone tracking template | Project Managers |
| README | Documentation overview | All users |
- Standard: C++20 (prefer), C++23 optional
- Error Handling:
std::expected<T, E>for recoverable errors - Ownership:
unique_ptrby default,shared_ptronly when necessary - Concurrency: Explicit thread pools, no implicit global threads
- Security: ASAN/UBSAN/TSAN in CI, fuzzing, SBOM generation
# Static analysis
clang-tidy build/compile_commands.json
# Test coverage
gcov --coverage build/tests/
# Code metrics
cloc modules/ --include-lang=C++
# Security scan
make security-scan| Feature | Description | Status |
|---|---|---|
| Cryptographic Primitives | OpenSSL, libsecp256k1, libsodium | ✅ Implemented |
| Memory Safety | ASAN/UBSAN/TSAN sanitizers | 🚧 In Progress |
| Fuzzing | libFuzzer/AFL++ integration | 🚧 In Progress |
| SBOM Generation | Software Bill of Materials | ✅ Implemented |
| Image Signing | Cosign/Sigstore integration | 🚧 In Progress |
| Security Audits | Regular security assessments | 📅 Planned |
- Zero-trust architecture - Verify everything
- Defense in depth - Multiple security layers
- Continuous monitoring - Real-time threat detection
- Security documentation - Comprehensive guidelines
- Regular testing - Penetration testing & audits
| Metric | Target | Current | Status |
|---|---|---|---|
| Transaction Throughput | >10,000 TPS | 🚧 TBD | 🚧 In Progress |
| Block Time | <1 second | 🚧 TBD | 🚧 In Progress |
| Network Latency | <100ms | 🚧 TBD | 🚧 In Progress |
| Memory Usage | <4GB | 🚧 TBD | 🚧 In Progress |
| Storage I/O | >100K ops/sec | 🚧 TBD | 🚧 In Progress |
- Parallel execution - Multi-threaded processing
- Efficient caching - Redis + RocksDB optimization
- Network optimization - Connection pooling & load balancing
- Profiling - Continuous performance monitoring
- Benchmarking - Automated performance testing
| Job | Purpose | Triggers |
|---|---|---|
| Build | Multi-compiler builds | Push, PR |
| Security | Sanitizers & fuzzing | Push, PR |
| Docker | Image building & testing | Push, PR |
| SBOM | Software Bill of Materials | Push, PR |
| Deploy | Production deployment | Main branch |
- ✅ Build Success - All compilers pass
- ✅ Test Coverage - >90% coverage required
- ✅ Static Analysis - No critical issues
- ✅ Security Scan - No vulnerabilities
- ✅ Performance - No regressions
- [] Project setup & build system
- [] Core domain models
- [] Cryptographic foundation
- Database abstraction layer
- Basic block structure
- Transaction pool (mempool)
- Simple Proof of Work
- Basic RPC server
- Network transport layer
- Peer discovery
- Peer management
- Message protocol
- Block synchronization
- Transaction propagation
- Advanced consensus engine
- State management
- Smart contract engine
- Gas model
- Transaction execution
- Block execution
- Advanced RPC APIs
- GraphQL support
- Advanced indexing
- Analytics engine
- Production deployment
- Documentation & training
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Update documentation
- Submit a pull request
# Clone repository
git clone https://github.com/Skpow1234/ChainForge.git
cd ChainForge
# Install dependencies
make install-deps
# Build project
make build
# Run tests
make test
# Code quality checks
make lint
make format- OpenSSL - Cryptographic primitives
- Boost Libraries - Networking & utilities
- RocksDB - High-performance storage
- Prometheus - Metrics collection
- Grafana - Visualization platform
- Jaeger - Distributed tracing