Module constants

Source
Expand description

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 ConsensusDecodable and ConsensusEncodable and encodes the magic bytes of the given network

§Example: encoding a network’s magic bytes

use stacks_common::deps_common::bitcoin::network::constants::Network;
use stacks_common::deps_common::bitcoin::network::serialize::serialize;

let network = Network::Bitcoin;
let bytes = serialize(&network).unwrap();

assert_eq!(&bytes[..], &[0xF9, 0xBE, 0xB4, 0xD9]);

Enums§

Network
The cryptocurrency to act on

Constants§

PROTOCOL_VERSION
Version of the protocol as appearing in network message headers
SERVICES
Bitfield of services provided by this node
USER_AGENT
User agent as it appears in the version message