How vivpm/delegated-reputation-based-proof-of-probability-using-game-theory works
Project type and purpose
• Project type: Full-node blockchain client (a customized Go-Ethereum implementation in Go).
• Purpose: Run an Ethereum-compatible node with a bespoke DRPoP-GT consensus engine (a game-theory-based staking algorithm replacing the standard ethash/PoS).
Top-level architectural layers
Layer your system into four horizontal slices:
A. Interfaces & Tools
– CLI binaries (cmd/geth, cmd/bootnode, cmd/puppeth, etc.)
– Console / interactive shell
– JSON-RPC & IPC server (rpc/, rpc/http.go, rpc/ipc.go)
– GraphQL server (graphql/)
B. Node Core
– node/ (lifecycle, config, rpcstack)
– internal/ (ethapi, jsre, web3ext)
– accounts & keystore management (accounts/, mobile/)
C. Networking & P2P
– libp2p-style transport & rlpx (p2p/rlpx/)
– Peer discovery (p2p/discover v4/v5, dnsdisc)
– Protocol handlers: ETH, LES, snap (eth/protocols/, les/, light/)
D. Blockchain Engine
– Consensus engine interface (consensus/)
• Default adapters: ethash, clique
• Your DRPoP-GT implementation (drop-in replacement under consensus/)
– Core chain logic (core/)
• Block validation, insertion, fork handling
• State transition / EVM (core/vm/)
• State DB & snapshotter (core/state/, trie/)
• Transaction pool (core/tx_pool.go)
– Local storage (rawdb, ethdb/)
– Transaction & event bus (event/)
– Miner (miner/)
Main components and how they interact
1. CLI “geth” process
– Parses flags, invokes node.New()
– Creates Node Core
– Hooks up P2P, Consensus, RPC, and Miner
2. Node Core
– node.Config sets up submodules
– node.APIStack exposes internal APIs to RPC & console
3. P2P subsystem
– Transport & encryption (rlpx)
– Discovery → peer table → peerset
– Protocol mux: routes ETH/LES traffic to eth.Handler, les.Handler
4. ETH Protocol Handler
– Receives blocks/txs, forwards to block processor
– Broadcasts local blocks/txs to peers
5. Consensus Engine
– Interface: consensus.Engine
– Your DRPoP-GT logic plugs here:
• Node list filtering → delegated nodes → two-stage game → miner selection
• Called by block inserter to authorize/validate next block
6. Core chain & EVM
– Validates blocks (block_validator.go), executes transactions in EVM
– Updates state DB (trie, rawdb)
7. Transaction Pool
– Holds pending txs, feeds miner
8. Miner
– Requests new block template from consensus engine
– Signs & seals block, hands off to ETH handler for broadcast
9. RPC/API Layer
– JSON-RPC & WebSocket: methods (eth, net, web3, personal) backed by internal ethapi
– GraphQL: read-only queries backed by service.go
10. Storage
– LevelDB via ethdb/leveldb for chain data
– Badger or in-memory options under ethdb/
Architectural patterns
• Modular layering: clearly separated CLI, Node Core, P2P, Consensus, Chain, API
• Plugin-style consensus interface: swap consensus.Engine implementations
• Event bus: decoupled modules communicate via event.Feed
• Layered storage abstraction: rawdb ⇄ core logic
Detailed checklist
[ ] Layer containers (Interfaces, Node Core, P2P, Blockchain Engine)
• CLI → Node Core
• Node Core ↔ Consensus Engine
• Node Core ↔ P2P → ETH/LES Handlers
• Handlers → Block Processor → Consensus Engine
• Consensus Engine → Core Chain → Storage
• Miner ← Tx Pool ← Core Chain
• RPC/API → Node Core → ethapi
[ ] Annotate key DRPoP-GT steps inside Consensus block:
• Node filtering, two-stage game, punishment, miner selection