How hyoungsungkim/ecc-pow-project works
Project type and purpose
• This is a blockchain consensus‐algorithm project implementing Error Correction Code Proof‐of‐Work (ECCPoW). It provides:
• Prototype implementations in C++/Python (“Ecc-PoW-pseudo-code”, “LDPC-pseudo-code”)
• A production-grade Go port of the LDPC decoder and difficulty control (“ldpc” folder)
• Integration hooks for go-ethereum’s consensus layer under consensus/eccpow (referenced in README)
• Purpose: explore and evaluate an ECC-based PoW variant, optimize decoding performance, then plug it into an Ethereum client.
File structure
• Top-level artifacts:
• .gitignore, go.mod, go.sum, mainForTest.go (test harness in Go)
• Ecc-PoW-pseudo-code/ – C++ & Python prototyping of ECCPoW mining (blockchain_core.py, Miner scripts, trader.py)
• LDPC-pseudo-code/ – two versions of C++ pseudo-code for LDPC integration tests
• ldpc/ – Go implementation of LDPC decoder, difficulty control, utility functions, and a forGoEth/ subfolder mirroring the same for direct inclusion in go-ethereum
• Patterns:
• Layered: decoder, difficulty control, consensus algorithm
• Concurrency: extensive goroutine use, channels for stop signals
• Config/inputs: test files (*_test.go), presentation assets in img/
README for additional insights
• The README outlines:
• ECCPoW concept images (error correction + Ethash)
• Porting chronology, optimizations (optimized decoding loops)
• Concurrency mining algorithm (channels: outerLoopSignal, innerLoopSignal, goRoutineSignal)
• Difficulty adjustment formulas for both Ethash and LDPC
• Integration status with go-ethereum consensus
Main components
a. Prototype layer (optional for historical context)
– C++/Python scripts for initial ECCPoW mining and trading
b. Core Go components
1) LDPC Decoder Module (ldpc/decoder.go, decoder_concurrency.go, decoder_utils.go)
2) Difficulty Control Module (ldpc/difficultyControl.go)
3) Consensus Algorithm (consensus/eccpow/algorithm.go in go-ethereum)
4) Test harness (mainForTest.go)
c. go-ethereum integration
– Chain reader interface (consensus.ChainReader)
– Block header input and block submission output
d. External services
– Crypto/rand for nonce generation
– Go scheduler (goroutines, WaitGroup)
Relationships and data flows
1) go-ethereum triggers Seal() in consensus/eccpow → passes block header to ECCPoW module
2) ECCPoW algorithm spins up N goroutines
– Each goroutine:
• Generates random LDPCNonce via crypto/rand
• Feeds header + nonce into LDPC Decoder
• Calls MakeDecision() to check if PoW target is met
– Channels coordinate early stop on success
3) On success → miner returns completed block to go-ethereum → block is broadcast
4) Difficulty Control module computes next target based on parent difficulty & block time
5) Test harness (mainForTest.go) directly invokes LDPC decoder and difficulty functions for benchmarks
Architectural patterns and design principles
• Layered separation of concerns:
• Decoder (data-intensive, math-heavy)
• Consensus orchestration (concurrency, channels)
• Difficulty management (parameter tuning, formulas)
• Concurrency via goroutines + channels to maximize CPU utilization and enable early exit
• Test-driven modules (*_test.go) ensure deterministic behavior and performance metrics
• Clear labels for each module (e.g., “LDPC Decoder”, “Difficulty Control”)