View Source Public Keys
A public key is derived from a private key. The main difference is that it can't be used to spend funds. It still is able to view balances and create addresses.
creation
Creation
First, a private key is needed...
alias BitcoinLib.Key.PrivateKey
private_key =
"blue involve cook print twist crystal razor february caution private slim medal"
|> PrivateKey.from_mnemonic_phrase()
... it can then be converted into a public key
public_key =
private_key
|> PrivateKey.from_private_key
serialization
Serialization
A public key can be serialized into an xpub
public_key
|> PrivateKey.serialize!
which results in
"xpub661MyMwAqRbcGiWUazDmCUZbC8Z7WMcjveWgfU92NAu4kvFcpZ8LGV2Y4bRaT8sBUzihLgiyMqsbb61HKFV1sL185uZs1DE15dpWfrQFqBY"
and can then be imported in an online app to generate a read-only wallet