View Source BitcoinLib.Key.PublicKey.Address (BitcoinLib v0.2.0-pre1)
Converts public keys into Bitcoin addresses of different formats
Link to this section Summary
Functions
Turns a public key into an address of the specified format
Link to this section Functions
@spec from_public_key( %BitcoinLib.Key.PublicKey{ chain_code: term(), depth: term(), fingerprint: term(), index: term(), key: term(), parent_fingerprint: term(), uncompressed_key: term() }, :p2pkh | :p2sh | :bech32, :mainnet | :testnet ) :: binary()
Turns a public key into an address of the specified format
examples
Examples
iex> %BitcoinLib.Key.PublicKey{ ...> key: <<0x0343B337DEC65A47B3362C9620A6E6FF39A1DDFA908ABAB1666C8A30A3F8A7CCCC::264>> ...> } ...> |> BitcoinLib.Key.PublicKey.Address.from_public_key(:bech32, :mainnet) "bc1qa5gyew808tdta3wjh6qh3jvcglukjsnfg0qx4u"