cardano/address

Types

A Cardano Address typically holding one or two credential references.

Note that legacy bootstrap addresses (a.k.a. ‘Byron addresses’) are completely excluded from Plutus contexts. Thus, from an on-chain perspective only exists addresses of type 00, 01, …, 07 as detailed in CIP-0019 :: Shelley Addresses.

Constructors

  • Address {
      payment_credential: PaymentCredential,
      stake_credential: Option<StakeCredential>,
    }

A general structure for representing an on-chain Credential.

Credentials are always one of two kinds: a direct public/private key pair, or a script (native or Plutus).

Constructors

  • VerificationKey(VerificationKeyHash)
  • Script(ScriptHash)

A ‘PaymentCredential’ represents the spending conditions associated with some output. Hence,

  • a VerificationKey captures an output locked by a public/private key pair;
  • and a Script captures an output locked by a native or Plutus script.

Alias

PaymentCredential = Credential

Represent a type of object that can be represented either inline (by hash) or via a reference (i.e. a pointer to an on-chain location).

This is mainly use for capturing pointers to a stake credential registration certificate in the case of so-called pointer addresses.

Constructors

  • Inline(a)
  • Pointer { slot_number: Int, transaction_index: Int, certificate_index: Int }

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.

Alias

StakeCredential = Referenced<Credential>

Functions

Constructing

from_script(script: Hash<Blake2b_224, Script>) -> Address

Smart-constructor for an Address from a script hash. The address has no delegation rights whatsoever.

from_verification_key(vk: Hash<Blake2b_224, VerificationKey>) -> Address

Smart-constructor for an Address from a verification key hash. The resulting address has no delegation rights whatsoever.

with_delegation_key(
  self: Address,
  vk: Hash<Blake2b_224, VerificationKey>,
) -> Address

Set (or reset) the delegation part of an Address using a verification key hash. This is useful when combined with from_verification_key and/or from_script.

with_delegation_script(
  self: Address,
  script: Hash<Blake2b_224, Script>,
) -> Address

Set (or reset) the delegation part of an Address using a script hash. This is useful when combined with from_verification_key and/or from_script.

Search Document