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.
Modules§
- address_
man Non-WebAssembly - 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.
- chain_
selector Non-WebAssembly - A module that connects with multiple peers and finds the best chain.
- mempool
Non-WebAssembly - A simple mempool that keeps our transactions in memory. It try to rebroadcast our transactions every 1 hour. Once our transaction is included in a block, we remove it from the mempool.
- node
Non-WebAssembly - 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 Non-WebAssembly - 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
implblock, 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 calledUtreexoNode, we then further refine this struct using fine-tunedContexts, that should implement NodeContext and are passed-in as a generic parameter by the caller. - node_
interface Non-WebAssembly - node_interface, which holds
NodeInterfaceand related methods that define the API to interact with the floresta node - running_
node Non-WebAssembly - After a node catches-up with the network, we can start listening for new blocks, handing any request our user might make and keep our peers alive. This mode requires way less bandwidth and CPU to run, being bound by the number of blocks found in a given period.
- sync_
node Non-WebAssembly - A node that downloads and validates the blockchain.
Structs§
- Utreexo
Node Config Non-WebAssembly - Configuration for the Utreexo node.
Traits§
- Node
Hooks - 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.