HdWallet class

This class implements a hierarchical deterministic wallet that generates cryptographic keys and addresses given a root signing key. It also supports the creation/restoration of the root signing key from a set of nmemonic BIP-39 words. Cardano Shelley addresses are supported by default, but the code is general enough to support any wallet based on the BIP32-ED25519 standard.

This code builds on following standards:

https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki - HD wallets https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki - mnemonic words https://github.com/bitcoin/bips/blob/master/bip-0043.mediawiki - Bitcoin purpose https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki - multi-acct wallets https://cips.cardano.org/cips/cip3/ - key generation https://cips.cardano.org/cips/cip5/ - Bech32 prefixes https://cips.cardano.org/cips/cip11/ - staking key https://cips.cardano.org/cips/cip16/ - key serialisation https://cips.cardano.org/cips/cip19/ - address structure https://cips.cardano.org/cips/cip1852/ - 1852 purpose field https://cips.cardano.org/cips/cip1855/ - forging keys https://github.com/cardano-foundation/CIPs/tree/master/CIP-0105 - Conway drep/comittee derivations https://raw.githubusercontent.com/input-output-hk/adrestia/master/user-guide/static/Ed25519_BIP.pdf

BIP-44 path: m / purpose' / coin_type' / account_ix' / change_chain / address_ix

Cardano adoption: m / 1852' / 1851' / account' / role / index

BIP-44 Wallets Key Hierarchy - Cardano derivation: +--------------------------------------------------------------------------------+ | BIP-39 Encoded Seed with CRC a.k.a Mnemonic Words | | | | squirrel material silly twice direct ... razor become junk kingdom flee | | | +--------------------------------------------------------------------------------+ | | v +--------------------------+ +-----------------------+ | Wallet Private Key |--->| Wallet Public Key | +--------------------------+ +-----------------------+ | | purpose (e.g. 1852') | v +--------------------------+ | Purpose Private Key | +--------------------------+ | | coin type (e.g. 1815' for ADA) v +--------------------------+ | Coin Type Private Key | +--------------------------+ | | account ix (e.g. 0') v +--------------------------+ +-----------------------+ | Account Private Key |--->| Account Public Key | +--------------------------+ +-----------------------+ | | | role (e.g. 0=external/payments, | | 1=internal/change, 2=staking, | | 3 = drep creds, | | 4 = const committee cold, | | 5 = const committee hot) | v v +--------------------------+ +-----------------------+ | Role Private Key |--->| Role Public Key | +--------------------------+ +-----------------------+ | | | index (e.g. 0) | v v +--------------------------+ +-----------------------+ | Address Private Key |--->| Address Public Key | +--------------------------+ +-----------------------+

Constructors

HdWallet.new({required Bip32SigningKey rootSigningKey, required int accountIndex})
root constructor taking a root signing key
HdWallet.fromHexEntropy(String hexEntropy, {int accountIndex = defaultAccountIndex})
factory
HdWallet.fromMnemonic(String mnemonic, {int accountIndex = defaultAccountIndex})
factory
HdWallet.fromSeed(Uint8List seed, {int accountIndex = defaultAccountIndex})
Create HdWallet from seed
factory
HdWallet.unmarshal(Uint8List bytes)
factory

Properties

accountIndex int
final
accountPublicKey → Bip32PublicKey
latefinal
constitutionalCommitteeColdKeys → Lazy<Bip32KeyPair>
latefinal
constitutionalCommitteeHotKeys → Lazy<Bip32KeyPair>
latefinal
drepCredentialKeys → Lazy<Bip32KeyPair>
latefinal
hashCode int
The hash code for this object.
no setterinherited
rootSigningKey → Bip32SigningKey
final
rootVerifyKey → Bip32VerifyKey
return the root signing key
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stakeKeys → Lazy<Bip32KeyPair>
latefinal

Methods

deriveAddressKeys({required Bip32KeyRole role, required int index}) → Bip32KeyPair
run down the 5 level hierarchical chain to derive a new address key pair.
deriveBaseAddressKit({Bip32KeyRole role = Bip32KeyRole.payment, required int index, required NetworkId networkId}) → CardanoAddressKit
iterate key chain until an unused address is found, then return keys and address.
marshal() Uint8List
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toBaseAddress({required Bip32PublicKey spendVerifyKey, required NetworkId networkId}) → CardanoAddress
construct a Shelley base address give a public spend key, public stake key and networkId
toRewardAddress({required NetworkId networkId}) → CardanoAddress
construct a Shelley staking address give a public spend key and networkId
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited