/// Create a pay to script address that embeds a witness pay to public key
/// This is a segwit address type that looks familiar (as p2sh) to legacy clients
Create a pay to script address that embeds a witness pay to public key
This is a segwit address type that looks familiar (as p2sh) to legacy clients
Create a pay to script address that embeds a witness pay to public key This is a segwit address type that looks familiar ( as p2sh ) to legacy clients
pub fn p2shwpkh(pk: &key::PublicKey, network: Network) -> Address {
        let mut hash_engine = hash160::Hash::engine();
        pk.write_into(&mut hash_engine);
        let builder = script::Builder::new()
            .push_int(0)
            .push_slice(&hash160::Hash::from_engine(hash_engine)[..]);
        Address {
            network: network,
            payload: Payload::ScriptHash(hash160::Hash::hash(builder.into_script().as_bytes())),
        }
    }
pub fn p2shwpkh ( pk : & key :: PublicKey , network : Network ) -> Address { let mut hash_engine = hash160 :: Hash :: engine ( ) ; pk . write_into ( & mut hash_engine ) ; let builder = script :: Builder :: new ( ) . push_int ( 0 ) . push_slice ( & hash160 :: Hash :: from_engine ( hash_engine ) [ .. ] ) ; Address { network : network , payload : Payload :: ScriptHash ( hash160 :: Hash :: hash ( builder . into_script ( ) . as_bytes ( ) ) ) , } }
Create a pay to script address that embeds a witness pay to public key
This is a segwit address type that looks familiar (as p2sh) to legacy clients
Create a pay to script address that embeds a witness pay to public key This is a segwit address type that looks familiar ( as p2sh ) to legacy clients
pk
&key::PublicKey
network
Network