Skip to content
/ bip32 Public

Go package for BIP32: Hierarchical Deterministic Wallets

License

Notifications You must be signed in to change notification settings

augcos/bip32

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bip32

Introduction

This package is an implementation of the BIP32 specifications in the Go programming language. You can read the documentation here.

Example

package main

import (
    "fmt"

    "github.com/augcos/bip32"
    "github.com/augcos/bip39"
)

func main() {
    // we generate the random entropy
    entropy, _ := bip39.GenEntropy(256)
    // we generate the mnemonic corresponding to that entropy
    mnemonic, _ := bip39.GetMnemonicFromEntropy(entropy)
    // finally, we generate the 512-bit seed from the mnemonic, plus a passphrase
    seed, _ := bip39.GetSeedFromMnemonic(mnemonic, "passphrase")

    // we create the master key
    masterKey, _ := bip32.GenMasterKey(seed)
    // we derivate the child private key
    childKey, _ := bip32.ChildKeyDeriv(masterKey, 0)
    // we get the child public key from the private key
    pubChildKey, _ := bip32.Neuter(childKey)

    // we serialize the child public key
    serializedPubChildKey, _ := bip32.Serialization(pubChildKey)

    fmt.Println("Public Child Key:", serializedPubMasterKey)
}

References

About

Go package for BIP32: Hierarchical Deterministic Wallets

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages