bip32

package
v0.7.0-alpha-2022-07-26 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 26, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeriveMaster

func DeriveMaster(seed []byte) (*curve.Secp256k1Scalar, []byte, error)

DeriveMaster uses a secret seed to derive a scalar and chaining value.

This scalar serves as the master secret key. Together with the chaining value, it forms the extended master secret key.

If an error is returned, this means that this seed is not useable, and a new seed should be generated instead.

func DeriveScalar

func DeriveScalar(public *curve.Secp256k1Point, chaining []byte, i uint32) (*curve.Secp256k1Scalar, []byte, error)

DeriveScalar uses a public point, chaining value, and index, to derive a scalar and chaining value.

This scalar should be added to the secret key.

If an error is returned, this means that this index will not be useable, and another index should be used instead.

This function will panic if an index for a hardened key is used.

See: https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki

func DeriveScalarForPath

func DeriveScalarForPath(public *curve.Secp256k1Point, chaining []byte, path Path) (*curve.Secp256k1Scalar, []byte, error)

DeriveScalarForPath uses a public point, chaining value, and path to derive a scalar and chaining value.

This scalar should be added to the secret key underlying the public point.

If an error is returned, this means that an index in this path will not be useable, and another path should be used instead.

This function will panic if an index for a hardened key is used.

Types

type Path

type Path struct {
	// contains filtered or unexported fields
}

func PathFrom

func PathFrom(spec string) (Path, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL