How vocdoni/vocdoni-node works
This project, vocdoni-node, is the core component of Vocdoni’s decentralized governance protocol. It is a Golang-based distributed node integrating critical blockchain functionality (such as go-ethereum, go-ipfs, and tendermint) directly into a single process. The system can run in different operational modes (gateway and miner), and its architecture spans multiple domains, including API handling, cryptographic operations, blockchain indexing, and state management.
Main Components Identification
• API Layer & Node Modes: Represent the gateway mode (serving REST API calls, external requests, and blockchain sync) and miner (validator) mode.
• Command Line Tools & CLI: Incorporate the various “cmd” directories (cli, end2endtest, node, tools, voconed) that serve different operational and development/testing functions.
• Core Business Logic: Highlight the “api” package, which includes account management, elections, votes, and the integrated API server. Also mark the “apiclient” which wraps API interactions.
• Blockchain & Distributed Ledger Components: Include the “vochain” package (and subdirectories such as genesis, indexer, state, transaction, etc.) that encapsulate blockchain operations, state handling, and consensus management.
• Database & Storage Components: Illustrate “statedb”, the “db” directories (goleveldb, mongodb, pebbledb, etc.), and perhaps other storage utilities (data package, censustree) to highlight how persistent state and offchain data are handled.
• Cryptography and Zero-Knowledge Proofs: Show the “crypto” package (with submodules for Ethereum, nacl, saltedkey, and zk) and “subpub” libraries for secure communications.
• Additional Services: Include components like “service”, “snapshot”, and “tree” architecture for secondary functions such as indexing, data snapshots, and cryptographic proofs.
• External tools and integrations: Mention dockerfiles (for orchestration/deployment), testing suites, automation (GitHub workflows), and configuration modules.
Depicting Relationships & Interactions
• How the CLI and sandbox tools are used to interact with both API and low-level blockchain functionalities.
• Dependencies where the node (both gateway and miner mode) encapsulates third-party libraries (go-ethereum, go-ipfs, tendermint) for handling consensus and network operations, thereby eliminating external RPC/IPC.
Architectural Patterns & Design Principles
• Monolithic Process Integration: Emphasize that all components run within a single process to reduce inter-process communications overhead.
• Modular Design: Each package represents a specific concern (API, blockchain, crypto, storage, etc.), following separation of concerns.
• Extensibility: Several areas (such as the “crypto/zk” and “api/docs”) suggest that the design is built for easy extension, especially as new validation or consensus proof methods are added.
• Testability: The presence of a rich test directory and multiple “*_test.go” files highlights heavy emphasis on automated testing and robust quality assurance.
Technologies, Frameworks, and Libraries
• Golang as the primary language.
• Integrated libraries: go-ethereum, go-ipfs, tendermint (integrated as Go libraries).
• Various database solutions (goleveldb, mongodb, pebbledb) are abstracted and interchangeable.
• Docker and docker-compose configurations for deployment.
• Crypto libraries for Ethereum, nacl, and zero-knowledge circuits.