Handling Cardano addresses.
An address type only use for things related to staking, such as delegation and reward withdrawals.
The network ID of a transaction.
Phantom type for Byron addresses.
A general structure for representing an on-chain credential.
[Credential] can represent both payment credentials or stake credentials.
Credentials are always one of two kinds: a direct public/private key pair, or a script (native or Plutus).
A StakeCredential represents the delegation and rewards withdrawal conditions associated with some stake address / account.
A StakeCredential is either provided inline, or, by reference using an on-chain pointer. Read more about pointers in CIP-0019 :: Pointers.
A stake credential pointer.
This should not be used and is only present for compatibility with previous eras.
Phantom type for 28-bytes credential hashes, corresponding either to VKey hashes or script hashes.
This is a Blake2b-224 hash.
Build an [Address] from any valid string representation, such as Hex or Bech32.
Build an [Address] from its Bech32 string representation (CIP 5).
Create a simple enterprise address, with only a payment credential and no stake credential.
Create a simple script address, with only a payment credential and no stake credential.
Create a base address with a payement credential and a stake credential.
Create a pointer address.
Check if an [Address] is of the Shelley type, with a wallet payment key, not a script.
Extract the network ID from an address. Return [Nothing] for a Byron address.
Extract the credential hash (either key hash or script hash).
Extract the credential key hash (Nothing if it’s a script).
Extract the pubkey hash of a Shelley wallet address.
Extract the stake credential part of a Shelley address.
Extract the stake key hash of a Shelley address.
Change the stake credential part of a Shelley address. Ignored if the address is anything else (Byron/Reward).
Convenient alias for a Dict
with [Address] keys.
When converting to a List
, its keys are sorted by address.
WARNING: do not compare them with ==
since they contain functions.
Initialize an empty address dictionary.
For other operations, use the AnyDict
module directly.
WARNING: do not compare them with ==
since they contain functions.
Create an address dictionary from a list.
For other operations, use the AnyDict
module directly.
WARNING: do not compare them with ==
since they contain functions.
Convenient alias for a Dict
with [StakeAddress] keys.
When converting to a List
, its keys are sorted by stake address.
WARNING: do not compare them with ==
since they contain functions.
Initialize an empty stake address dictionary.
For other operations, use the AnyDict
module directly.
The keys order are derived from Haskell auto-derived credential order. Meaning Script first, then VKey.
WARNING: do not compare them with ==
since they contain functions.
Create a stake address dictionary from a list.
For other operations, use the AnyDict
module directly.
The keys order are derived from Haskell auto-derived credential order. Meaning Script first, then VKey.
WARNING: do not compare them with ==
since they contain functions.
Convert to [NetworkId] from its integer representation.
Convert an [Address] to its underlying [Bytes] representation.
Byron addresses are left untouched as we don't plan to have full support of Byron era.
Shelley address description from CIP-0019:
Header type (tttt....) Payment Part Delegation Part
(0) 0000.... PaymentKeyHash StakeKeyHash
(1) 0001.... ScriptHash StakeKeyHash
(2) 0010.... PaymentKeyHash ScriptHash
(3) 0011.... ScriptHash ScriptHash
(4) 0100.... PaymentKeyHash Pointer
(5) 0101.... ScriptHash Pointer
(6) 0110.... PaymentKeyHash ø
(7) 0111.... ScriptHash ø
Header type (....tttt)
(0) ....0000 testnet
(1) ....0001 mainnet
For example, 61....(56 chars / 28 bytes)....
is an enterprise address (6, only a payment key) on mainnet (1).
Stake address description from CIP-0019:
Header type (tttt....) Stake Reference
(14) 1110.... StakeKeyHash
(15) 1111.... ScriptHash
Convert a stake address to its bytes representation.
CBOR encoder for a stake address.
CBOR encoder for a [Credential], be it for payment or for stake.
CBOR encoder for [NetworkId].
CBOR decoder for [StakeAddress]. This only succeeds for a valid [Address] of the [Reward] variant.
Decode [Credential] which is either from a key or a script.
Full address, including the network ID.