cardano-addresses
Copyright2020 Input Output (Hong Kong) Ltd. 2021-2022 Input Output Global Inc. (IOG) 2023-2025 Intersect
LicenseApache-2.0
Safe HaskellNone
LanguageHaskell2010

Cardano.Address.Style.Shelley

Description

 
Synopsis

Documentation

This module provides an implementation of:

  • GenMasterKey: for generating Shelley master keys from mnemonic sentences
  • HardDerivation: for hierarchical hard derivation of parent to child keys
  • SoftDerivation: for hierarchical soft derivation of parent to child keys
  • paymentAddress: for constructing payment addresses from a address public key or a script
  • delegationAddress: for constructing delegation addresses from payment credential (public key or script) and stake credential (public key or script)
  • pointerAddress: for constructing delegation addresses from payment credential (public key or script) and chain pointer
  • stakeAddress: for constructing reward accounts from stake credential (public key or script)

Shelley

data Shelley (depth :: Depth) key #

A cryptographic key for sequential-scheme address derivation, with phantom-types to disambiguate key types.

let rootPrivateKey = Shelley 'RootK XPrv
let accountPubKey  = Shelley 'AccountK XPub
let addressPubKey  = Shelley 'PaymentK XPub

Since: 2.0.0

Instances

Instances details
HasNetworkDiscriminant Shelley # 
Instance details

Defined in Cardano.Address.Style.Shelley

Associated Types

type NetworkDiscriminant Shelley 
Instance details

Defined in Cardano.Address.Style.Shelley

GenMasterKey Shelley # 
Instance details

Defined in Cardano.Address.Style.Shelley

Associated Types

type SecondFactor Shelley 
Instance details

Defined in Cardano.Address.Style.Shelley

HardDerivation Shelley # 
Instance details

Defined in Cardano.Address.Style.Shelley

SoftDerivation Shelley # 
Instance details

Defined in Cardano.Address.Style.Shelley

Functor (Shelley depth) # 
Instance details

Defined in Cardano.Address.Style.Shelley

Methods

fmap :: (a -> b) -> Shelley depth a -> Shelley depth b #

(<$) :: a -> Shelley depth b -> Shelley depth a #

NFData key => NFData (Shelley depth key) # 
Instance details

Defined in Cardano.Address.Style.Shelley

Methods

rnf :: Shelley depth key -> () #

Generic (Shelley depth key) # 
Instance details

Defined in Cardano.Address.Style.Shelley

Associated Types

type Rep (Shelley depth key) 
Instance details

Defined in Cardano.Address.Style.Shelley

type Rep (Shelley depth key) = D1 ('MetaData "Shelley" "Cardano.Address.Style.Shelley" "cardano-addresses-4.0.2-inplace" 'True) (C1 ('MetaCons "Shelley" 'PrefixI 'True) (S1 ('MetaSel ('Just "getKey") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 key)))

Methods

from :: Shelley depth key -> Rep (Shelley depth key) x #

to :: Rep (Shelley depth key) x -> Shelley depth key #

Show key => Show (Shelley depth key) # 
Instance details

Defined in Cardano.Address.Style.Shelley

Methods

showsPrec :: Int -> Shelley depth key -> ShowS #

show :: Shelley depth key -> String #

showList :: [Shelley depth key] -> ShowS #

Eq key => Eq (Shelley depth key) # 
Instance details

Defined in Cardano.Address.Style.Shelley

Methods

(==) :: Shelley depth key -> Shelley depth key -> Bool #

(/=) :: Shelley depth key -> Shelley depth key -> Bool #

type NetworkDiscriminant Shelley # 
Instance details

Defined in Cardano.Address.Style.Shelley

type AccountIndexDerivationType Shelley # 
Instance details

Defined in Cardano.Address.Style.Shelley

type AddressIndexDerivationType Shelley # 
Instance details

Defined in Cardano.Address.Style.Shelley

type SecondFactor Shelley # 
Instance details

Defined in Cardano.Address.Style.Shelley

type WithRole Shelley # 
Instance details

Defined in Cardano.Address.Style.Shelley

type Rep (Shelley depth key) # 
Instance details

Defined in Cardano.Address.Style.Shelley

type Rep (Shelley depth key) = D1 ('MetaData "Shelley" "Cardano.Address.Style.Shelley" "cardano-addresses-4.0.2-inplace" 'True) (C1 ('MetaCons "Shelley" 'PrefixI 'True) (S1 ('MetaSel ('Just "getKey") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 key)))

data Role #

Describe what the keys within an account are used for.

Since: 3.0.0

Constructors

UTxOExternal

Used for public addresses sent to other parties for receiving money.

UTxOInternal

Generated by wallet software to send change back to the wallet.

Stake

Used for stake key(s) and delegation.

DRep

Used for DRep key derivation.

CCCold

Used for constitutional committee cold key derivation

CCHot

Used for constitutional committee hot key derivation

Instances

Instances details
NFData Role # 
Instance details

Defined in Cardano.Address.Style.Shelley

Methods

rnf :: Role -> () #

Bounded Role # 
Instance details

Defined in Cardano.Address.Style.Shelley

Generic Role # 
Instance details

Defined in Cardano.Address.Style.Shelley

Associated Types

type Rep Role 
Instance details

Defined in Cardano.Address.Style.Shelley

type Rep Role = D1 ('MetaData "Role" "Cardano.Address.Style.Shelley" "cardano-addresses-4.0.2-inplace" 'False) ((C1 ('MetaCons "UTxOExternal" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "UTxOInternal" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Stake" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "DRep" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "CCCold" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "CCHot" 'PrefixI 'False) (U1 :: Type -> Type))))

Methods

from :: Role -> Rep Role x #

to :: Rep Role x -> Role #

Show Role # 
Instance details

Defined in Cardano.Address.Style.Shelley

Methods

showsPrec :: Int -> Role -> ShowS #

show :: Role -> String #

showList :: [Role] -> ShowS #

Eq Role # 
Instance details

Defined in Cardano.Address.Style.Shelley

Methods

(==) :: Role -> Role -> Bool #

(/=) :: Role -> Role -> Bool #

Ord Role # 
Instance details

Defined in Cardano.Address.Style.Shelley

Methods

compare :: Role -> Role -> Ordering #

(<) :: Role -> Role -> Bool #

(<=) :: Role -> Role -> Bool #

(>) :: Role -> Role -> Bool #

(>=) :: Role -> Role -> Bool #

max :: Role -> Role -> Role #

min :: Role -> Role -> Role #

type Rep Role # 
Instance details

Defined in Cardano.Address.Style.Shelley

type Rep Role = D1 ('MetaData "Role" "Cardano.Address.Style.Shelley" "cardano-addresses-4.0.2-inplace" 'False) ((C1 ('MetaCons "UTxOExternal" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "UTxOInternal" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Stake" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "DRep" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "CCCold" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "CCHot" 'PrefixI 'False) (U1 :: Type -> Type))))

data family Credential (purpose :: Depth) #

Shelley offers several ways to identify ownership of entities on chain.

This data-family has two instances, depending on whether the key is used for payment or for delegation.

Since: 3.0.0

Key Derivation

Generating a root key from SomeMnemonic

>>> :set -XOverloadedStrings
>>> :set -XTypeApplications
>>> :set -XDataKinds
>>> import Cardano.Mnemonic ( mkSomeMnemonic )

>>> let (Right mw) = mkSomeMnemonic @'[15] ["network","empty","cause","mean","expire","private","finger","accident","session","problem","absurd","banner","stage","void","what"]
>>> let sndFactor = mempty -- Or alternatively, a second factor mnemonic transformed to bytes via someMnemonicToBytes
>>> let rootK = genMasterKeyFromMnemonic mw sndFactor :: Shelley 'RootK XPrv

Deriving child keys

Let's consider the following 3rd, 4th and 5th derivation paths 0'/0/14

>>> let Just accIx = indexFromWord32 0x80000000
>>> let acctK = deriveAccountPrivateKey rootK accIx

>>> let Just addIx = indexFromWord32 0x00000014
>>> let addrK = deriveAddressPrivateKey acctK UTxOExternal addIx

>>> let stakeK = deriveDelegationPrivateKey acctK

genMasterKeyFromXPrv :: XPrv -> Shelley 'RootK XPrv #

Generate a root key from a corresponding root XPrv

Since: 2.0.0

genMasterKeyFromMnemonic #

Arguments

:: SomeMnemonic

Some valid mnemonic sentence.

-> ScrubbedBytes

An optional second-factor passphrase (or mempty)

-> Shelley 'RootK XPrv 

Generate a root key from a corresponding mnemonic.

Since: 2.0.0

deriveAccountPrivateKey :: Shelley 'RootK XPrv -> Index 'Hardened 'AccountK -> Shelley 'AccountK XPrv #

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

Since: 2.0.0

deriveAddressPrivateKey :: Shelley 'AccountK XPrv -> Role -> Index 'Soft 'PaymentK -> Shelley 'PaymentK XPrv #

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

Since: 2.0.0

deriveDelegationPrivateKey :: Shelley 'AccountK XPrv -> Shelley 'DelegationK XPrv #

Derive a delegation key for a corresponding AccountK. Note that wallet software are by convention only using one delegation key per account, and always the first account (with index 0').

Deriving delegation keys for something else than the initial account is not recommended and can lead to incompatibility with existing wallet softwares (Daedalus, Yoroi, Adalite...).

Since: 2.0.0

deriveDRepPrivateKey :: Shelley 'AccountK XPrv -> Shelley 'DRepK XPrv #

Derive a DRep key for a corresponding AccountK. Note that wallet software are by convention only using one delegation key per account, and always the first account (with index 0').

Deriving DRep keys for something else than the initial account is not recommended and can lead to incompatibility with existing wallet softwares (Daedalus, Yoroi, Adalite...).

deriveCCColdPrivateKey :: Shelley 'AccountK XPrv -> Shelley 'CCColdK XPrv #

Derive a CCCold key for a corresponding AccountK. Note that wallet software are by convention only using one delegation key per account, and always the first account (with index 0').

Deriving CCCold keys for something else than the initial account is not recommended and can lead to incompatibility with existing wallet softwares (Daedalus, Yoroi, Adalite...).

deriveCCHotPrivateKey :: Shelley 'AccountK XPrv -> Shelley 'CCHotK XPrv #

Derive a CCHot key for a corresponding AccountK. Note that wallet software are by convention only using one delegation key per account, and always the first account (with index 0').

Deriving CCHot keys for something else than the initial account is not recommended and can lead to incompatibility with existing wallet softwares (Daedalus, Yoroi, Adalite...).

deriveAddressPublicKey :: Shelley 'AccountK XPub -> Role -> Index 'Soft 'PaymentK -> Shelley 'PaymentK XPub #

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

Since: 2.0.0

derivePolicyPrivateKey :: Shelley 'RootK XPrv -> Index 'Hardened 'PolicyK -> Shelley 'PolicyK XPrv #

Derives a policy private key from the given root private key.

Since: 3.9.0

Addresses

Generating a PaymentAddress from public key credential

>>> import Cardano.Address ( bech32 )
>>> import Cardano.Address.Derivation ( toXPub )
>>> let (Right tag) = mkNetworkDiscriminant 1
>>> let paymentCredential = PaymentFromExtendedKey $ (toXPub $ addrK)
>>> bech32 $ paymentAddress tag paymentCredential
>>> "addr1vxpfffuj3zkp5g7ct6h4va89caxx9ayq2gvkyfvww48sdncxsce5t"

Generating a PaymentAddress from script credential

>>> import Cardano.Address.Script.Parser ( scriptFromString )
>>> import Cardano.Address.Script ( toScriptHash )
>>> import Codec.Binary.Encoding ( encode )
>>> import Data.Text.Encoding ( decodeUtf8 )
>>> let (Right tag) = mkNetworkDiscriminant 1
>>> let verKey1 = "script_vkh18srsxr3khll7vl3w9mqfu55n6wzxxlxj7qzr2mhnyreluzt36ms"
>>> let verKey2 = "script_vkh18srsxr3khll7vl3w9mqfu55n6wzxxlxj7qzr2mhnyrenxv223vj"
>>> let scriptStr = "all [" ++ verKey1 ++ ", " ++ verKey2 ++ "]"
>>> let (Right script) = scriptFromString scriptStr
>>> let infoSpendingScriptHash@(ScriptHash bytes) = toScriptHash script
>>> decodeUtf8 (encode EBase16 bytes)
"a015ae61075e25c3d9250bdcbc35c6557272127927ecf2a2d716e29f"
>>> bech32 $ paymentAddress tag (PaymentFromScriptHash infoSpendingScriptHash)
"addr1wxspttnpqa0zts7ey59ae0p4ce2hyusj0yn7eu4z6utw98c9uxm83"

Generating a DelegationAddress

>>> let (Right tag) = mkNetworkDiscriminant 1
>>> let paymentCredential = PaymentFromExtendedKey $ (toXPub $ addrK)
>>> let delegationCredential = DelegationFromExtendedKey $ (toXPub $ stakeK)
>>> bech32 $ delegationAddress tag paymentCredential delegationCredential
"addr1qxpfffuj3zkp5g7ct6h4va89caxx9ayq2gvkyfvww48sdn7nudck0fzve4346yytz3wpwv9yhlxt7jwuc7ytwx2vfkyqmkc5xa"

Generating a PointerAddress

>>> import Cardano.Address ( ChainPointer (..) )
>>> let (Right tag) = mkNetworkDiscriminant 1
>>> let ptr = ChainPointer 123 1 2
>>> let paymentCredential = PaymentFromExtendedKey $ (toXPub $ addrK)
>>> bech32 $ pointerAddress tag paymentCredential ptr
"addr1gxpfffuj3zkp5g7ct6h4va89caxx9ayq2gvkyfvww48sdnmmqypqfcp5um"

Generating a DelegationAddress from using the same script credential in both payment and delegation

>>> bech32 $ delegationAddress tag (PaymentFromScriptHash infoSpendingScriptHash) (DelegationFromScript infoSpendingScriptHash)
"addr1xxspttnpqa0zts7ey59ae0p4ce2hyusj0yn7eu4z6utw98aqzkhxzp67yhpajfgtmj7rt3j4wfepy7f8ane294cku20swucnrl"

data InspectAddress #

The result of eitherInspectAddress.

Since: 3.4.0

Instances

Instances details
ToJSON InspectAddress # 
Instance details

Defined in Cardano.Address.Style.Shelley

Generic InspectAddress # 
Instance details

Defined in Cardano.Address.Style.Shelley

Associated Types

type Rep InspectAddress 
Instance details

Defined in Cardano.Address.Style.Shelley

type Rep InspectAddress = D1 ('MetaData "InspectAddress" "Cardano.Address.Style.Shelley" "cardano-addresses-4.0.2-inplace" 'False) (C1 ('MetaCons "InspectAddressShelley" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 AddressInfo)) :+: (C1 ('MetaCons "InspectAddressIcarus" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 AddressInfo)) :+: C1 ('MetaCons "InspectAddressByron" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 AddressInfo))))
Show InspectAddress # 
Instance details

Defined in Cardano.Address.Style.Shelley

Eq InspectAddress # 
Instance details

Defined in Cardano.Address.Style.Shelley

type Rep InspectAddress # 
Instance details

Defined in Cardano.Address.Style.Shelley

type Rep InspectAddress = D1 ('MetaData "InspectAddress" "Cardano.Address.Style.Shelley" "cardano-addresses-4.0.2-inplace" 'False) (C1 ('MetaCons "InspectAddressShelley" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 AddressInfo)) :+: (C1 ('MetaCons "InspectAddressIcarus" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 AddressInfo)) :+: C1 ('MetaCons "InspectAddressByron" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 AddressInfo))))

data AddressInfo #

An inspected Shelley address.

Since: 3.4.0

Instances

Instances details
ToJSON AddressInfo # 
Instance details

Defined in Cardano.Address.Style.Shelley

Generic AddressInfo # 
Instance details

Defined in Cardano.Address.Style.Shelley

Associated Types

type Rep AddressInfo 
Instance details

Defined in Cardano.Address.Style.Shelley

type Rep AddressInfo = D1 ('MetaData "AddressInfo" "Cardano.Address.Style.Shelley" "cardano-addresses-4.0.2-inplace" 'False) (C1 ('MetaCons "AddressInfo" 'PrefixI 'True) ((S1 ('MetaSel ('Just "infoStakeReference") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Maybe ReferenceInfo)) :*: (S1 ('MetaSel ('Just "infoSpendingKeyHash") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Maybe ByteString)) :*: S1 ('MetaSel ('Just "infoStakeKeyHash") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Maybe ByteString)))) :*: ((S1 ('MetaSel ('Just "infoSpendingScriptHash") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Maybe ByteString)) :*: S1 ('MetaSel ('Just "infoStakeScriptHash") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Maybe ByteString))) :*: (S1 ('MetaSel ('Just "infoNetworkTag") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 NetworkTag) :*: S1 ('MetaSel ('Just "infoAddressType") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word8)))))
Show AddressInfo # 
Instance details

Defined in Cardano.Address.Style.Shelley

Eq AddressInfo # 
Instance details

Defined in Cardano.Address.Style.Shelley

type Rep AddressInfo # 
Instance details

Defined in Cardano.Address.Style.Shelley

type Rep AddressInfo = D1 ('MetaData "AddressInfo" "Cardano.Address.Style.Shelley" "cardano-addresses-4.0.2-inplace" 'False) (C1 ('MetaCons "AddressInfo" 'PrefixI 'True) ((S1 ('MetaSel ('Just "infoStakeReference") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Maybe ReferenceInfo)) :*: (S1 ('MetaSel ('Just "infoSpendingKeyHash") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Maybe ByteString)) :*: S1 ('MetaSel ('Just "infoStakeKeyHash") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Maybe ByteString)))) :*: ((S1 ('MetaSel ('Just "infoSpendingScriptHash") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Maybe ByteString)) :*: S1 ('MetaSel ('Just "infoStakeScriptHash") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Maybe ByteString))) :*: (S1 ('MetaSel ('Just "infoNetworkTag") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 NetworkTag) :*: S1 ('MetaSel ('Just "infoAddressType") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word8)))))

data ReferenceInfo #

Info from Address about how delegation keys are located.

Since: 3.6.1

Instances

Instances details
Generic ReferenceInfo # 
Instance details

Defined in Cardano.Address.Style.Shelley

Associated Types

type Rep ReferenceInfo 
Instance details

Defined in Cardano.Address.Style.Shelley

type Rep ReferenceInfo = D1 ('MetaData "ReferenceInfo" "Cardano.Address.Style.Shelley" "cardano-addresses-4.0.2-inplace" 'False) (C1 ('MetaCons "ByValue" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ByPointer" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ChainPointer)))
Show ReferenceInfo # 
Instance details

Defined in Cardano.Address.Style.Shelley

Eq ReferenceInfo # 
Instance details

Defined in Cardano.Address.Style.Shelley

type Rep ReferenceInfo # 
Instance details

Defined in Cardano.Address.Style.Shelley

type Rep ReferenceInfo = D1 ('MetaData "ReferenceInfo" "Cardano.Address.Style.Shelley" "cardano-addresses-4.0.2-inplace" 'False) (C1 ('MetaCons "ByValue" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ByPointer" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ChainPointer)))

eitherInspectAddress :: Maybe XPub -> Address -> Either ErrInspectAddress InspectAddress #

Determines whether an Address is a valid address for the Cardano Shelley era. Shelley format addresses, as well as old-style Byron and Icarus addresses can be parsed by this function.

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

Since: 3.4.0

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

Analyze an Address to know whether it's a valid address for the Cardano Shelley era. Shelley format addresses, as well as old-style Byron and Icarus addresses can be parsed by this function.

Returns a JSON value containing details about the Address, or throws ErrInspectAddress if it's not a valid address.

Since: 3.0.0

inspectShelleyAddress :: MonadThrow m => Maybe XPub -> Address -> m Value #

Deprecated: use qualified inspectAddress instead.

Determines whether an Address a Shelley address.

Throws AddrError if it's not a valid Shelley address, or a ready-to-print string giving details about the Address.

Since: 2.0.0

paymentAddress :: NetworkDiscriminant Shelley -> Credential 'PaymentK -> Address #

Convert a payment credential (key or script) to a payment Address valid for the given network discrimination.

Since: 2.0.0

delegationAddress :: NetworkDiscriminant Shelley -> Credential 'PaymentK -> Credential 'DelegationK -> Address #

Convert a payment credential (key or script) and a delegation credential (key or script) to a delegation Address valid for the given network discrimination. Funds sent to this address will be delegated according to the delegation settings attached to the delegation key.

Since: 2.0.0

pointerAddress :: NetworkDiscriminant Shelley -> Credential 'PaymentK -> ChainPointer -> Address #

Convert a payment credential (key or script) and pointer to delegation certificate in blockchain to a pointer Address valid for the given network discrimination.

Since: 3.0.0

stakeAddress :: NetworkDiscriminant Shelley -> Credential 'DelegationK -> Either ErrInvalidStakeAddress Address #

Convert a delegation credential (key or script) to a stake Address (aka reward account address) for the given network discrimination.

Since: 3.0.0

extendAddress :: Address -> Credential 'DelegationK -> Either ErrExtendAddress Address #

Extend an existing payment Address to make it a delegation address.

Since: 2.0.0

data ErrExtendAddress #

Captures error occuring when trying to extend an invalid address.

Since: 2.0.0

Instances

Instances details
Show ErrExtendAddress # 
Instance details

Defined in Cardano.Address.Style.Shelley

data ErrInspectAddressOnlyShelley #

Possible errors from inspecting a Shelley address

Since: 3.4.0

Constructors

PtrRetrieveError String

Human readable error of underlying operation

UnknownType Word8

Unknown value in address type field

Instances

Instances details
ToJSON ErrInspectAddressOnlyShelley # 
Instance details

Defined in Cardano.Address.Style.Shelley

Exception ErrInspectAddressOnlyShelley # 
Instance details

Defined in Cardano.Address.Style.Shelley

Generic ErrInspectAddressOnlyShelley # 
Instance details

Defined in Cardano.Address.Style.Shelley

Associated Types

type Rep ErrInspectAddressOnlyShelley 
Instance details

Defined in Cardano.Address.Style.Shelley

type Rep ErrInspectAddressOnlyShelley = D1 ('MetaData "ErrInspectAddressOnlyShelley" "Cardano.Address.Style.Shelley" "cardano-addresses-4.0.2-inplace" 'False) (C1 ('MetaCons "PtrRetrieveError" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String)) :+: C1 ('MetaCons "UnknownType" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word8)))
Show ErrInspectAddressOnlyShelley # 
Instance details

Defined in Cardano.Address.Style.Shelley

Eq ErrInspectAddressOnlyShelley # 
Instance details

Defined in Cardano.Address.Style.Shelley

type Rep ErrInspectAddressOnlyShelley # 
Instance details

Defined in Cardano.Address.Style.Shelley

type Rep ErrInspectAddressOnlyShelley = D1 ('MetaData "ErrInspectAddressOnlyShelley" "Cardano.Address.Style.Shelley" "cardano-addresses-4.0.2-inplace" 'False) (C1 ('MetaCons "PtrRetrieveError" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String)) :+: C1 ('MetaCons "UnknownType" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word8)))

data ErrInspectAddress #

Possible errors from inspecting a Shelley, Icarus, or Byron address.

Since: 3.4.0

Instances

Instances details
ToJSON ErrInspectAddress # 
Instance details

Defined in Cardano.Address.Style.Shelley

Exception ErrInspectAddress # 
Instance details

Defined in Cardano.Address.Style.Shelley

Generic ErrInspectAddress # 
Instance details

Defined in Cardano.Address.Style.Shelley

Show ErrInspectAddress # 
Instance details

Defined in Cardano.Address.Style.Shelley

Eq ErrInspectAddress # 
Instance details

Defined in Cardano.Address.Style.Shelley

type Rep ErrInspectAddress # 
Instance details

Defined in Cardano.Address.Style.Shelley

Network Discrimination

mkNetworkDiscriminant :: Integer -> Either MkNetworkDiscriminantError (NetworkDiscriminant Shelley) #

Construct NetworkDiscriminant for Cardano Shelley from a number. If the number is invalid, ie., not between 0 and 15, then MkNetworkDiscriminantError is thrown.

Since: 2.0.0

inspectNetworkDiscriminant :: Address -> Maybe (NetworkDiscriminant Shelley) #

Retrieve the network discriminant of a given Address. If the Address is malformed or, not a shelley address, returns Nothing.

Since: 2.0.0

shelleyMainnet :: NetworkDiscriminant Shelley #

NetworkDicriminant for Cardano MainNet & Shelley

Since: 2.0.0

shelleyTestnet :: NetworkDiscriminant Shelley #

NetworkDicriminant for Cardano Testnet & Shelley

Since: 2.0.0

Unsafe

liftXPrv :: forall (depth :: Depth). XPrv -> Shelley depth XPrv #

Unsafe backdoor for constructing an Shelley key from a raw XPrv. this is unsafe because it lets the caller choose the actually derivation depth.

This can be useful however when serializing / deserializing such a type, or to speed up test code (and avoid having to do needless derivations from a master key down to an address key for instance).

Since: 2.0.0

liftXPub :: forall (depth :: Depth). XPub -> Shelley depth XPub #

Unsafe backdoor for constructing an Shelley key from a raw XPub. this is unsafe because it lets the caller choose the actually derivation depth.

This can be useful however when serializing / deserializing such a type, or to speed up test code (and avoid having to do needless derivations from a master key down to an address key for instance).

Since: 2.0.0

liftPub :: forall (depth :: Depth). Pub -> Shelley depth Pub #

Unsafe backdoor for constructing an Shelley key from a raw Pub. this is unsafe because it lets the caller choose the actually derivation depth.

This can be useful however when serializing / deserializing such a type, or to speed up test code (and avoid having to do needless derivations from a master key down to an address key for instance).

Since: 3.0.0