Crate floresta_wire

Source
Expand description

§Floresta Wire

This crate provides the core networking logic for a full node using libfloresta, including the P2P network and the mempool. You can easily integrate it with any other crate that provides a BlockchainInterface and UpdatableChainstate implementation.

A node also gives you a handle that you can use to send messages to the node, like requesting blocks, mempool transactions or asking to connect with a given peer.

Re-exports§

pub use rustreexo;

Modules§

address_man
Address manager is a module that keeps track of known peer addresses and associated metadata. This module is very important in keeping our node protected against targeted attacks, like eclipse attacks.
block_proof
This module defines the structures and methods for handling Utreexo proofs in the context of messaging in the bitcoin network.
error
node
Main file for this blockchain. A node is the central task that runs and handles important events, such as new blocks, peer connection/disconnection, new addresses, etc. A node should not care about peer-specific messages, peers’ll handle things like pings.
node_context
During the lifetime of a Bitcoin client, we have a couple of phases that are slightly different from each other, having to implement their own state-machines and logic for handing requests. While we could simply put everything in one struct and have a single impl block, that would create a massive amount of if’s in the code, taking different paths depending on which state are we in. For that reason, we define the basics of a node, like code shared by all the states into one base struct called UtreexoNode, we then further refine this struct using fine-tuned Contexts, that should implement NodeContext and are passed-in as a generic parameter by the caller.
node_interface
node_interface, which holds NodeInterface and related methods that define the API to interact with the floresta node
p2p_wire 🔒
Main module for the p2p chain. This is a blockchain provider, just like cli-chain, but it’s backed by p2p Bitcoin’s p2p network.

Structs§

UtreexoNodeConfig
Configuration for the Utreexo node.

Enums§

TransportProtocol
Bitcoin nodes can communicate using different transport layer protocols.

Traits§

NodeHooks
NodeHooks is a trait that defines the hooks that a node can use to interact with the network and the blockchain. Every time an event happens, the node will call the corresponding hook.