-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtransactions.tex
150 lines (132 loc) · 5.81 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
\begin{figure*}[t!]
%
\emph{Abstract types}
%
\begin{equation*}
\begin{array}{r@{~\in~}l@{\qquad=\qquad}lr}
\var{s_{v1}} & \ScriptNI & \ScriptMSig \\
\var{s_{v2}} & \Timelock & \text{extended script language}
\end{array}
\end{equation*}
%
\emph{Derived types}
%
\begin{equation*}
\begin{array}{r@{~\in~}l@{\qquad=\qquad}lr}
\var{txout} & \TxOut & \Addr \times \hldiff{\Value} \\
% & \text{tx outputs}
\var{s} & \Script & \hldiff{\ScriptNI \uniondistinct \Timelock}
% & \text{scripts}
\\
\end{array}
\end{equation*}
%
\emph{Transaction Type}
%
\begin{equation*}
\begin{array}{r@{~~}l@{~~}l@{\qquad}l}
\var{txbody} ~\in~ \TxBody ~=~
& \powerset{\TxIn} & \fun{txinputs}& \text{inputs}\\
&\times ~(\Ix \mapsto \TxOut) & \fun{txouts}& \text{outputs}\\
& \times~ \seqof{\DCert} & \fun{txcerts}& \text{certificates}\\
& \times ~\hldiff{\Value} & \hldiff{\fun{mint}} &\text{value minted}\\
& \times ~\Coin & \fun{txfee} &\text{non-script fee}\\
& \times ~\hldiff{\Slot^? \times \Slot^?} & \hldiff{\fun{txvldt}} & \text{validity interval}\\
& \times~ \Wdrl & \fun{txwdrls} &\text{reward withdrawals}\\
& \times ~\Update^? & \fun{txUpdates} & \text{update proposals}\\
& \times ~\AuxiliaryDataHash^? & \fun{txADhash} & \text{auxiliary data hash}
\end{array}
\end{equation*}
%
\begin{equation*}
\begin{array}{r@{~~}l@{~~}l@{\qquad}l}
\var{ad} ~\in~ \AuxiliaryData ~=~
& \powerset{\Script} & \fun{scripts}& \text{Optional scripts}\\
& \times ~\Metadata^? & \fun{md} & \text{metadata}
\end{array}
\end{equation*}
%
\begin{equation*}
\begin{array}{r@{~~}l@{~~}l@{\qquad}l}
\var{tx} ~\in~ \Tx ~=~
& \TxBody & \fun{txinputs}& \text{Transaction body}\\
&\times ~\TxWitness & \fun{txouts}& \text{Witnesses}\\
& \times ~\AuxiliaryData^? & \fun{txADhash} & \text{Auxiliary data}
\end{array}
\end{equation*}
%
\emph{Accessor Functions}
\begin{equation*}
\begin{array}{r@{~\in~}lr}
\fun{getValue} & \TxOut \to \Value & \text{output value} \\
\fun{getAddr} & \TxOut \to \Addr & \text{output address}
\end{array}
\end{equation*}
\caption{Type Definitions used in the UTxO transition system}
\label{fig:defs:utxo-sophie}
\end{figure*}
\section{Transactions}
\label{sec:transactions}
This section describes the changes that are necessary to the
transaction structure to support native multi-asset (MA) functionality in
Bcc.
\subsection*{New Output Type}
A key change needed to introduce MA functionality is changing the type of
the transaction and UTxO outputs to contain multi-asset values to accommodate
transacting with these types of assets natively, using the same ledger accounting
infrastructure as is used for Bcc. That is,
$\TxOut$ now contains a $\Value$ rather than a $\Coin$.
\subsection*{New Script Type}
The multi-signature scripting language has been renamed to $\ScriptNI$ and
the type $\Script$ has been extended to include a new scripting language,
$\Timelock$. The two types of scripts which make up the $\Script$ type are both
native, meaning
that they are evaluated by the ledger directly. We specify the evaluation
function for the additional script type in section~\ref{sec:timelock-lang}.
Both types of scripts can be used for the same purposes, which means, for this
spec, as
\begin{itemize}
\item output-locking scripts,
\item certificate validation,
\item reward withdrawals, or
\item as minting scripts (see below).
\end{itemize}
\subsection*{The Mint Field}
The body of a transaction with multi-asset support contains one additional
field, the $\fun{mint}$ field.
The $\fun{mint}$ field is a term of type $\Value$, which contains
tokens the transaction is putting into or taking out of
circulation. Here, by "circulation", we mean specifically "the UTxO on the
ledger". Since the administrative fields cannot contain tokens other than Bcc,
and Bcc cannot be minted (this is enforced by the UTxO rule, see Figure~\ref{fig:rules:utxo-sophie}),
they are not affected in any way by minting.
Putting tokens into circulation is done with positive values in the $\Quantity$
fields $\fun{mint}$ field, and taking tokens out of circulation can be done
with negative quantities.
A transaction cannot simply mint arbitrary tokens. Restrictions on
Multi-Asset tokens are imposed, for each asset with ID $\var{pid}$, by a script
with the hash $\var{pid}$. Whether a given transaction adheres to the restrictions
prescribed by its script is verified as part of the processing of the transaction.
The minting mechanism is detailed in Section~\ref{sec:utxo}.
\subsection*{Transaction Body}
The following changes were made to $\TxBody$:
\begin{itemize}
\item a change in the type of $\TxOut$ --- instead of
$\Coin$, the transaction outputs now have type $\Value$.
\item the addition of the $\fun{mint}$ field to the transaction body
\item the time-to-live slot number (which had the accessor $\fun{txttl}$),
has been replaced with a validity interval with accessor $\fun{txvldt}$,
both endpoints of which are optional
\end{itemize}
The only change to the types related to transaction witnessing is the addition
of minting policy scripts to the underlying $\Script$ type, so we do not include the
whole $\Tx$ type here.
\subsection*{Auxiliary Data}
The auxiliary data section of the transaction consists of two parts:
$\fun{md}$ which is the same metadata type used in
Sophie, and $\fun{scripts}$, which is used to allow transactions to
contain optional scripts that are not used for witnessing. The
intended purpose of this field is to give users the ability to
transmit a script that belongs to a script address via this
auxiliary data. There are no restrictions on this field however, and users
can use it to put arbitrary scripts into the auxiliary data.