cardano-wallet-core-2022.7.1: The Wallet Backend for a Cardano node.
Copyright © 2018-2020 IOHK
License Apache-2.0
Safe Haskell None
Language Haskell2010

Cardano.Wallet.Primitive.AddressDerivation.Byron

Description

Implementation of address derivation for the random scheme, as implemented by the legacy Cardano wallets.

For full documentation of the key derivation schemes, see the Cardano.Crypto.Wallet module, and the implementation in cardano-crypto .

Synopsis

Types

data ByronKey (depth :: Depth ) key Source #

Material for deriving HD random scheme keys, which can be used for making addresses.

Constructors

ByronKey

Fields

Instances

Instances details
WalletKey ByronKey Source #
Instance details

Defined in Cardano.Wallet.Primitive.AddressDerivation.Byron

HardDerivation ByronKey Source #
Instance details

Defined in Cardano.Wallet.Primitive.AddressDerivation.Byron

MkKeyFingerprint ByronKey Address Source #
Instance details

Defined in Cardano.Wallet.Primitive.AddressDerivation.Byron

PaymentAddress ' Mainnet ByronKey Source #
Instance details

Defined in Cardano.Wallet.Primitive.AddressDerivation.Byron

PersistPrivateKey ( ByronKey ' RootK ) Source #
Instance details

Defined in Cardano.Wallet.Primitive.AddressDerivation.Byron

KnownNat pm => PaymentAddress (' Testnet pm) ByronKey Source #
Instance details

Defined in Cardano.Wallet.Primitive.AddressDerivation.Byron

IsOwned ( RndState n) ByronKey Source #
Instance details

Defined in Cardano.Wallet.Primitive.AddressDiscovery.Random

( Eq key, Eq ( DerivationPathFrom depth)) => Eq ( ByronKey depth key) Source #
Instance details

Defined in Cardano.Wallet.Primitive.AddressDerivation.Byron

( Show key, Show ( DerivationPathFrom depth)) => Show ( ByronKey depth key) Source #
Instance details

Defined in Cardano.Wallet.Primitive.AddressDerivation.Byron

Generic ( ByronKey depth key) Source #
Instance details

Defined in Cardano.Wallet.Primitive.AddressDerivation.Byron

Associated Types

type Rep ( ByronKey depth key) :: Type -> Type Source #

Methods

from :: ByronKey depth key -> Rep ( ByronKey depth key) x Source #

to :: Rep ( ByronKey depth key) x -> ByronKey depth key Source #

( NFData key, NFData ( DerivationPathFrom depth)) => NFData ( ByronKey depth key) Source #
Instance details

Defined in Cardano.Wallet.Primitive.AddressDerivation.Byron

Methods

rnf :: ByronKey depth key -> () Source #

BoundedAddressLength ByronKey Source #
Instance details

Defined in Cardano.Wallet.Primitive.AddressDerivation.Byron

KnownNat p => IsOwned ( RndAnyState n p) ByronKey Source #
Instance details

Defined in Cardano.Wallet.Primitive.AddressDiscovery.Random

type AddressIndexDerivationType ByronKey Source #
Instance details

Defined in Cardano.Wallet.Primitive.AddressDerivation.Byron

type Rep ( ByronKey depth key) Source #
Instance details

Defined in Cardano.Wallet.Primitive.AddressDerivation.Byron

type Rep ( ByronKey depth key) = D1 (' MetaData "ByronKey" "Cardano.Wallet.Primitive.AddressDerivation.Byron" "cardano-wallet-core-2022.7.1-AGKhlyz9liLKN3QqZD1gj" ' False ) ( C1 (' MetaCons "ByronKey" ' PrefixI ' True ) ( S1 (' MetaSel (' Just "getKey") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 key) :*: ( S1 (' MetaSel (' Just "derivationPath") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 ( DerivationPathFrom depth)) :*: S1 (' MetaSel (' Just "payloadPassphrase") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 ( Passphrase "addr-derivation-payload")))))

Generation

unsafeGenerateKeyFromSeed :: DerivationPathFrom depth -> SomeMnemonic -> Passphrase "encryption" -> ByronKey depth XPrv Source #

Generate a new key from seed. Note that the depth is left open so that the caller gets to decide what type of key this is. This is mostly for testing, in practice, seeds are used to represent root keys, and one should use generateKeyFromSeed .

generateKeyFromSeed :: SomeMnemonic -> Passphrase "encryption" -> ByronKey ' RootK XPrv Source #

Generate a root key from a corresponding seed. The seed should be at least 16 bytes.

minSeedLengthBytes :: Int Source #

The amount of entropy carried by a BIP-39 12-word mnemonic is 16 bytes.

Derivation

deriveAccountPrivateKey :: Passphrase "encryption" -> ByronKey ' RootK XPrv -> Index ' WholeDomain ' AccountK -> ByronKey ' AccountK XPrv Source #

Derives account private key from the given root private key, using derivation scheme 1.

NOTE: The caller is expected to provide the corresponding passphrase (and to have checked that the passphrase is valid). Providing a wrong passphrase will not make the function fail but will instead, yield an incorrect new key that doesn't belong to the wallet.

deriveAddressPrivateKey :: Passphrase "encryption" -> ByronKey ' AccountK XPrv -> Index ' WholeDomain ' AddressK -> ByronKey ' AddressK XPrv Source #

Derives address private key from the given account private key, using derivation scheme 1.

NOTE: The caller is expected to provide the corresponding passphrase (and to have checked that the passphrase is valid). Providing a wrong passphrase will not make the function fail but will instead, yield an incorrect new key that doesn't belong to the wallet.