View Source BitcoinLib.Transaction.Witnesses.P2wpkhWitness (BitcoinLib v0.4.3)

Witness section of a P2SH-P2WPKH transaction

Link to this section Summary

Functions

Encodes an witness into a bitstring

Link to this section Functions

Link to this function

encode(signature, public_key)

View Source
@spec encode(bitstring(), bitstring()) :: bitstring()

Encodes an witness into a bitstring

Based on https://github.com/bitcoin/bips/blob/master/bip-0143.mediawiki#p2sh-p2wpkh

examples

Examples

iex> signature = <<0x3044022047ac8e878352d3ebbde1c94ce3a10d057c24175747116f8288e5d794d12d482f0220217f36a485cae903c713331d877c1f64677e3622ad4010726870540656fe9dcb01::568>>
...> public_key = <<0x03ad1d8e89212f0b92c74d23bb710c00662ad1470198ac48c43f7d6f93a2a26873::264>>
...> BitcoinLib.Transaction.Witnesses.P2wpkhWitness.encode(signature, public_key)
<<0x02473044022047ac8e878352d3ebbde1c94ce3a10d057c24175747116f8288e5d794d12d482f0220217f36a485cae903c713331d877c1f64677e3622ad4010726870540656fe9dcb012103ad1d8e89212f0b92c74d23bb710c00662ad1470198ac48c43f7d6f93a2a26873::856>>