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§
- Config
- Network configuration.
- Memory
Config - Memory management configuration for network operations.
- Network
Handle - A handle for interacting with the network processor.
- Network
Status - Represents the status of network.
- NoNetwork
- Subcoin network disabled.
- Offline
Sync - Subcoin network is disabled, but chain is syncing from other source, e.g., importing blocks from the Bitcoind database.
- Peer
Sync - Contains all the data about a Peer that we are trying to sync with.
Enums§
- Block
Sync Option - Controls the block sync from Bitcoin P2P network.
- Error
- Network error type.
- Peer
Sync State - The state of syncing between a Peer and ourselves.
- Send
Transaction Result - Represents the result of submitting a transaction to the network.
- Sync
Status - Represents the sync status of node.
- Sync
Strategy - Represents the strategy for block syncing.
Traits§
- Network
Api - Subcoin network service interface.
Functions§
- build_
network - Creates Subcoin network.