Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var Package = amino.RegisterPackage(amino.NewPackage( "github.com/gnolang/gno/tm2/pkg/crypto/hd", "tm", amino.GetCallersDirname(), ).WithDependencies().WithTypes( BIP44Params{}, "Bip44Params", ))
Functions ¶
func ComputeMastersFromSeed ¶
ComputeMastersFromSeed returns the master public key, master secret, and chain code in hex.
func DerivePrivateKeyForPath ¶
func DerivePrivateKeyForPath(privKeyBytes [32]byte, chainCode [32]byte, path string) ([32]byte, error)
DerivePrivateKeyForPath derives the private key by following the BIP 32/44 path from privKeyBytes, using the given chainCode.
Example ¶
Output: keys from fundraiser test-vector (cosmos, bitcoin, ether) bfcb217c058d8bbafd5e186eae936106ca3e943889b0b4a093ae13822fd3170c e77c3de76965ad89997451de97b95bb65ede23a6bf185a55d80363d92ee37c3d 7fc4d8a8146dea344ba04c593517d3f377fa6cded36cd55aee0a0bb968e651bc INVALID INVALID keys generated via https://coinomi.com/recovery-phrase-tool.html a61f10c5fecf40c084c94fa54273b6f5d7989386be4a37669e6d6f7b0169c163 32c4599843de3ef161a629a461d12c60b009b676c35050be5f7ded3a3b23501f BIP 32 example c4c11d8c03625515905d7e89d25dfc66126fbc629ecca6db489a1a72fc4bda78
Types ¶
type BIP44Params ¶
type BIP44Params struct { Purpose uint32 `json:"purpose"` CoinType uint32 `json:"coinType"` Account uint32 `json:"account"` Change bool `json:"change"` AddressIndex uint32 `json:"addressIndex"` }
BIP44Params wraps BIP 44 params (5 level BIP 32 path). To receive a canonical string representation ala m / purpose' / coinType' / account' / change / addressIndex call String() on a BIP44Params instance.
func NewFundraiserParams ¶
func NewFundraiserParams(account, coinType, addressIdx uint32) *BIP44Params
NewFundraiserParams creates a BIP 44 parameter object from the params: m / 44' / coinType' / account' / 0 / address_index The fixed parameters (purpose', coin_type', and change) are determined by what was used in the fundraiser.
func NewParams ¶
func NewParams(purpose, coinType, account uint32, change bool, addressIdx uint32) *BIP44Params
NewParams creates a BIP 44 parameter object from the params: m / purpose' / coinType' / account' / change / addressIndex
Example ¶
Output: 44'/0'/0'/0/0 44'/33'/7'/1/9
func NewParamsFromPath ¶
func NewParamsFromPath(path string) (*BIP44Params, error)
Parse the BIP44 path and unmarshal into the struct.
func (BIP44Params) DerivationPath ¶
func (p BIP44Params) DerivationPath() []uint32
DerivationPath returns the BIP44 fields as an array.
func (BIP44Params) String ¶
func (p BIP44Params) String() string