Skip to content

Commit 1f24a51

Browse files
authored
CIP-0029 | Adjust preamble and structure w.r.t CIP-0001 (#678)
* first draft remediation of CIP-0029 * fixing PR URL syntax error * Test Vectors somehow ended up in the Rationale * not only cardano-api but also cardano-cli standalones appear move to IntersectMBO
1 parent f97167f commit 1f24a51

File tree

1 file changed

+41
-33
lines changed

1 file changed

+41
-33
lines changed

CIP-0029/README.md

Lines changed: 41 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,50 @@
11
---
22
CIP: 29
33
Title: Phase-1 Monetary Scripts Serialization Formats
4-
Authors: Matthias Benkort <[email protected]>
5-
Comments-URI: https://github.com/cardano-foundation/CIPs/pulls/117
64
Status: Active
7-
Type: Standards
5+
Category: Tools
6+
Authors:
7+
- Matthias Benkort <[email protected]>
8+
Implementors:
9+
- IOG
10+
Discussions:
11+
- https://github.com/cardano-foundation/CIPs/pull/117
812
Created: 2020-08-17
913
License: CC-BY-4.0
1014
---
1115

12-
# Abstract
16+
## Abstract
1317

14-
This specification describes how to serialize Phase-1 monetary scripts (a.k.a. _"native scripts"_) to various formats (JSON, CBOR) to facilitate inter-operability between applications.
18+
This specification describes how to serialize Phase-1 monetary scripts (a.k.a. _"native scripts"_) to various formats (JSON, CBOR) to facilitate inter-operability between applications.
1519

16-
# Motivation
20+
## Motivation: why is this CIP necessary?
1721

1822
While the existence of scripts is well-known, and have an unambiguous on-chain representation. There's no agreed upon format for off-chain or higher-level interfaces for which a binary string is a poor fit. This CIP regroups both the on-chain binary format and other, more verbose, formats like JSON.
1923

20-
# Specification
24+
## Specification
2125

22-
This specification covers at present two serialization formats: JSON and CBOR. The CBOR matches exactly the on-chain representation and is extracted from the cardano-ledger-specs source code and put here as a convenient place to lookup while the source can change location over time.
26+
This specification covers at present two serialization formats: JSON and CBOR. The CBOR matches exactly the on-chain representation and is extracted from the cardano-ledger-specs source code and put here as a convenient place to lookup while the source can change location over time.
2327

24-
## CBOR
28+
### CBOR
2529

26-
The CBOR serialization format is given as a [CDDL specification in annexe](./phase-1-monetary-scripts.cddl). When a hash of the phase-1 monetary script is needed, it usually refers to a Blake2b-192 digest of the corresponding serialized script byte-string prefixed with a null byte: `\x00`.
30+
The CBOR serialization format is given as a [CDDL specification in annexe](./phase-1-monetary-scripts.cddl). When a hash of the phase-1 monetary script is needed, it usually refers to a Blake2b-192 digest of the corresponding serialized script byte-string prefixed with a null byte: `\x00`.
2731

28-
## JSON
32+
### JSON
2933

30-
The JSON format is given as a [JSON schema in annexe](./phase-1-monetary-scripts.json). It is preferred in user interfaces such as command-lines or APIs, where some level of human inspection may be required.
34+
The JSON format is given as a [JSON schema in annexe](./phase-1-monetary-scripts.json). It is preferred in user interfaces such as command-lines or APIs, where some level of human inspection may be required.
3135

32-
## Notes
36+
### Notes
3337

3438
- Scripts may contain unbounded integers! Implementation parsing them, either from CBOR or JSON shall be prepared to handle possible big integers (>= 2^64).
3539

36-
# Rationale
37-
38-
- The preimage for computing script hashes is prefixed with `\x00` to distinguish them from phase-2 monetary scripts (a.k.a Plutus Script) which are then prefixed with `\x01`. This is merely a discriminator tag.
39-
40-
- The current JSON format is based off the cardano-cli's format which has been used widely for minting tokens and is likely the most widely accepted format at the moment.
41-
42-
# Backward Compatibility
43-
44-
N/A
45-
46-
# Reference Implementation(s)
47-
48-
- [cardano-cli](https://github.com/input-output-hk/cardano-node/tree/master/cardano-cli) & [cardano-api](https://github.com/input-output-hk/cardano-node/tree/master/cardano-api)
49-
50-
## Test Vectors
40+
### Test Vectors
5141

5242
```yaml
5343
- json:
5444
{ "type": "sig"
5545
, "keyHash": "00000000000000000000000000000000000000000000000000000000"
5646
}
57-
cbor:
47+
cbor:
5848
"8200581c00000000000000000000000000000000000000000000000000000000"
5949

6050
- json:
@@ -64,7 +54,7 @@ N/A
6454
, "keyHash": "00000000000000000000000000000000000000000000000000000000"
6555
}
6656
, { "type": "any"
67-
, "scripts":
57+
, "scripts":
6858
[ { "type": "after"
6959
, "slot": 42
7060
}
@@ -82,7 +72,7 @@ N/A
8272
{ "type": "before"
8373
, "slot": 42
8474
}
85-
cbor:
75+
cbor:
8676
"8205182a"
8777

8878
- json:
@@ -98,6 +88,24 @@ N/A
9888
"00830302838200581c000000000000000000000000000000000000000000000000000000008200581c000000000000000000000000000000000000000000000000000000018200581c00000000000000000000000000000000000000000000000000000002"
9989
```
10090
101-
# Copyright
91+
## Rationale: how does this CIP achieve its goals?
92+
93+
- The preimage for computing script hashes is prefixed with `\x00` to distinguish them from phase-2 monetary scripts (a.k.a Plutus Script) which are then prefixed with `\x01`. This is merely a discriminator tag.
94+
95+
- The current JSON format is based off the cardano-cli's format which has been used widely for minting tokens and is likely the most widely accepted format at the moment.
96+
97+
## Path to Active
98+
99+
### Acceptance Criteria
100+
101+
- [x] There exist official software releases supporting this serialization format:
102+
- [x] [cardano-cli](https://github.com/IntersectMBO/cardano-cli)
103+
- [x] [cardano-api](https://github.com/IntersectMBO/cardano-api)
104+
105+
### Implementation Plan
106+
107+
- [x] Incorporating this serialization format into Cardano software libraries and command line tools.
108+
109+
## Copyright
102110

103-
CC-BY-4.0
111+
This CIP is licensed under [CC-BY-4.0](https://creativecommons.org/licenses/by/4.0/legalcode).

0 commit comments

Comments
 (0)