Module bitcoin::network

source ·
Expand description

Bitcoin network.

The term “network” is overloaded, here Network refers to the specific Bitcoin network we are operating on e.g., signet, regtest. The terms “network” and “chain” are often used interchangeably for this concept.

§Example: encoding a network’s magic bytes

use bitcoin::Network;
use bitcoin::consensus::encode::serialize;

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

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

Modules§

  • Module for serialization/deserialization of network variants into/from Bitcoin Core values

Structs§

Enums§