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

  • 8 types
  • 13 values

Script

3 declarations
datadata Script elem
#

A Script type represents multi signature script. The script embodies conditions that need to be satisfied to make it valid.

Instances8Eq, Show, Generic, NFData, FromJSON, ToJSON, …

This function realizes what cardano-node's `Api.serialiseToCBOR script` realizes This is basically doing the symbolically following: toCBOR [0,multisigScript]

Script template

3 declarations
datadata ScriptTemplate
#

Represents the script template that show the structure of the script and determines the expected place of verification keys corresponding to given cosigners.

Instances7Eq, Show, Generic, NFData, FromJSON, ToJSON, …
newtypenewtype Cosigner
#

Represents the cosigner of the script, ie., party that co-shares the script.

Constructors

Instances10Eq, Ord, Show, Generic, NFData, Hashable, …

Validation

9 declarations
datadata ValidationLevel
#

Validation level. Required level does basic check that will make sure the script is accepted in ledger. Recommended level collects a number of checks that will warn about dangerous, unwise and redundant things present in the script.

Instances5Eq, Show, Generic, NFData, Rep

Hashing

6 declarations
newtypenewtype ScriptHash
#

A ScriptHash type represents script hash. The hash is expected to have size of 28-byte.

Instances6Eq, Ord, Show, Generic, NFData, Rep

Encode a ScriptHash to bech32 Text or hex if key role is unknown. In the case of governance role, if one wants to include additional byte as specified in CIP-0129 unless the function is called with CIP0105.

One byte is prepended to script hash only in governance context. The rules how to contruct it are summarized below

  drep       0010....
  hot        0000....    key type
  cold       0001....

  scripthash ....0011    credential type

This is on top of X_script, where X={drep, cc_hot, cc_hot}, which lacks the additional byte. In scriptHashFromText we additionally support reading legacy X which also lacks the additional byte, and has the same payload as as the corresponding X_script.

valuescriptHashFromText :: Text -> Either ErrScriptHashFromText ScriptHash
#

Construct a ScriptHash from Text. It should be

Bech32 encoded text with one of following hrp:

  • script

  • drep

  • cc_cold

  • cc_hot

  • drep_script

  • cc_cold_script

  • cc_hot_script

If if hex is encountered it is converted in rawly fashion