bitcoin_bip32 library

Classes

Chain
Use this class to generate extended keys. You can create an instance of this class with either a serialized extended key (Chain.import) or a hex encoded master seed (Chain.seed).
ExtendedKey
Abstract class on which ExtendedPrivateKey and ExtendedPublicKey are based.
ExtendedPrivateKey
An extended private key as defined by the BIP32 specification. [...]
ExtendedPublicKey
An extended public key as defined by the BIP32 specification. [...]

Constants

alphabet → const String
Used for the Base58 encoding.
"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"
firstHardenedChild → const int
FirstHardenedChild is the index of the firxt "hardened" child key as per the bip32 spec
0x80000000
lengthOfChecksum → const int
Length of checksum in bytes
4
lengthOfKey → const int
From the specification the length of a private of public key
33
lengthOfSerializedKey → const int
From the specification (in bytes): 4 version 1 depth 4 fingerprint 4 child number 32 chain code 33 public or private key
78

Properties

curve ECCurve_secp256k1
The Bitcoin curve
final
masterKey Uint8List
From the BIP32 spec. Used when calculating the hmac of the seed
final
privateKeyVersion Uint8List
The 4 version bytes for the private key serialization as defined in the BIP21 spec
final
publicKeyVersion Uint8List
The 4 version bytes for the public key serialization as defined in the BIP21 spec
final
ripemd160digest RIPEMD160Digest
final
sha256digest SHA256Digest
final
sha512digest SHA512Digest
final

Functions

compressed(ECPoint q) Uint8List
AKA 'ser_P(P)' in the specification
debug(List<int> payload) → void
deriveExtendedPrivateChildKey(ExtendedPrivateKey parent, int childNumber) ExtendedPrivateKey
CKDpriv in the specficiation
deriveExtendedPublicChildKey(ExtendedPublicKey parent, int childNumber) ExtendedPublicKey
CKDpub in the specification
equal(Iterable a, Iterable b) bool
hash160(Uint8List data) Uint8List
Double hash the data: RIPEMD160(SHA256(data))
hmacSha512(Uint8List key, Uint8List message) Uint8List
This function returns a list of length 64. The first half is the key, the second half is the chain code.
publicKeyFor(BigInt d) ECPoint
AKA 'point(k)' in the specification
serializeTo4bytes(int i) Uint8List
AKA 'ser_32(i)' in the specification
sublist(Uint8List list, int start, int end) Uint8List

Exceptions / Errors

InvalidChecksum
Thrown when deserializing a key with an invalid checksum. [...]
InvalidChildNumber
Thrown when trying to derive a public key with a hardened child number.
InvalidKeyLength
Thrown when deserializing a key which is not of correct length.
InvalidPath
Thrown when trying to derive a child key with a wrong path.
KeyBiggerThanOrder
Thrown when a derived key is bigger than the order of the curve. [...]
KeyInfinite
Thrown when a derived public key is infinite. [...]
KeyZero
Thrown when a derived private key is zero. [...]