HDPrivateKey class
Represents a private key with a chain code that can derive BIP32 keys.
Constructors
- HDPrivateKey.new({required ECPrivateKey privateKey, required Uint8List chaincode, required int depth, required int index, required int parentFingerprint})
- HDPrivateKey.decode(String b58, [int? version])
-
Creates a HD private key from a base58 encoded representation (
b58
). May throw InvalidBase58, InvalidBase58Checksum or InvalidHDKey. Ifversion
is provided a InvalidHDKeyVersion will be thrown if the version does not match.factory - HDPrivateKey.fromKeyAndChainCode(ECPrivateKey privateKey, Uint8List chaincode)
- Creates a master key from an existing private key and chain code.
- HDPrivateKey.fromSeed(Uint8List seed, {String key = "Bitcoin seed"})
-
Generates a master key from a 16-64 byte
seed
. The default BIP32 HMACkey
can also be changed.factory
Properties
- chaincode → Uint8List
-
no setterinherited
- depth → int
-
finalinherited
- fingerprint → int
-
The integer fingerprint of the identifier
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- hdPublicKey → HDPublicKey
-
no setter
- identifier → Uint8List
-
The identifier hash for this key
no setterinherited
- index → int
-
finalinherited
- parentFingerprint → int
-
finalinherited
- privateKey → ECPrivateKey
-
final
- publicKey → ECPublicKey
-
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
derive(
int index) → HDPrivateKey -
Derives a key at
index
returning the same type of key: either public or private. Theindex
can inlcude the hardenBit to specify that it is hardened.override -
deriveHardened(
int index) → HDPrivateKey -
Derives a hardened key at
index
which only applies to private keys. Theindex
must not include the left-bit to specify that it is hardened.inherited -
derivePath(
String path) → HDPrivateKey -
Derives a child key in a
path
format akin to "m/15/3'/4" where the optional "m" specifies that this key is a master key and "'" specifies that an index is a hardened key.override -
encode(
int version) → String -
Encodes the base58 representation of this key using the
version
prefix.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited