| Copyright | 2020 Input Output (Hong Kong) Ltd. 2021-2022 Input Output Global Inc. (IOG) 2023-2025 Intersect |
|---|---|
| License | Apache-2.0 |
| Safe Haskell | None |
| Language | Haskell2010 |
Cardano.Address.KeyHash
Contents
Description
Synopsis
- data KeyHash = KeyHash {
- role :: KeyRole
- digest :: ByteString
- data KeyRole
- data GovernanceType
- keyHashFromBytes :: (KeyRole, ByteString) -> Maybe KeyHash
- keyHashFromText :: Text -> Either ErrKeyHashFromText KeyHash
- keyHashToText :: KeyHash -> GovernanceType -> Text
- data ErrKeyHashFromText
- prettyErrKeyHashFromText :: ErrKeyHashFromText -> String
Types
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
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'
| KeyRole | purpose | role | CIP |
|---|---|---|---|
| PaymentShared | 1854H | 0,1 | CIP-1854 |
| DelegationShared | 1854H | 2 | CIP-1854 |
| Payment | 1852H | 0,1 | CIP-1852 |
| Delegation | 1852H | 2 | CIP-0011 |
| Representative | 1852H | 3 | CIP-0105 |
| CommitteeCold | 1852H | 4 | CIP-0105 |
| CommitteeHot | 1852H | 5 | CIP-0105 |
| Policy | 1855H | - | CIP-1855 |
Constructors
| PaymentShared | |
| DelegationShared | |
| Payment | |
| Delegation | |
| Policy | |
| Representative | |
| CommitteeCold | |
| CommitteeHot | |
| Unknown |
Instances
| Generic KeyRole Source # | |||||
Defined in Cardano.Address.KeyHash Associated Types
| |||||
| Show KeyRole Source # | |||||
| NFData KeyRole Source # | |||||
Defined in Cardano.Address.KeyHash | |||||
| Eq KeyRole Source # | |||||
| Ord KeyRole Source # | |||||
Defined in Cardano.Address.KeyHash | |||||
| type Rep KeyRole Source # | |||||
Defined in Cardano.Address.KeyHash type Rep KeyRole = D1 ('MetaData "KeyRole" "Cardano.Address.KeyHash" "cardano-addresses-4.0.1-12OTt85pRZ623XqhieiIYs" '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 |
Instances
| Show GovernanceType Source # | |
Defined in Cardano.Address.KeyHash Methods showsPrec :: Int -> GovernanceType -> ShowS # show :: GovernanceType -> String # showList :: [GovernanceType] -> ShowS # | |
| Eq GovernanceType Source # | |
Defined in Cardano.Address.KeyHash Methods (==) :: GovernanceType -> GovernanceType -> Bool # (/=) :: GovernanceType -> GovernanceType -> Bool # | |
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_vkhstake_shared_vkhaddr_vkhstake_vkhpolicy_vkhdrepcc_coldcc_hotdrep_vkhcc_cold_vkhcc_hot_vkhaddr_shared_vkstake_shared_vkaddr_vkstake_vkpolicy_vkcc_cold_vkcc_hot_vkaddr_shared_xvkstake_shared_xvkaddr_xvkstake_xvkpolicy_xvkdrep_xvkcc_cold_xvkcc_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 #
Errors
data ErrKeyHashFromText Source #
Possible errors when deserializing a key hash from text.
Since: 3.0.0
Instances
| Show ErrKeyHashFromText Source # | |
Defined in Cardano.Address.KeyHash Methods showsPrec :: Int -> ErrKeyHashFromText -> ShowS # show :: ErrKeyHashFromText -> String # showList :: [ErrKeyHashFromText] -> ShowS # | |
| Eq ErrKeyHashFromText Source # | |
Defined in Cardano.Address.KeyHash Methods (==) :: ErrKeyHashFromText -> ErrKeyHashFromText -> Bool # (/=) :: ErrKeyHashFromText -> ErrKeyHashFromText -> Bool # | |
prettyErrKeyHashFromText :: ErrKeyHashFromText -> String Source #
Possible errors when deserializing a key hash from text.
Since: 3.0.0