hotmint-network
P2P networking layer for the Hotmint BFT consensus framework.
Implements the NetworkSink trait from hotmint-consensus using litep2p for real multi-process / multi-machine deployments. Messages are serialized with CBOR.
Sub-Protocols
| Protocol | Path | Use |
|---|---|---|
| Notification | /hotmint/consensus/notif/1 |
broadcast() — fire-and-forget to all peers |
| Request-Response | /hotmint/consensus/reqresp/1 |
send_to() — directed message to a specific peer |
Components
| Component | Description |
|---|---|
NetworkService |
Manages litep2p connections and event routing |
Litep2pNetworkSink |
Implements NetworkSink for production use |
PeerMap |
Bidirectional ValidatorId ↔ PeerId mapping |
Usage
use ;
// map validator IDs to litep2p peer IDs
let mut peer_map = new;
peer_map.insert;
peer_map.insert;
// ...
let known_addresses = vec!;
// create returns (service, network_sink, msg_rx)
let = create.unwrap;
// run the network event loop
spawn;
// pass network_sink and msg_rx to ConsensusEngine::new()
use ;
let shared_store = new;
let engine = new;
License
GPL-3.0-only