A Golang implementation of the BIP44 for Hierarchical Deterministic (HD) addresses. It currently only supports Bitcoin.
Released under the terms of the MIT LICENSE.
This library is in very early stages. Please be aware that some bugs may exist.
Do not trust. Verify.
Since this lib is in its early days, we recommend every user of this library audit and verify any underlying code for its validity and suitability. You can do so by using this tool.
go get -u github.com/edunuzzi/go-bip44
// bitSize must be a multiple of 32
bitSize := 256
mnemonic, _ := bip44.NewMnemonic(bitSize)
seedBytes := m.NewSeed("my password")
xKey, _ := bip44.NewKeyFromSeedHex("your secret seed in hex format", bip44.MAINNET)
xKey, _ := bip44.NewKeyFromSeedBytes(seedBytes, bip44.MAINNET)
ak, _ := bip44.NewAccountKeyFromXPubKey(xPubKey)
externalAddress, _ := accountKey.DeriveP2PKAddress(bip44.ExternalChangeType, 0, bip44.MAINNET)
internalAddress, _ := accountKey.DeriveP2PKAddress(bip44.InternalChangeType, 0, bip44.MAINNET)
coin | account | chain | address | path |
---|---|---|---|---|
Bitcoin | first | external | first | m / 44' / 0' / 0' / 0 / 0 |
xKey, _ := bip44.NewKeyFromSeedHex("your secret seed in hex format", bip44.MAINNET)
accountKey, _ := xKey.BIP44AccountKey(bip44.BitcoinCoinType, 0, true)
externalAddress, _ := accountKey.DeriveP2PKAddress(bip44.ExternalChangeType, 0, bip44.MAINNET)
coin | account | chain | address | path |
---|---|---|---|---|
Bitcoin | first | external | second | m / 44' / 0' / 0' / 0 / 1 |
xKey, _ := bip44.NewKeyFromSeedHex("your secret seed in hex format", bip44.MAINNET)
accountKey, _ := xKey.BIP44AccountKey(bip44.BitcoinCoinType, 0, true)
externalAddress, _ := accountKey.DeriveP2PKAddress(bip44.ExternalChangeType, 1, bip44.MAINNET)
coin | account | chain | address | path |
---|---|---|---|---|
Bitcoin Testnet | second | internal | first | m / 44' / 1' / 1' / 1 / 0 |
xKey, _ := bip44.NewKeyFromSeedHex("your secret seed in hex format", bip44.TESTNET3)
accountKey, _ := xKey.BIP44AccountKey(bip44.TestnetCoinType, 1, true)
externalAddress, _ := accountKey.DeriveP2PKAddress(bip44.InternalChangeType, 0, bip44.TESTNET3)
- Report badge
- Unit Tests
- Create GoDoc
- Stellar
- Ethereum
Please feel free to contribute with both suggestions and pull requests :D