Crate subcoin_network
source ·Expand description
§Bitcoin Network
This crate facilitates communication with other nodes in the Bitcoin P2P network. It handles connections, message transmission, and the peer-to-peer protocol.
§Initial Block Download
This crate offers two strategies for the initial block download:
-
Blocks-First: Downloads the full block data sequentially starting from the last known block until it’s fully synced with the network, in batches. This is primarily for the testing purpose.
-
Headers-First: First downloads the block headers and then proceeds to the full block data based on the checkpoints.
However, due to the nature of Subcoin, building a Bitcoin SPV node solely by syncing Bitcoin headers
from the network is not possible, in that Subcoin requires full block data to derive the corresponding
substrate header properly, including generating the extrinsics_root
and state_root
.
§Subcoin Bootstrap Node
Subcoin node runs the Bitcoin networking and Substrate networking in parallel. Initial block download from Bitcoin p2p network is time-consuming because every historical block must be downloaded and executed. The advantage of Subcoin node is that only the Subcoin bootstrap node needs to perform full block sync. Once Subcoin bootstrap nodes are operational in the network, newly joined Subcoin nodes can quickly sync to Bitcoin chain’s tip by leveraging the advanced state sync provided by the Substrate networking stack.
Structs§
- Network configuration.
- A handle for interacting with the network processor.
- Represents the status of network.
- Subcoin network disabled.
- Subcoin network is disabled, but chain is syncing from other source, e.g., importing blocks from the Bitcoind database.
- Contains all the data about a Peer that we are trying to sync with.
Enums§
- Controls the block sync from Bitcoin P2P network.
- Network error type.
- The state of syncing between a Peer and ourselves.
- Represents the result of submitting a transaction to the network.
- Represents the sync status of node.
- Represents the strategy for block syncing.
Traits§
- Subcoin network service interface.
Functions§
- Creates Subcoin network.
Type Aliases§
- Peer latency in milliseconds.
- Identifies a peer.