Module constants
Expand description
Bitcoin network constants.
This module provides various constants relating to the Bitcoin network protocol, such as protocol versioning and magic header bytes.
The Network
type implements the Decodable
and
Encodable
traits and encodes the magic bytes of the given
network.
§Example: encoding a network’s magic bytes
use bitcoin::network::constants::Network;
use bitcoin::consensus::encode::serialize;
let network = Network::Bitcoin;
let bytes = serialize(&network.magic());
assert_eq!(&bytes[..], &[0xF9, 0xBE, 0xB4, 0xD9]);
Structs§
- Flags to indicate which network services a node supports.
Enums§
- The cryptocurrency to act on
Constants§
- Version of the protocol as appearing in network message headers This constant is used to signal to other peers which features you support. Increasing it implies that your software also supports every feature prior to this version. Doing so without support may lead to you incorrectly banning other peers or other peers banning you. These are the features required for each version: 70016 - Support receiving
wtxidrelay
message betweenversion
andverack
message 70015 - Support receiving invalid compact blocks from a peer without banning them 70014 - Support compact block messagessendcmpct
,cmpctblock
,getblocktxn
andblocktxn
70013 - Supportfeefilter
message 70012 - Supportsendheaders
message and announce new blocks via headers rather than inv 70011 - Support NODE_BLOOM service flag and don’t support bloom filter messages if it is not set 70002 - Supportreject
message 70001 - Support bloom filter messagesfilterload
,filterclear
filteradd
,merkleblock
and FILTERED_BLOCK inventory type 60002 - Supportmempool
message 60001 - Supportpong
message and nonce inping
message