bdk_chain::bitcoin::bech32::segwit

Function decode

pub fn decode(s: &str) -> Result<(Hrp, Fe32, Vec<u8>), DecodeError>
Expand description

Decodes a segwit address.

§Returns

The HRP, the witness version, and a guaranteed valid length witness program.

§Examples

use bech32::segwit;
let address = "bc1py3m7vwnghyne9gnvcjw82j7gqt2rafgdmlmwmqnn3hvcmdm09rjqcgrtxs";
let (_hrp, _witness_version, _witness_program) = segwit::decode(address).expect("failed to decode address");