Types and functions related to on-chain transactions.
Helper for empty [Transaction] initialization.
A Cardano transaction body.
Helper for empty transaction body initialization.
Phantom type for script data hashes. This is a 32-bytes Blake2b-256 hash.
A Cardano transaction witness set.
Helper for empty witness set initialization.
Payload to update the protocol parameters at a specific epoch
A context given to a script by the Cardano ledger when being executed.
The context contains information about the entire transaction that contains the script. The transaction may also contain other scripts. To distinguish between multiple scripts, the ScriptContext contains a "purpose" identifying the current resource triggering this execution.
Characterizes the kind of script being executed and the associated resource.
An on-chain certificate attesting of some operation. Publishing certificates triggers different kind of rules. Most of the time, they require signatures from specific keys.
Phantom type for Genesis hash. This is a 28-bytes Blake2b-224 hash.
Phantom type for Genesis delegate hash. This is a 28-bytes Blake2b-224 hash.
The source of rewards.
Reward target for a certificate's [MoveInstantaneousReward].
If StakeCredentials
, funds are moved to stake credentials,
otherwise the funds are given to the other accounting pot.
Payload for [MoveInstantaneousRewardsCert].
VKey witness
Compute the 28-bytes Blake2b hash of a public key.
Bootstrap witness
Phantom type for ED25519 public keys, of length 32 bytes.
Phantom type for ED25519 signatures, of length 64 bytes.
Phantom type for [BootstrapWitness] chain code. It has a length of 32 bytes.
Phantom type for [BootstrapWitness] attributes. Bytes of this type can be of any length.
Parameters required to compute transaction fees.
Parameters for the costs of referencing scripts.
Full explanation of the formula here: https://github.com/IntersectMBO/cardano-ledger/blob/master/docs/adr/2024-08-14_009-refscripts-fee-change.md
Default values for fee parameters.
Re-compute fees for a transaction (does not read body.fee
).
Helper function to compute the fees associated with reference script size.
Full explanation of the formula here: https://github.com/IntersectMBO/cardano-ledger/blob/master/docs/adr/2024-08-14_009-refscripts-fee-change.md
tierRefScriptFee = go 0 minFeeRefScriptCostPerByte
where
go acc curTierPrice n
| n < sizeIncrement =
floor (acc + (n % 1) * curTierPrice)
| otherwise =
let acc' = acc + curTierPrice * (sizeIncrement % 1)
in go acc' (multiplier * curTierPrice) (n - sizeIncrement)
sizeIncrement = 25600
multiplier = 1.2
minFeeRefScriptCostPerByte = 15
Compute the part of the fees of a Transaction related to the execution of scripts in the Plutus VM.
Compute the part of the fees of a Transaction directly related to the Tx size in bytes.
The "baseFee" and "feePerByte" are network parameters.
Estimate the potential saving in transaction fees by passing a script by reference instead of putting inline in the Tx witnesses.
Extract all inputs that are used in the transaction, from inputs, collateral and reference inputs.
Serialize the body and compute the Tx ID.
Helper function to locate the index of a script within a list of Outputs.
Clear all signatures from the witness set of the Tx.
Compute the script data hash of the transaction.
The caller must know what versions of Plutus scripts are present in the Tx and provide accordingly the associated cost models.
Script data is serialized in a very specific way to compute the hash. See Conway CDDL format: https://github.com/IntersectMBO/cardano-ledger/blob/676ffc5c3e0dddb2b1ddeb76627541b195fefb5a/eras/conway/impl/cddl-files/conway.cddl#L197
Deserialize a transaction's cbor bytes into a [Transaction]
Encode a Tx to CBOR
Decode a [WitnessSet] from CBOR.
Decode from CBOR one VKey witness signature.
Encode to CBOR one VKey signatures.
A Cardano transaction.