Skip to content

Commit

Permalink
Update and rename docs/13-smart-contracts/01-plutus/07-transaction-co…
Browse files Browse the repository at this point in the history
…sts-determinism.mdx to docs/03-learn/16-transaction-costs-determinism.mdx
  • Loading branch information
olgahryniuk authored Apr 16, 2024
1 parent 2fe46f8 commit 832efcf
Showing 1 changed file with 22 additions and 22 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
---
title: Transaction costs and determinism
metaTitle: Transaction costs and determinism
sidebar_position: 7
---

Cardano’s approach to price setting mainly relies on market demand over actual
supply. With the launch of smart contracts, there is more than one type of
demand competing for the common supply. Thus, it is crucial to consider both
supply. On Cardano, more than one type of
demand competes for the common supply. Thus, it is crucial to consider both
_relative_ and _absolute_ pricing. One way to do this is to inspect the effects
of smart contract pricing, non-fungible token (NFT) operations, and so on, with
respect to some common value – in our case, the consumption of Cardano’s
Expand All @@ -18,8 +17,8 @@ ensure that transaction processing is _deterministic_, meaning that a user can
predict the impact and outcome of a transaction before its actual execution.

The ability to guarantee the cost of transaction execution and how the
transaction behaves on the ledger _before_ it is submitted, becomes even more
prominent with the introduction of smart contract support. This feature is
transaction behaves on the ledger _before_ it is submitted became even more
prominent with the introduction of smart contract support in 2021. This feature is
different from other blockchains, including Ethereum, where other network
activity can influence the gas cost. This ability is also guaranteed by the
deterministic nature of Cardano and Plutus scripts.
Expand All @@ -33,7 +32,7 @@ encountering the following:

- unexpected script validation outcomes or failures
- unexpected fees
- unexpected ledger or script state updates
- unexpected ledger or script state updates.

## Validation

Expand All @@ -60,42 +59,42 @@ Script validation can be performed for the following actions:
certificate author’s credential.

Besides letting the node know which script to run, all transaction actions
indicate how to assemble arguments passed to that script. Alonzo introduces a
indicate how to assemble arguments passed to that script. Alonzo introduced a
new approach to transaction validation on Cardano due to the implementation of
Plutus scripts.

## Ledger updates
## Ledger features

Alonzo changed the data on the ledger as follows:
The Alonzo upgrade changed the data on the ledger as follows:

1. Plutus scripts can lock UTXOs.
2. A new component, added to the contents of the output parts of UTXOs, enables
2. A component, added to the contents of the output parts of UTXOs, enables
script state-like functionality. In addition to assets and an address, a UTXO
locked by Plutus scripts also contains a datum. A datum is a piece of data
that can be thought of as an interpretation of the script state.
3. There are a number of new protocol parameters used to impose additional
3. There are a number of protocol parameters used to impose additional
validation requirements on transactions. These include upper limits on
computational resources that scripts can consume.

To support Plutus scripts, transactions have been upgraded as follows:
To support Plutus scripts, transactions have the following features:

1. For each of its actions, the transaction now carries a user-specified
1. For each of its actions, the transaction carries a user-specified
argument, called a redeemer. Depending on the script, a redeemer can serve a
different purpose. For example, it can act as the bid the user places in an
auction, or the user’s guess in a guessing game, among many other functions.
2. The transaction specifies computational execution budgets for each script.
3. To ensure that a transaction can pay its execution fee, Alonzo introduces
3. To ensure that a transaction can pay its execution fee, Alonzo introduced
collateral.
4. Transactions contain an integrity hash, needed to ensure that it has not been
compromised, outdated, etc.

With the Vasil upgrade, Plutus scripts were upgraded to V2 functionality with an
improved cost model and new built-ins. The use of reference inputs, inline
datums, and reference scripts allows for efficient throughput and significantly
datums, and reference scripts allowed for efficient throughput and significantly
increased performance.
[See the complete Vasil feature overview here](https://docs.cardano.org/cardano-testnet/about/feature-overview).
[See the complete Vasil feature overview here](/evolution/upgrades/vasil).

The node performs new checks that ensure the transaction is constructed
The node performs the checks that ensure the transaction is constructed
correctly. For example, it must not exceed the maximum execution resource
budget. It also invokes the Plutus script interpreter to run the scripts.

Expand All @@ -112,23 +111,24 @@ The following key points make the outcomes of script and transaction validation
**predictable**:

- the script interpreter will always terminate and return the same validation
result when applied to the same arguments.
result when applied to the same arguments
- a transaction necessarily fixes all arguments that will be passed to the
script interpreter during validation.
script interpreter during validation
- a transaction specifies all the actions it is taking that require script
validation.
validation
- compulsory signatures on a transaction ensure that it cannot be altered by an
adversary in a way that causes scripts to fail.
adversary in a way that causes scripts to fail
- applying a transaction in the EUTXO ledger model is deterministic.

Script validation failure or success does affect how a transaction is processed.
However, the _True_ or _False_ outcome, as well as ledger changes associated
with either outcome, are predictable for a given transaction.

You can also use the
[Plutus fee estimator](https://docs.cardano.org/cardano-testnet/tools/plutus-fee-estimator)
[Plutus fee estimator](/cardano-testnets/tools/plutus-fee-estimator)
to predict script and transaction fees.


### Further reading:

- [About the collateral mechanism](https://docs.cardano.org/plutus/collateral-mechanism)
Expand Down

0 comments on commit 832efcf

Please sign in to comment.