BSV-ex v0.2.5 BSV.Extended.PublicKey View Source
BIP-32 extended public key module.
Link to this section Summary
Functions
Converts the given extended private key into an extended public key.
Converts the given xpub string to an extended public key.
Converts the given extended public key struct to an encoded xpub string.
Link to this section Types
Extended Public Key
Link to this section Functions
Link to this function
from_private_key(private_key, options \\ [])
View Sourcefrom_private_key(BSV.Extended.PrivateKey.t(), keyword()) :: t()
Converts the given extended private key into an extended public key.
Options
The accepted options are:
:compressed
- Specify whether to compress the generated public key. Defaults totrue
.
Examples
iex> key = BSV.Extended.PrivateKey.from_seed(BSV.Test.bsv_seed)
...> |> BSV.Extended.PublicKey.from_private_key
...> key.__struct__ == BSV.Extended.PublicKey
true
Converts the given xpub string to an extended public key.
Examples
iex> key = "xpub661MyMwAqRbcEiqMJB5yEQavJnZ7XSH4VC5HaiWsw6MBym6Pcr7WpUdfFykNbZL2JDFFYVe1NpUhJwvaZN44d7R3SmPHSjmUiT8pkR8Yrkk"
...> |> BSV.Extended.PublicKey.from_string
...> key.__struct__ == BSV.Extended.PublicKey
true
Converts the given extended public key struct to an encoded xpub string.
Examples
iex> BSV.Extended.PrivateKey.from_seed(BSV.Test.bsv_seed)
...> |> BSV.Extended.PublicKey.from_private_key
...> |> BSV.Extended.PublicKey.to_string
"xpub661MyMwAqRbcEiqMJB5yEQavJnZ7XSH4VC5HaiWsw6MBym6Pcr7WpUdfFykNbZL2JDFFYVe1NpUhJwvaZN44d7R3SmPHSjmUiT8pkR8Yrkk"