cardano-addresses-3.11.0: Library utilities for mnemonic generation and address derivation.
Copyright © 2018-2020 IOHK
License Apache-2.0
Safe Haskell None
Language Haskell2010

Cardano.Address.Style.Byron

Description

Synopsis

Documentation

This module provides an implementation of:

We call Byron addresses the old address type used by Daedalus in the early days of Cardano. Using this type of addresses and underlying key scheme is now considered deprecated because of some security implications.

The internals of the Byron does not matter for the reader, but basically contains what is necessary to perform key derivation and generate addresses from a Byron type.

Deprecation Notice

Unless you have good reason to do so (like writing backward-compatible code with an existing piece), any new implementation should use the Icarus style for key and addresses.

Byron

data Byron (depth :: Depth ) key Source #

Deprecated: see Icarus

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

Since: 1.0.0

Instances

Instances details
GenMasterKey Byron Source #
Instance details

Defined in Cardano.Address.Style.Byron

HardDerivation Byron Source #
Instance details

Defined in Cardano.Address.Style.Byron

HasNetworkDiscriminant Byron Source #
Instance details

Defined in Cardano.Address.Style.Byron

PaymentAddress Byron Source #
Instance details

Defined in Cardano.Address.Style.Byron

Functor ( Byron depth) Source #
Instance details

Defined in Cardano.Address.Style.Byron

Methods

fmap :: (a -> b) -> Byron depth a -> Byron depth b Source #

(<$) :: a -> Byron depth b -> Byron depth a Source #

( Eq key, Eq ( DerivationPath depth)) => Eq ( Byron depth key) Source #
Instance details

Defined in Cardano.Address.Style.Byron

Methods

(==) :: Byron depth key -> Byron depth key -> Bool Source #

(/=) :: Byron depth key -> Byron depth key -> Bool Source #

( Show key, Show ( DerivationPath depth)) => Show ( Byron depth key) Source #
Instance details

Defined in Cardano.Address.Style.Byron

Generic ( Byron depth key) Source #
Instance details

Defined in Cardano.Address.Style.Byron

Associated Types

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

Methods

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

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

( NFData key, NFData ( DerivationPath depth)) => NFData ( Byron depth key) Source #
Instance details

Defined in Cardano.Address.Style.Byron

Methods

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

type SecondFactor Byron Source #
Instance details

Defined in Cardano.Address.Style.Byron

type AccountIndexDerivationType Byron Source #
Instance details

Defined in Cardano.Address.Style.Byron

type AddressIndexDerivationType Byron Source #
Instance details

Defined in Cardano.Address.Style.Byron

type WithRole Byron Source #
Instance details

Defined in Cardano.Address.Style.Byron

type NetworkDiscriminant Byron Source #
Instance details

Defined in Cardano.Address.Style.Byron

type Rep ( Byron depth key) Source #
Instance details

Defined in Cardano.Address.Style.Byron

type family DerivationPath (depth :: Depth ) :: Type where ... Source #

Deprecated: see Icarus

The hierarchical derivation indices for a given level/depth.

Since: 1.0.0

$sel:payloadPassphrase:Byron :: Byron depth key -> ScrubbedBytes Source #

Deprecated: see Icarus

Used for encryption of the derivation path payload within an address.

Since: 1.0.0

$sel:derivationPath:Byron :: Byron depth key -> DerivationPath depth Source #

Deprecated: see Icarus

The address derivation indices for the level of this key.

Since: 1.0.0

$sel:getKey:Byron :: Byron depth key -> key Source #

Deprecated: see Icarus

The raw private or public key.

Since: 1.0.0

Key Derivation

genMasterKeyFromXPrv :: XPrv -> Byron ' RootK XPrv Source #

Deprecated: see Icarus

Generate a root key from a corresponding root XPrv

Since: 1.0.0

genMasterKeyFromMnemonic Source #

Arguments

:: SomeMnemonic

Some valid mnemonic sentence.

-> Byron ' RootK XPrv

Deprecated: see Icarus

Generate a root key from a corresponding mnemonic.

Since: 1.0.0

deriveAccountPrivateKey :: Byron ' RootK XPrv -> Index ' WholeDomain ' AccountK -> Byron ' AccountK XPrv Source #

Deprecated: see Icarus

Derives an account private key from the given root private key.

Since: 1.0.0

deriveAddressPrivateKey :: Byron ' AccountK XPrv -> Index ' WholeDomain ' PaymentK -> Byron ' PaymentK XPrv Source #

Deprecated: see Icarus

Derives an address private key from the given account private key.

Since: 1.0.0

Addresses

Generating a PaymentAddress

import Cardano.Address ( base58 )
import Cardano.Address.Derivation ( toXPub(..) )

base58 $ paymentAddress byronMainnet (toXPub <$> addrK)
"DdzFFzCqrhsq3KjLtT51mESbZ4RepiHPzLqEhamexVFTJpGbCXmh7qSxnHvaL88QmtVTD1E1sjx8Z1ZNDhYmcBV38ZjDST9kYVxSkhcw"

eitherInspectAddress :: Maybe XPub -> Address -> Either ErrInspectAddress AddressInfo Source #

Determines whether an Address is a Byron address.

Returns either details about the Address , or ErrInspectAddress if it's not a valid address.

Since: 3.4.0

inspectAddress :: forall m. MonadThrow m => Maybe XPub -> Address -> m Value Source #

Determines whether an Address is a Byron address.

Returns a JSON object with information about the address, or throws ErrInspectAddress if the address isn't a byron address.

Since: 3.0.0

paymentAddress :: NetworkDiscriminant Byron -> Byron ' PaymentK XPub -> Address Source #

Convert a public key to a payment Address valid for the given network discrimination.

Since: 1.0.0

data ErrInspectAddress Source #

Possible errors from inspecting a Byron address

Since: 3.0.0

Instances

Instances details
Eq ErrInspectAddress Source #
Instance details

Defined in Cardano.Address.Style.Byron

Show ErrInspectAddress Source #
Instance details

Defined in Cardano.Address.Style.Byron

Generic ErrInspectAddress Source #
Instance details

Defined in Cardano.Address.Style.Byron

ToJSON ErrInspectAddress Source #
Instance details

Defined in Cardano.Address.Style.Byron

Exception ErrInspectAddress Source #
Instance details

Defined in Cardano.Address.Style.Byron

type Rep ErrInspectAddress Source #
Instance details

Defined in Cardano.Address.Style.Byron

type Rep ErrInspectAddress = D1 (' MetaData "ErrInspectAddress" "Cardano.Address.Style.Byron" "cardano-addresses-3.11.0-D40zGSHo3QMFNy9OpWafYI" ' False ) ( C1 (' MetaCons "MissingExpectedDerivationPath" ' PrefixI ' False ) ( U1 :: Type -> Type ) :+: ( C1 (' MetaCons "DeserialiseError" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 DeserialiseFailure )) :+: C1 (' MetaCons "FailedToDecryptPath" ' PrefixI ' False ) ( U1 :: Type -> Type )))

Network Discrimination

Unsafe

liftXPrv Source #

Arguments

:: XPub

A root public key

-> DerivationPath depth
-> XPrv
-> Byron depth XPrv

Deprecated: see Icarus

Backdoor for generating a new key from a raw XPrv .

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 genMasterKeyFromXPrv

The first argument is a type-family DerivationPath and its type depends on the depth of the key.

examples:

>>> liftXPrv rootPrv () prv
_ :: Byron RootK XPrv
>>> liftXPrv rootPrv minBound prv
_ :: Byron AccountK XPrv
>>> liftXPrv rootPrv (minBound, minBound) prv
_ :: Byron PaymentK XPrv

Since: 2.0.0

liftXPub Source #

Arguments

:: XPub

A root public key

-> DerivationPath depth
-> XPub
-> Byron depth XPub

Deprecated: see Icarus

Backdoor for generating a new key from a raw XPub .

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 genMasterKeyFromXPrv

see also liftXPrv

Since: 2.0.0