Safe Haskell | None |
---|---|
Language | Haskell98 |
Shelley.Spec.Ledger.UTxO
Contents
Description
This module defines the types and functions for a simple UTxO Ledger as specified in A Simplified Formal Specification of a UTxO Ledger.
Synopsis
- newtype UTxO era = UTxO {}
- txid ∷ ∀ era. TxBodyConstraints era ⇒ TxBody era → TxId era
- txins ∷ HasField "inputs" (TxBody era) (Set (TxIn era)) ⇒ TxBody era → Set (TxIn era)
- txinLookup ∷ TxIn era → UTxO era → Maybe (TxOut era)
- txouts ∷ (ShelleyBased era, HasField "outputs" (TxBody era) (StrictSeq (TxOut era))) ⇒ TxBody era → UTxO era
- txup ∷ (ShelleyBased era, HasField "update" (TxBody era) (StrictMaybe (Update era))) ⇒ Tx era → Maybe (Update era)
- balance ∷ ShelleyBased era ⇒ UTxO era → Value era
- totalDeposits ∷ PParams era → Map (KeyHash 'StakePool (Crypto era)) (PoolParams era) → [DCert era] → Coin
- makeWitnessVKey ∷ ∀ era kr. (Era era, DSignable (Crypto era) (Hash (Crypto era) EraIndependentTxBody)) ⇒ Hash (Crypto era) EraIndependentTxBody → KeyPair kr (Crypto era) → WitVKey 'Witness era
- makeWitnessesVKey ∷ ∀ era kr. (Era era, DSignable (Crypto era) (Hash (Crypto era) EraIndependentTxBody)) ⇒ Hash (Crypto era) EraIndependentTxBody → [KeyPair kr (Crypto era)] → Set (WitVKey 'Witness era)
- makeWitnessesFromScriptKeys ∷ (Era era, DSignable (Crypto era) (Hash (Crypto era) EraIndependentTxBody)) ⇒ Hash (Crypto era) EraIndependentTxBody → Map (KeyHash kr (Crypto era)) (KeyPair kr (Crypto era)) → Set (KeyHash kr (Crypto era)) → Set (WitVKey 'Witness era)
- verifyWitVKey ∷ (Typeable kr, Era era, DSignable (Crypto era) (Hash (Crypto era) EraIndependentTxBody)) ⇒ Hash (Crypto era) EraIndependentTxBody → WitVKey kr era → Bool
- getScriptHash ∷ Addr era → Maybe (ScriptHash era)
- scriptsNeeded ∷ (ShelleyBased era, HasField "certs" (TxBody era) (StrictSeq (DCert era)), HasField "wdrls" (TxBody era) (Wdrl era), HasField "inputs" (TxBody era) (Set (TxIn era))) ⇒ UTxO era → Tx era → Set (ScriptHash era)
- scriptCred ∷ Credential kr era → Maybe (ScriptHash era)
- scriptStakeCred ∷ DCert era → Maybe (ScriptHash era)
- txinsScript ∷ ShelleyBased era ⇒ Set (TxIn era) → UTxO era → Set (TxIn era)
Primitives
The unspent transaction outputs.
Instances
Functions
txid ∷ ∀ era. TxBodyConstraints era ⇒ TxBody era → TxId era Source #
Compute the id of a transaction.
txins ∷ HasField "inputs" (TxBody era) (Set (TxIn era)) ⇒ TxBody era → Set (TxIn era) Source #
Compute the UTxO inputs of a transaction.
txinLookup ∷ TxIn era → UTxO era → Maybe (TxOut era) Source #
Lookup a txin for a given UTxO collection
txouts ∷ (ShelleyBased era, HasField "outputs" (TxBody era) (StrictSeq (TxOut era))) ⇒ TxBody era → UTxO era Source #
Compute the transaction outputs of a transaction.
txup ∷ (ShelleyBased era, HasField "update" (TxBody era) (StrictMaybe (Update era))) ⇒ Tx era → Maybe (Update era) Source #
balance ∷ ShelleyBased era ⇒ UTxO era → Value era Source #
Determine the total balance contained in the UTxO.
totalDeposits ∷ PParams era → Map (KeyHash 'StakePool (Crypto era)) (PoolParams era) → [DCert era] → Coin Source #
Determine the total deposit amount needed. The block may (legitimately) contain multiple registration certificates for the same pool, where the first will be treated as a registration and any subsequent ones as re-registration. As such, we must only take a deposit for the first such registration.
Note that this is not an issue for key registrations since subsequent registration certificates would be invalid.
makeWitnessVKey ∷ ∀ era kr. (Era era, DSignable (Crypto era) (Hash (Crypto era) EraIndependentTxBody)) ⇒ Hash (Crypto era) EraIndependentTxBody → KeyPair kr (Crypto era) → WitVKey 'Witness era Source #
Create a witness for transaction
makeWitnessesVKey ∷ ∀ era kr. (Era era, DSignable (Crypto era) (Hash (Crypto era) EraIndependentTxBody)) ⇒ Hash (Crypto era) EraIndependentTxBody → [KeyPair kr (Crypto era)] → Set (WitVKey 'Witness era) Source #
Create witnesses for transaction
makeWitnessesFromScriptKeys ∷ (Era era, DSignable (Crypto era) (Hash (Crypto era) EraIndependentTxBody)) ⇒ Hash (Crypto era) EraIndependentTxBody → Map (KeyHash kr (Crypto era)) (KeyPair kr (Crypto era)) → Set (KeyHash kr (Crypto era)) → Set (WitVKey 'Witness era) Source #
From a list of key pairs and a set of key hashes required for a multi-sig scripts, return the set of required keys.
verifyWitVKey ∷ (Typeable kr, Era era, DSignable (Crypto era) (Hash (Crypto era) EraIndependentTxBody)) ⇒ Hash (Crypto era) EraIndependentTxBody → WitVKey kr era → Bool Source #
Verify a transaction body witness
getScriptHash ∷ Addr era → Maybe (ScriptHash era) Source #
Extract script hash from value address with script.
scriptsNeeded ∷ (ShelleyBased era, HasField "certs" (TxBody era) (StrictSeq (DCert era)), HasField "wdrls" (TxBody era) (Wdrl era), HasField "inputs" (TxBody era) (Set (TxIn era))) ⇒ UTxO era → Tx era → Set (ScriptHash era) Source #
Computes the set of script hashes required to unlock the transcation inputs and the withdrawals.
scriptCred ∷ Credential kr era → Maybe (ScriptHash era) Source #
scriptStakeCred ∷ DCert era → Maybe (ScriptHash era) Source #
txinsScript ∷ ShelleyBased era ⇒ Set (TxIn era) → UTxO era → Set (TxIn era) Source #
Compute the subset of inputs of the set txInps
for which each input is
locked by a script in the UTxO u
.