Welcome to go-basic-blockchain, an educational project designed to demystify blockchain technology through a hands-on, from-scratch implementation in Go. This project serves as both a comprehensive learning tool and a fully functional blockchain implementation for developers, students, and blockchain enthusiasts.
๐ฏ Built Completely From Scratch: This blockchain implementation uses no third-party blockchain libraries (no go-ethereum, Bitcoin, Tendermint/Cosmos, etc.) and includes our custom Helios consensus algorithm - all created from the ground up to fully teach Go programming and blockchain development.
๐ NEW: Complete Learning Course - This project now includes a comprehensive 19-section course covering everything from Go fundamentals to production deployment!
๐ฏ NEW: Fully Functional Blockchain Node - Complete, operational blockchain with continuous mining, proper data persistence, and smooth progress monitoring.
This repository includes a comprehensive learning course with 19 sections organized into 4 phases:
- Phase 1: Foundation (Sections 1-5) - Go fundamentals and basic blockchain
- Phase 2: Advanced Features (Sections 6-10) - Advanced consensus and APIs
- Phase 3: User Experience (Sections 11-15) - Web and mobile applications
- Phase 4: Production Quality (Sections 16-19) - Testing and deployment
- Go Programming: Master Go fundamentals, concurrency, and advanced patterns
- Blockchain Development: Build complete blockchain systems from scratch
- Advanced Consensus: Implement sophisticated consensus algorithms (Helios)
- API Development: Create professional RESTful APIs with authentication
- Web Development: Build responsive web applications with React
- Mobile Development: Create cross-platform mobile apps with React Native
- Testing: Implement comprehensive testing strategies
- Deployment: Deploy production-ready applications
- 80-109 hours of comprehensive content
- 19 sections with hands-on exercises
- 19 quizzes with detailed answer keys
- 4 major milestones with working deliverables
- Production-ready portfolio project
Start Learning โ | Complete Course Overview โ
- Built from Scratch: Every component implemented from the ground up
- Advanced Consensus: Implements the Helios consensus algorithm with three-stage validation
- Go Programming Language: Utilizing Go's simplicity and efficiency for complex systems
- Readable JSON Format: Human-readable JSON for data structures and storage
- No Third-Party Dependencies: Encourages deep understanding of core blockchain concepts
- Educational Focus: Thoroughly commented and documented with design explanations
- Optimized Test Suite: Fast, reliable tests with smart scrypt configuration
- Sidechain Routing: Advanced transaction routing through specialized protocols
- Continuous Mining: Automatic block creation and mining with proper state management
- Professional Build System: Organized binary output with cross-compilation support
- Test Coverage: 39.8%
- Test Suite Performance: ~9.5 seconds (30x faster than before)
- Implementation Status: ~95% complete
- Helios Consensus: โ Fully integrated and tested
- Blockchain Functionality: โ Fully operational with continuous mining
- Start with the Learning Course
- Follow the structured progression through all 19 sections
- Build your blockchain step by step with hands-on exercises
-
Clone the repository:
git clone https://github.com/yourusername/go-basic-blockchain.git cd go-basic-blockchain -
Install dependencies:
go mod tidy
-
Run tests to verify everything works:
make test -
Start the blockchain node:
make run
Or run the binary directly:
./bin/release/gbbd
-
Access the web interface at
http://localhost:8200
The project implements the Helios consensus algorithm, a sophisticated three-stage consensus mechanism:
- Stage 1 - Proof Generation: Miners create cryptographic proofs for transaction validation
- Stage 2 - Sidechain Routing: Transactions are routed through specialized protocols (BANK, MESSAGE, etc.)
- Stage 3 - Block Finalization: Validated blocks are finalized with proof verification
- Blockchain Core: Main blockchain implementation with Helios integration and continuous mining
- Wallet System: Encrypted wallet management with key derivation
- API Layer: RESTful endpoints with authentication middleware
- P2P Network: Peer-to-peer communication framework
- Sidechain Router: Transaction routing through specialized protocols
- Test Suite: Comprehensive testing with optimized performance
- Progress Indicator: Real-time status monitoring with smooth updates
- Build System: Professional Makefile with cross-compilation and organized output
go-basic-blockchain/
โโโ learn/ # Comprehensive learning course (19 sections)
โ โโโ README.md # Course overview and navigation
โ โโโ COURSE_OVERVIEW.md # Detailed course guide
โ โโโ phase1/ # Foundation (Sections 1-5)
โ โโโ phase2/ # Advanced Features (Sections 6-10)
โ โโโ phase3/ # User Experience (Sections 11-15)
โ โโโ phase4/ # Production Quality (Sections 16-19)
โโโ cmd/ # Application entry points
โ โโโ gbb-cli/ # Command-line interface
โ โโโ chaind/ # Blockchain daemon
โ โโโ demo/ # Demo applications
โโโ internal/ # Core blockchain implementation
โ โโโ helios/ # Helios consensus algorithm
โ โโโ menu/ # User interface components
โ โโโ progress/ # Progress tracking
โโโ docs/ # Technical documentation
โโโ test/ # Test files and examples
โโโ bin/ # Compiled binaries
โโโ data/ # Blockchain data storage
โโโ scripts/ # Build and deployment scripts
โโโ postman/ # API testing collections
- Learning Course: Start your blockchain development journey
- Course Overview: Complete course navigation and progress tracking
- Introduction: Getting started guide
- Architecture: System design and components
- API Reference: RESTful API documentation
- Wallet Guide: Wallet creation and management
- Helios Consensus: Advanced consensus algorithm
- Development: Contributing and development guide
- Testing: Test suite and coverage information
The project includes a comprehensive test suite with optimized performance:
- Test Coverage: 39.8%
- Test Execution Time: ~9.5 seconds (30x faster than before)
- Smart Scrypt Configuration: Automatic switching between test and production security levels
- Timeout Protection: All tests have 60-second timeouts to prevent hanging
- Helios Tests: Comprehensive testing of the consensus algorithm
- Blockchain Tests: All blockchain functionality tests passing
Run tests with:
make testmake build # Build release binary
make debug # Build debug binary with debugging symbols
make build-all # Build for all platforms (Linux, Windows, macOS, ARM64, AMD64)make run # Build and run release binary
make run-bin # Run existing release binary
make debug # Build and run debug binary with delve debugger
./bin/release/gbbd # Run release binary directly
./bin/debug/gbbd # Run debug binary directlymake test # Run all tests
make test-short # Run short tests
make test-unit # Run unit tests only
make test-coverage # Run with coveragemake setup # Setup dependencies
make fmt # Format code
make lint # Run linter
make clean # Clean build artifacts
make clean-data # Clean blockchain data
make clean-all # Clean everythingmake release # Build all cross-compiled binariesmake docs- Test Suite: 30x faster execution (9.5 seconds vs 5+ minutes)
- Scrypt Optimization: Smart configuration for development vs production
- Memory Usage: Optimized for educational use
- Network Latency: Minimal overhead in P2P communication
- Blockchain Operation: Continuous mining with proper state management
- Progress Display: Smooth, non-flickering status updates
The project features a professional build system with:
- Cross-Compilation: Build for Linux, Windows, macOS (ARM64, AMD64)
- Binary Organization: Separate
bin/debug/andbin/release/directories - Go 1.22 Compatibility: Latest Go version with toolchain specification
- Dependency Management: Proper
go.modandgo.sumhandling - Clean Targets: Organized cleanup with dependency preservation
- Start with Phase 1: Foundation
- Complete all sections in order
- Build your first blockchain in Section 5
- Progress through each phase sequentially
- Review Phase 1 for Go/blockchain basics
- Jump to Phase 2 for advanced features
- Focus on Phase 3 for user interfaces
- Complete Phase 4 for production deployment
- Go Programming: Phase 1, Sections 1-2
- Blockchain Theory: Phase 1, Section 3
- Advanced Consensus: Phase 2, Section 6
- API Development: Phase 2, Section 8
- Web Development: Phase 3, Section 11
- Mobile Development: Phase 3, Section 12
- Testing: Phase 4, Section 16
- Deployment: Phase 4, Section 17
We welcome contributions! Please see our Contributing Guide for details.
This project is licensed under the MIT License - see the LICENSE file for details.
Ready to explore the future of blockchain technology? Choose your path:
๐ Start Learning โ - Begin the comprehensive 19-section course
๐ง Explore Implementation โ - Dive into the technical documentation
๐ Quick Start โ - Get the blockchain running immediately
Transform from beginner to production-ready blockchain developer with our complete learning experience!