Module breez_sdk_core::bitcoin::util::address

Expand description

Bitcoin addresses.

Support for ordinary base58 Bitcoin addresses and private keys.

§Example: creating a new address from a randomly-generated key pair

use bitcoin::network::constants::Network;
use bitcoin::util::address::Address;
use bitcoin::PublicKey;
use bitcoin::secp256k1::Secp256k1;
use bitcoin::secp256k1::rand::thread_rng;

// Generate random key pair.
let s = Secp256k1::new();
let public_key = PublicKey::new(s.generate_keypair(&mut thread_rng()).1);

// Generate pay-to-pubkey-hash address.
let address = Address::p2pkh(&public_key, Network::Bitcoin);

Structs§

  • A Bitcoin address.
  • A utility struct to encode an address payload with the given parameters. This is a low-level utility struct. Consider using Address instead.

Enums§