[−][src]Crate networking
This Library provides
- a low level implementation of the Bitcoin Wire Protocol (the
Message
struct combined withBitcoinCodec
). (✅ Completed) - a high level system encapsulating 'the rest of the network' as a
tower::Service
. (🟨 Work in Progress)
Overview
Following Zcash Zebra, we intend to build a stateful Request/Response protocol on top of the existing Wire Protocol and encapsulate
the Bitcoin Network into a single service (or small collection of Services).
To obtain block and transaction information, a caller (in our case, warpd
) simply passes the relevant Service
a high-level Request object specifying the information to be fetched (i.e. Blocks, Headers, etc.), and the
Services automatically load balance these requests across available peers. Work in this direction in ongoing.
For now, users of the library can use the BitcoinCodec
to easily turn any TcpStream into a stream of Bitcoin Message
s.
Structs
BitcoinCodec | A Codec converting a raw TcpStream into a Sink + Stream of Bitcoin Wire Protocol |
MessageHeader | |
Peer | A |
Enums
Command | A shorthand way of referring to a type of Message. A |
Message | An enumeration of all Bitcoin Wire Protocol messages, (i.e. GetHeaders, Version, Verack). |
NetworkRequest | NetworkRequest provides the inbound interface to the high level 'the rest of the network' abstraction. |
NetworkResponse | NetworkResponse provides the possible responses of the 'rest of the network' abstraction to a 'NetworkRequest' |
PeerError | An enumeration of errors that a Peer connection can encounter, including malicious behavior. |