BSV-ex v0.1.0 BSV.Address View Source
Module for calculating any Bitcoin public or private key's address.
A Bitcoin address is calculated by hashing the public key with both the SHA-256 and then RIPEMD alogrithms. The hash is then Base58Check encoded, resulting in the Bitcoin address.
Link to this section Summary
Functions
Calculates and returns the Bitcoin address from the given public or private key.
Link to this section Functions
Link to this function
to_string(key, options \\ [])
View Sourceto_string( BSV.KeyPair.t() | BSV.Extended.PublicKey.t() | BSV.Extended.PrivateKey.t() | {binary(), binary()}, binary() ) :: String.t()
Calculates and returns the Bitcoin address from the given public or private key.
Examples
iex> BSV.Crypto.ECDSA.PrivateKey.from_sequence(BSV.Test.ecdsa_key)
...> |> BSV.KeyPair.from_ecdsa_key
...> |> BSV.Address.to_string
"18cqNbEBxkAttxcZLuH9LWhZJPd1BNu1A5"
iex> BSV.Crypto.ECDSA.PrivateKey.from_sequence(BSV.Test.ecdsa_key)
...> |> BSV.KeyPair.from_ecdsa_key(compressed: false)
...> |> BSV.Address.to_string
"1N5Cu7YUPQhcwZaQLDT5KnDpRVKzFDJxsf"
iex> BSV.Crypto.ECDSA.PrivateKey.from_sequence(BSV.Test.ecdsa_key)
...> |> BSV.KeyPair.from_ecdsa_key
...> |> BSV.Address.to_string(network: :test)
"mo8nfeKAmmc9g56B4UFXARutAPDi1sr7tH"