HORIZON HASKELLDocslts/ghc-9.14.xd82dee82026-10-12Search names, modules, packages, or :: a typeCtrl K

GHC 9.14.1 · lts/ghc-9.14.x · d82dee8 · 2026-10-12

Modulecardano-addresses-4.0.2Haskell2010

Cardano.Address.KeyHash

  • 4 types
  • 4 values

Types

3 declarations
datadata KeyHash
#

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

Instances8Eq, Ord, Show, Generic, NFData, ToJSON, …
datadata KeyRole
#

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

Instances6Eq, Ord, Show, Generic, NFData, Rep
datadata GovernanceType
#

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).

Instances2Eq, Show

Conversions

3 declarations

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.

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.

Errors

2 declarations