Symbolic Ledger¶
Overview¶
In this section, we define data types and validation logic of the Symbolic Ledger.
Data Types¶
Basic types¶
Fis a field element.Boolis a boolean type.POSIXTimeis a datetime in POSIX format.Hash tis a wrapper aroundF. It is the hash of a value of typet.Root tis a wrapper aroundF. It is the root of a Merkle tree with leaves of typet.Circuitis a set of commitments to the constraints of the circuit.
Symbolic Ledger types¶
-
Addressis of typeHash Circuit. The circuit describes the smart contract that locks funds at this address. -
TransactionEnvelopeis a record type with the following fields:txeAddressis of typeAddress. It is the address that initiated the transaction.txeTransactionIdis of typeF.txeValidityIntervalis of type(POSIXTime, POSIXTime). It is the transaction's validity interval. The bounds are inclusive.
-
BridgedInUTxOis a type describing a UTxO bridged in from Cardano. -
BridgedOutUTxOis a type describing a UTxO bridged out to Cardano. -
TransactionBatchis a record type with the following fields:tbTransactionsis of type[TransactionEnvelope]. It is a list of transaction envelopes included in the batch.tbBridgedInUTxOsis of type[BridgedInUTxO].tbBridgedOutUTxOsis of type[BridgedOutUTxO].tbValidityIntervalis of type(POSIXTime, POSIXTime). It is the batch's validity interval. The bounds are inclusive.tbReferenceis of typeHash TransactionBatch. It is the hash of the previous batch.
-
TransactionBatchCompresseddefines the compact representation of the Symbolic Ledger state transition.
Validation rules¶
We now describe the Symbolic Ledger state transition rules. The validation logic is as follows:
- Starting from an empty batch, we apply transaction envelopes one by one, modifying the current batch object. An empty batch is a batch with an empty
tbTransactionsfield and with other fields initialized from the data coming from the underlying blockchain. - We set the batch validity value to
Hash []. - Every transaction application results in a modification of
tbTransactionsfield. Bridged-in UTxOs and outputs produced in the batch transactions cannot be used immediately in the other transactions of the batch. - For every transaction envelope, we do the following checks:
- The validity interval of the transaction envelope must be within the batch validity interval.
- We prove that the transaction validation function (see Symbolic Transactions) applied to the current batch validity value, the current batch object, and the transaction envelope returns a particular value. If its first output is
0, we consider the transaction envelope to be valid. Otherwise, we consider it to be invalid. We update currenty batch validity value with second output of this function.
- After the batch is constructed, we check that the current batch validity value is
Hash [](no value is created or burned). -
The finalized batch is compressed into
TransactionBatchCompressedobject.Note
The
TransactionBatchCompressedobject is what is posted on the blockchain. In the on-chain smart contract, we verify a zero-knowledge proof that it was constructed as described above.