Skip to main content

Posts

Showing posts from November 16, 2019

HD Wallet key Generation

HD Wallet key Generation Example to generate HD wallet child key in golang. package main import ( "github.com/tyler-smith/go-bip32" "log" "github.com/btcsuite/btcutil/base58" ) func main(){ // root key rootKey := "xpub661MyMwAqRbcFPUpZvj3QydNRASDRHEZ1TyvTkhDTAPqytQLx7j8XWFEsnArLx9rbfHTCcCUfp6K75qcAqkp83ASXnCpiXWT5M6Hcc92wSV" decoded := base58.Decode(rootKey) masterKey, _ := bip32.Deserialize([]byte(decoded)) /* (m) / | \ / | \ m/0 m/1 m/2 ... . . . */ childKey, _ := masterKey.NewChildKey(2) // m/2 log.Println("child key: \n", childKey) }