Module tapyrus::network::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 Decodable and Encodable traits and encodes the magic bytes of the given network

Example: encoding a network’s magic bytes

use tapyrus::network::constants::NetworkId;
use tapyrus::consensus::encode::serialize;

let network = NetworkId::from(1);
let bytes = serialize(&network.magic());

assert_eq!(&bytes[..], &[0x01, 0xFF, 0xF0, 0x00]);

Structs

  • Network ID is identifier of the Tapyrus network
  • 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
  • Bitfield of services provided by this node
  • User agent as it appears in the version message