-
Notifications
You must be signed in to change notification settings - Fork 156
/
Copy pathtransactions.tex
74 lines (70 loc) · 3.74 KB
/
transactions.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
\section{Transactions}
\label{sec:transactions}
\begin{figure*}[htb]
\emph{Derived Types}
%
\begin{equation*}
\begin{array}{l@{\qquad=\qquad}lr}
\TxOut & \Addr \times \Value \times (\hldiff{\Datum} \uniondistinct \DataHash)^? \times \hldiff{\Script^?}
\end{array}
\end{equation*}
%
\emph{Transaction Types}
%
\begin{equation*}
\begin{array}{r@{~~}l@{~~}l@{\qquad}l}
\TxBody ~=~
& \powerset{\TxIn} & \fun{spendInputs}& \text{Inputs}\\
& \times ~\powerset{\TxIn} & \fun{collInputs} & \text{Collateral inputs}\\
& \times ~\hldiff{\powerset{\TxIn}} & \hldiff{\fun{refInputs}} & \hldiff{\text{Reference inputs}}\\
& \times ~(\Ix \pto \TxOut) & \fun{txouts}& \text{Outputs}\\
& \times ~\hldiff{\TxOut^?} & \hldiff{\fun{collRet}} & \hldiff{\text{Collateral return output}}\\
& \times ~\hldiff{\Coin^?} & \hldiff{\fun{txcoll}} & \hldiff{\text{Total collateral}}\\
& \times~ \seqof{\DCert} & \fun{txcerts}& \text{Certificates}\\
& \times ~\Value & \fun{mint} &\text{A minted value}\\
& \times ~\Coin & \fun{txfee} &\text{Total fee}\\
& \times ~\ValidityInterval & \fun{txvldt} & \text{Validity interval}\\
& \times~ \Wdrl & \fun{txwdrls} &\text{Reward withdrawals}\\
& \times ~\Update^? & \fun{txUpdates} & \text{Update proposals}\\
& \times ~\powerset{\KeyHash} & \fun{reqSignerHashes} & \text{Hashes of VKeys passed to scripts}\\
& \times ~\ScriptIntegrityHash^? & \fun{scriptIntegrityHash} & \text{Hash of script-related data}\\
& \times ~\AuxiliaryDataHash^? & \fun{txADhash} & \text{Auxiliary data hash}\\
& \times ~\Network^? & \fun{txnetworkid} & \text{Tx network ID}\\
\end{array}
\end{equation*}
\caption{Definitions for transactions}
\label{fig:defs:utxo-shelley-2}
\end{figure*}
We add a field $\fun{refInputs}$ to the transaction that specifies
\emph{reference inputs}. A reference input is not spent and does not
require any witnessing to be included in a valid transaction. The only
requirement is that is has to be present in the ledger state
UTxO. There are no restrictions on which outputs can be used as a
reference input. Reference inputs only affect the information that is
passed to scripts by them being included in $\TxInfo$.
For consistency, we've renamed the regular and collateral inputs to
$\fun{spendInputs}$ and $\fun{collInputs}$ respectively.
We add two fields to the transaction dealing with
collateral. $\fun{collRet}$ specifies outputs that get created in case
a transaction script fails. $\fun{txcoll}$ asserts the total amount
of collateral that would get collected as fees. Specifying this field
does not change how collateral is computed, but transactions whose
collateral is different than the amount in $\fun{txcoll}$ will be
invalid. This lets users write transactions whose collateral is
evident by just looking at the transaction body instead of requiring
information contained in the UTXO, which hardware wallets for example
might not have access to.
We also add support for supplying a $\Datum$ and a $\Script$ directly in a $\TxOut$
instead of just its hash. The \emph{inline} $\Datum$ has two main purposes:
\begin{itemize}
\item In case of a sufficiently small $\Datum$, this is more efficient
\item Used together with reference inputs, this allows for many
transactions to use a $\Datum$ without repeating it every time, thus
reducing fees and block size
\end{itemize}
The \emph{inline} script is visible to Plutus scripts and the scripts
can be used together with reference inputs to not have to provide
scripts in the transaction itself.
This change requires the size calculation of outputs to be adjusted,
to properly scale with the new additions. For simplicity and
future-proofing, we now use the serialized size.