Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Key ¶
Key represents basic key methods
func FromString ¶
FromString generates keys from given xpriv
type KeyWithMnemonic ¶
KeyWithMnemonic represents methods for generated keys
func FromMnemonic ¶
func FromMnemonic(mnemonic string) (KeyWithMnemonic, error)
FromMnemonic generates Keys based on given mnemonic
Example ¶
package main import ( "fmt" "github.com/bitcoin-sv/spv-wallet-go-client/xpriv" ) func main() { keys, _ := xpriv.FromMnemonic("absorb corn ostrich order sing boost just harvest enable make detail future desert bus adult") fmt.Println("mnemonic:", keys.Mnemonic()) fmt.Println("xpriv:", keys.XPriv()) fmt.Println("xpub:", keys.XPub().String()) }
Output: mnemonic: absorb corn ostrich order sing boost just harvest enable make detail future desert bus adult xpriv: xprv9s21ZrQH143K3Lh4wdicqvYNMcdh49rMLqDvQoyys8L6f5tfE2WkQN7ZVE2awBrfVWNSJ8pPd4QLLr94Nur85Dvj8kD8RoZghBuNTpvL8si xpub: xpub661MyMwAqRbcFpmY3fFdD4V6ueUBTcaCi49XDCPbRTs5XtDomZpzxAS3LUb2hMfUVphDsSPxfjietmsBRFkLDY9Xa3P4jbgNDMnDK3UqJe2
func Generate ¶
func Generate() (KeyWithMnemonic, error)
Generate generates a random set of keys - xpriv, xpb and mnemonic
Example ¶
package main import ( "fmt" "github.com/bitcoin-sv/spv-wallet-go-client/xpriv" ) func main() { keys, _ := xpriv.Generate() fmt.Println("xpriv:", keys.XPriv()) fmt.Println("xpub:", keys.XPub().String()) }
Output:
Click to show internal directories.
Click to hide internal directories.