You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is used for on-chain data interchange, such as arguments to Plutus validators.
7
+
The following is the Haskell definition of `Data`:
8
+
9
+
```haskell
10
+
dataData=
11
+
ConstrInteger [Data]
12
+
| Map [(Data, Data)]
13
+
| List [Data]
14
+
| IInteger
15
+
| BByteString
16
+
```
17
+
18
+
Because blockchains store and transmit datain binary format, a `Data` object must be serialized into bytes whenever it is included in a transaction, or stored in a UTxO.
19
+
The serialization method must be deterministic, compact and stable.
20
+
21
+
Cardano uses CBOR extensively as a serialization format, so CBOR is also used for `Data` objects.
22
+
AllCardano node implementations must agree on how `Data` objects are serialized.
23
+
The serialization method used by the Haskell node is described in the PlutusCore spec, AppendixB.
24
+
25
+
## Serializing Plutus Scripts Using the Flat Format
26
+
27
+
Plutus scripts must also be serialized into a binary format so that they can be stored, transmitted and hashed.
28
+
29
+
Plutus scripts are serialized using the `flat` format.
30
+
`flat` is much more compact and faster than CBOR for serializing programs due to avoiding unnecessary metadata, resulting in a smaller script size and faster serialization - important for on-chain storage and transaction fees.
31
+
32
+
The`flat`-serialized script is then serialized into CBOR, based on which script hashes are calculated.
33
+
34
+
AllCardano node implementations must agree on how Plutus scripts are serialized.
35
+
The serialization method used by the Haskell node is described in the PlutusCore script, AppendixC.
0 commit comments