How x-93/rusty-jio works
1. This is a Rust monorepo for a Jio full node plus adjacent libraries and clients. The main runtime is the node executable (jiopad), with supporting crates for consensus, P2P networking, RPC, mining, wallet functionality, WASM bindings, CLI tooling, simulation, and integration tests.
2. The central system boundary is the node core: configuration, logging/runtime support, persistence, networking, consensus, and optional services are wired together by the node/daemon layer. The repository also includes separate binaries for client tooling, simulation (simpa), and web/Node SDK builds.
3. Consensus is split into a domain layer and a processing pipeline. consensus/core defines the block, header, tx, UTXO, hashing, config, and error models. consensus/src/pipeline contains staged processors for headers, bodies, virtual state, and pruning, while consensus/src/processes implements the actual DAG/chain logic such as GHOSTDAG, reachability, pruning, difficulty, mass, and transaction validation.
4. Consensus state is backed by internal stores under consensus/src/model/stores. These are the authoritative read/write models for headers, selected chain, tips, UTXO diffs, virtual state, pruning data, and reachability relations. That is the main persistence boundary between algorithmic processing and durable state.
5. Networking is handled in two layers. protocol/p2p provides the low-level peer connection, handshake, routing, and protobuf message conversion. protocol/flows builds higher-level protocol behaviors on top of that, including IBD, block relay, tx relay, ping, header/locator requests, pruning-point synchronization, and transaction/orphan flow context management.
6. The node’s event and notification path is separate from the consensus and network state machines. consensus/notify and the general notify crate implement collectors, broadcasters, subscriptions, and connection abstractions so internal events can be published to external consumers such as RPC clients, wallets, or monitoring tools.
7. Read-side projections live in indexes/. indexes/core defines notification-driven index infrastructure, indexes/processor runs the update pipeline, and indexes/utxoindex maintains derived views like indexed UTXOs, supply, and tips. This is a classic “derived read model” boundary: it consumes consensus notifications rather than being part of consensus correctness.
8. Mining is its own subsystem in mining/. It includes a mempool, orphan handling, transaction validation, block template building, and template selection. The miner interacts with consensus state and node services to assemble candidate blocks, then submits mined blocks back through the node’s external interface.
9. RPC is layered and multi-targeted. rpc/core defines the API model and conversion layer; rpc/service adapts consensus/protocol/index data into those APIs; rpc/grpc provides generated gRPC server/client infrastructure; and rpc/wrpc provides the WebSocket-based JSON/Borsh RPC used by browsers, Node.js, and Rust clients. The README indicates wRPC is optional and the old wRPC→gRPC proxy is deprecated.
10. The wallet is a separate application domain, not just a thin key store. wallet/core covers accounts, key management, encrypted local storage, UTXO tracking, transaction generation, fee/mass logic, and RPC integration. wallet/keys and wallet/bip32 provide derivation and key primitives, while wallet/native and wallet/wasm package the wallet for desktop and browser/Node use.
11. The CLI (cli/) is a user-facing shell over the node and wallet subsystems. Its many command modules and wizards suggest it orchestrates account management, network/node control, RPC operations, sending/signing, monitoring, and wallet actions rather than embedding core consensus logic itself.
12. WASM is a major distribution boundary across the repo. There are dedicated WASM crates for consensus, RPC, wallet, and top-level SDK packaging, plus generated TypeScript docs and browser/Node examples. This means the same core logic is intentionally exposed to both native Rust and JavaScript/TypeScript consumers.
13. Shared foundation crates sit underneath most subsystems: core/ provides runtime/logging/task/signal utilities, crypto/ contains hash/txscript/merkle/muhash/address primitives, math/ supplies integer types, database/ provides the storage abstraction used by node-side persistence, and metrics/ adds performance monitoring. These are infrastructure layers rather than application flows.
14. Testing and validation are first-class. simpa builds an in-process virtual network and DAG for performance/simulation studies, testing/integration drives node/RPC/mempool/notification scenarios, and there are benches and fuzz targets across crypto and consensus crates. For an architecture diagram, these are useful as non-production feedback loops around the core node and wallet systems.
Main entry points: jiopad/mod.rs Daemon · src/lib.rs RPC service · pipeline/mod.rs Pipeline · src/lib.rs Notify
Components 23
Apps
User-facing binaries and distribution entrypoints
Runtime
Shared runtime, storage, and support layers
Consensus
Consensus domain, pipeline, algorithms, and state
- Consensus core · Blocks, headers, txs, UTXO, config, and errors
consensus/core/src/lib.rs - Pipeline · Header, body, virtual, and pruning processors
consensus/src/pipeline/mod.rs - Processes · GHOSTDAG, reachability, difficulty, mass, validation, pruning
consensus/src/processes/mod.rs - State stores · Read/write models backing consensus state and chain views
consensus/src/model/stores/mod.rs
Network
Peer networking and higher-level protocol flows
APIs
Notification and RPC surfaces
- Notify · Collectors, broadcasters, subscriptions, and connection APIs
notify/src/lib.rs - RPC core · Shared RPC schemas, conversions, and notification models
rpc/core/src/lib.rs - RPC service · Bridges consensus, protocol, and index data into RPC operations
rpc/service/src/lib.rs - gRPC · Generated gRPC server/client infrastructure
rpc/grpc/server/src/lib.rs - wRPC · WebSocket-based JSON/Borsh RPC for browser, Node, and Rust clients
rpc/wrpc/server/src/lib.rs - Indexes · Notification-driven read models such as UTXO and supply
indexes/processor/src/lib.rs
Product
Mining, wallet, CLI, and SDK packaging
- Mining · Mempool, orphan handling, block template selection, and submission
mining/src/lib.rs - Wallet · Accounts, keys, storage, UTXO tracking, and transaction generation
wallet/core/src/lib.rs - Wallet WASM · Browser and Node packaging for wallet functionality
wallet/wasm/src/lib.rs - Jio WASM · Top-level WASM distribution and JavaScript examples
wasm/src/lib.rs
Tooling
Simulation and integration validation
- Simpa · In-process network and DAG simulation runtime
simpa/src/main.rs - Integration · End-to-end node, RPC, mempool, and notification scenarios
testing/integration/src/lib.rs
Connections 33
- JioPad → Daemon: starts · Main executable launches the daemon/node runtime
- Daemon → Core: uses · Daemon depends on shared runtime services
- Daemon → Database: persists via · Node state is backed by the storage layer
- Daemon → Pipeline: drives · Node wires consensus processing into runtime events
- Daemon → P2P: connects · Node exposes peer networking
- Daemon → Flows: orchestrates · Higher-level protocol flows run on top of P2P
- Daemon → Notify: publishes · Internal events are forwarded to subscribers
- Daemon → RPC service: serves · Node data is exposed through RPC services
- Daemon → Mining: hosts · Mining subsystem runs against node services
- Daemon → Indexes: feeds · Consensus notifications drive derived indexes
- Pipeline → Consensus core: validates · Pipeline operates on consensus domain models
- Pipeline → Processes: executes · Processors delegate to core consensus algorithms
- Processes → State stores: reads/writes · Algorithms use durable chain state and views
- State stores → Database: backed by · Consensus state is persisted through the database abstraction
- P2P → Flows: feeds · Peer layer provides transport for protocol behaviors
- Flows → Pipeline: syncs · IBD and relay flows move data into consensus processing
- Notify → RPC core: adapts · Notification events are shaped for external APIs
- RPC service → Consensus core: reads · RPC queries consensus state and models
- RPC service → Indexes: reads · RPC exposes derived read models
- RPC service → Notify: subscribes · RPC streaming builds on the notification bus
- RPC service → RPC core: implements · Service layer realizes the shared RPC API model
- RPC service → gRPC: serves · gRPC server is one RPC transport
- RPC service → wRPC: serves · wRPC is the browser/JS-oriented transport
- Mining → Consensus core: checks · Mining validates candidates against consensus rules
- Mining → RPC service: submits via · Mining interacts with node-facing APIs for block submission
- Wallet → RPC core: integrates · Wallet exposes and consumes RPC-facing models
- Wallet → Consensus core: builds txs · Wallet transaction generation depends on consensus types
- Wallet WASM → Wallet: packages · WASM build exports the wallet domain
- Jio WASM → RPC core: packages · Top-level WASM SDK surfaces RPC and core functionality
- Simpa → Pipeline: simulates · Simulator exercises consensus behavior in-memory
- Integration → Daemon: tests · Integration harness drives the node/daemon runtime
- Integration → RPC service: tests · Integration harness covers RPC behavior
- Integration → Notify: tests · Integration harness covers event delivery and subscriptions