cardano-addresses-4.0.0: Utils for constructing a command-line on top of cardano-addresses.
Copyright2020 Input Output (Hong Kong) Ltd. 2021-2022 Input Output Global Inc. (IOG) 2023-2025 Intersect
LicenseApache-2.0
Safe HaskellSafe-Inferred
LanguageHaskell2010

Cardano.Address.KeyHash

Description

 
Synopsis

Types

data KeyHash Source #

A KeyHash type represents verification key hash that participate in building multi-signature script. The hash is expected to have size of 28-byte.

Since: 3.0.0

Constructors

KeyHash 

Fields

Instances

Instances details
Generic KeyHash Source # 
Instance details

Defined in Cardano.Address.KeyHash

Associated Types

type Rep KeyHash :: Type -> Type #

Methods

from :: KeyHash -> Rep KeyHash x #

to :: Rep KeyHash x -> KeyHash #

Show KeyHash Source # 
Instance details

Defined in Cardano.Address.KeyHash

NFData KeyHash Source # 
Instance details

Defined in Cardano.Address.KeyHash

Methods

rnf :: KeyHash -> () #

Eq KeyHash Source # 
Instance details

Defined in Cardano.Address.KeyHash

Methods

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

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

Ord KeyHash Source # 
Instance details

Defined in Cardano.Address.KeyHash

ToJSON KeyHash Source # 
Instance details

Defined in Cardano.Address.KeyHash

FromJSON (Script KeyHash) Source # 
Instance details

Defined in Cardano.Address.Script

type Rep KeyHash Source # 
Instance details

Defined in Cardano.Address.KeyHash

type Rep KeyHash = D1 ('MetaData "KeyHash" "Cardano.Address.KeyHash" "cardano-addresses-4.0.0-inplace" 'False) (C1 ('MetaCons "KeyHash" 'PrefixI 'True) (S1 ('MetaSel ('Just "role") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 KeyRole) :*: S1 ('MetaSel ('Just "digest") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString)))

data KeyRole Source #

Determines the role a given key plays.

The role basically can be mapped into derivation path which was used to derive it from the parent. Also it has a dedicated user facing HRP when presented in bech32 format - see keyHashToText for more details.

Take notice that purpose/role (except Policy) are as defined below in derivation path:

m  purpose'  coin_type'  account_ix'  role / index

Policy has a dedicated derivation path as follows:

m  purpose'  coin_type' / policy_ix'
KeyRolepurposeroleCIP
PaymentShared1854H0,1CIP-1854
DelegationShared1854H2CIP-1854
Payment1852H0,1CIP-1852
Delegation1852H2CIP-0011
Representative1852H3CIP-0105
CommitteeCold1852H4CIP-0105
CommitteeHot1852H5CIP-0105
Policy1855H-CIP-1855

Instances

Instances details
Generic KeyRole Source # 
Instance details

Defined in Cardano.Address.KeyHash

Associated Types

type Rep KeyRole :: Type -> Type #

Methods

from :: KeyRole -> Rep KeyRole x #

to :: Rep KeyRole x -> KeyRole #

Show KeyRole Source # 
Instance details

Defined in Cardano.Address.KeyHash

NFData KeyRole Source # 
Instance details

Defined in Cardano.Address.KeyHash

Methods

rnf :: KeyRole -> () #

Eq KeyRole Source # 
Instance details

Defined in Cardano.Address.KeyHash

Methods

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

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

Ord KeyRole Source # 
Instance details

Defined in Cardano.Address.KeyHash

type Rep KeyRole Source # 
Instance details

Defined in Cardano.Address.KeyHash

type Rep KeyRole = D1 ('MetaData "KeyRole" "Cardano.Address.KeyHash" "cardano-addresses-4.0.0-inplace" 'False) (((C1 ('MetaCons "PaymentShared" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "DelegationShared" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "Payment" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Delegation" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "Policy" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Representative" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "CommitteeCold" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "CommitteeHot" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Unknown" 'PrefixI 'False) (U1 :: Type -> Type)))))

data GovernanceType Source #

Determines if one asks for deprecated HRP prefixes, *_vkh and *_script in accordance to CIP-0105 (on demand when flag 'cip-0105' is used) or uses default format specified in CIP-0129 (where additional byte is prepended to 28-byte hash).

Constructors

NoGovernance 
CIP0129 
CIP0105 

Conversions

keyHashFromBytes :: (KeyRole, ByteString) -> Maybe KeyHash Source #

Construct an KeyHash from raw ByteString (28 bytes).

Since: 3.0.0

keyHashFromText :: Text -> Either ErrKeyHashFromText KeyHash Source #

Construct a KeyHash from Text. It should be Bech32 encoded text with one of following hrp:

  • addr_shared_vkh
  • stake_shared_vkh
  • addr_vkh
  • stake_vkh
  • policy_vkh
  • drep
  • cc_cold
  • cc_hot
  • drep_vkh
  • cc_cold_vkh
  • cc_hot_vkh
  • addr_shared_vk
  • stake_shared_vk
  • addr_vk
  • stake_vk
  • policy_vk
  • cc_cold_vk
  • cc_hot_vk
  • addr_shared_xvk
  • stake_shared_xvk
  • addr_xvk
  • stake_xvk
  • policy_xvk
  • drep_xvk
  • cc_cold_xvk
  • cc_hot_xvk

Raw keys will be hashed on the fly, whereas hash that are directly provided will remain as such. If if hex is encountered Unknown policy key is assumed.

Since: 3.1.0

keyHashToText :: KeyHash -> GovernanceType -> Text Source #

Encode a KeyHash to bech32 Text or hex is key role unknown. If one wants to include, valid in governance roles only, additional byte as specified in CIP-0129, the function needs to be called with withByte=true.

Since: 3.0.0

Errors

data ErrKeyHashFromText Source #

Possible errors when deserializing a key hash from text.

Since: 3.0.0

prettyErrKeyHashFromText :: ErrKeyHashFromText -> String Source #

Possible errors when deserializing a key hash from text.

Since: 3.0.0