Skip to content

Commit defdde3

Browse files
rphairKtorZ
andauthored
CIP-0072 | Fold inline schemas into links to companion files (#529)
* collapsed inline schemas into links to respective files * Update CIP-0072/README.md --------- Co-authored-by: Matthias Benkort <[email protected]>
1 parent 11e0c5e commit defdde3

File tree

1 file changed

+5
-352
lines changed

1 file changed

+5
-352
lines changed

CIP-0072/README.md

+5-352
Original file line numberDiff line numberDiff line change
@@ -89,153 +89,13 @@ The on-chain dApp registration certificate MUST follow canonical JSON and be ser
8989

9090
*`signature`*: The signature of the certificate. The publishers generate the signature is by first turning on-chain JSON into a canonical form (RFC 8765), hashing it with blake2b-256 and generating a signature of the hash. Stores / clients can verify the signature by repeating the process, they can use the public key to verify the signature of the certificate. Fields used for canonical JSON: ["subject", "rootHash", "metadata","type"]. Please note that a signature should be generated of blake2b-256 hash as a byte array, not as a hex represented string(!).
9191

92-
### On chain CDDL for registration / de-registration
92+
### On-chain Schemas
9393

94-
```
95-
string = bstr .size (1..64) ; tstr / string from 1 up to 64 chars only
96-
97-
sig_256 = bstr .size (64..64) ; 256 bytes signature (256 / 64 = 4 bytes)
98-
99-
transaction_metadata = {
100-
1667: on-chain_metadata
101-
}
102-
103-
on-chain_metadata = {
104-
subject: string,
105-
rootHash: sig_256,
106-
metadata: [+ string] / [+ string / [+ string]],
107-
type: registration / de-registration,
108-
signature: signature,
109-
}
94+
[On-chain CDDL for registration / de-registration (Version 1)](./version_1_onchain.cddl)
11095

111-
registration = {
112-
action: "REGISTER",
113-
? comment: string,
114-
}
96+
which also can be expressed using JSON schema:
11597

116-
de-registration = {
117-
action: "DE_REGISTER",
118-
? comment: string,
119-
}
120-
121-
signature = {
122-
r: string,
123-
s: string,
124-
algo: text .regexp "Ed25519-EdDSA",
125-
pub: string,
126-
}
127-
```
128-
129-
which can be expressed using JSON schema.
130-
131-
### dApp on-chain certificate JSON Schema
132-
133-
```json
134-
{
135-
"$schema":"https://json-schema.org/draft/2020-12/schema",
136-
"$id":"https://example.com/dApp.schema.json",
137-
"title": "Cardano dApp Claim",
138-
"description": "Registration of Cardano dApp claim.",
139-
"type":"object",
140-
"properties":{
141-
"subject":{
142-
"type":"string",
143-
"minLength": 1,
144-
"maxLength": 64,
145-
"pattern":"^[0-9a-fA-F]{1,64}$",
146-
"description":"Identifier of the claim subject (dApp). A UTF-8 encoded string, must be max 64 chars. Typically it is randomly generated hash by the dApp developer."
147-
},
148-
"rootHash":{
149-
"type":"string",
150-
"minLength": 64,
151-
"maxLength": 64,
152-
"pattern":"^[0-9a-fA-F]{64}$",
153-
"description":"blake2b-256 hash of the metadata describing the off-chain part of the dApp."
154-
},
155-
"metadata": {
156-
"type": "array",
157-
"description": "An array of valid URLs pointing to off-chain CIP-72 compatible metadata document. If an individual URL is longer than 64 characters, it must be expressed as an array of strings (where each string may contain at most 64 characters).",
158-
"items": {
159-
"anyOf": [{
160-
"type": "string",
161-
"minLength": 1,
162-
"maxLength": 64
163-
}, {
164-
"type": "array",
165-
"items": {
166-
"type": "string",
167-
"minLength": 1,
168-
"maxLength": 64
169-
}
170-
}],
171-
"examples": ["https://raw.githubusercontent.com/org/repo/offchain.json", ["https://raw.githubusercontent.com/long-org-name/", "long-repo-name/offchain.json"], "ipfs://QmbQDvKJeo2NgGcGdnUiUFibTzuKNK5Uij7jzmK8ZccmWp", ["ipfs://QmbQDvKJeo2NgGcGdnUiaAdADA", "UFibTzuKNKc0jA390alDAD5Uij7jzmK8ZccmWp"]]
172-
}
173-
},
174-
"type":{
175-
"type":"object",
176-
"description":"Describes the releases, if they are new or an updates.",
177-
"properties":{
178-
"action":{
179-
"type":"string",
180-
"enum":["REGISTER", "DE_REGISTER"],
181-
"description":"Describes the action this certificate is claiming; i.e 'REGISTER', for a new dApp or an update, DE_REGISTER for asserting that the dApp's development is stopped, and it is deprecated. So, no further dApp's on-chain update is to be expected."
182-
},
183-
"comment": {
184-
"type": "string",
185-
"minLength": 1,
186-
"maxLength": 64,
187-
"description": "A free text field to provide details about this particular changes (64 chars limited)."
188-
}
189-
},
190-
"required":[
191-
"action"
192-
]
193-
},
194-
"signature":{
195-
"description":"Signature of the blake2b-256 hash of whole canonical (RFC 8785) JSON document (except signature property).",
196-
"type":"object",
197-
"properties":{
198-
"r":{
199-
"type":"string",
200-
"description":"A hex representation of the R component of the signature.",
201-
"minLength": 64,
202-
"maxLength": 64,
203-
"pattern":"^[0-9a-fA-F]{64}$"
204-
},
205-
"s":{
206-
"type":"string",
207-
"description":"A hex representation of the S component of the signature.",
208-
"minLength": 64,
209-
"maxLength": 64,
210-
"pattern":"^[0-9a-fA-F]{64}$"
211-
},
212-
"algo":{
213-
"const":"Ed25519-EdDSA"
214-
},
215-
"pub":{
216-
"type":"string",
217-
"description":"A hex representation of the public key.",
218-
"minLength": 64,
219-
"maxLength": 64,
220-
"pattern":"^[0-9a-fA-F]{64}$"
221-
}
222-
},
223-
"required":[
224-
"r",
225-
"s",
226-
"algo",
227-
"pub"
228-
]
229-
}
230-
},
231-
"required":[
232-
"subject",
233-
"rootHash",
234-
"type",
235-
"signature"
236-
]
237-
}
238-
```
98+
[dApp on-chain certificate JSON Schema (Version 1)](./version_1_onchain.json)
23999

240100
### Metadata Label
241101

@@ -247,214 +107,7 @@ When submitting the transaction metadata pick the following value for `transacti
247107

248108
The dApp Registration certificate itself doesn't enforce a particular structure to the metadata you might fetch off-chain. However, we recommend that you use the following structure:
249109

250-
```json
251-
{
252-
"$schema": "https://json-schema.org/draft/2020-12/schema",
253-
"type":"object",
254-
"properties": {
255-
"subject": {
256-
"type":"string",
257-
"minLength": 1,
258-
"maxLength": 64,
259-
"pattern":"^[0-9a-fA-F]{1,64}$",
260-
"description": "A subject, it must match with subject stored on chain data. A UTF-8 encoded string, 1 - 64 chars."
261-
},
262-
"projectName": {
263-
"type":"string",
264-
"description": "A project name, e.g. My dApp."
265-
},
266-
"link": {
267-
"type":"string",
268-
"description": "Website presenting a dApp.",
269-
"pattern": "(https?:\/\/(?:www\\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\\.[^\\s]{2,}|www\\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\\.[^\\s]{2,}|https?:\/\/(?:www\\.|(?!www))[a-zA-Z0-9]+\\.[^\\s]{2,}|www\\.[a-zA-Z0-9]+\\.[^\\s]{2,})"
270-
},
271-
"logo": {
272-
"type":"string",
273-
"description": "URL to the logo or the base64 encoded image."
274-
},
275-
"categories": {
276-
"type":"array",
277-
"items": {
278-
"type": "string",
279-
"enum":["Games", "DeFi", "Gambling", "Exchanges", "Collectibles", "Marketplaces", "Social", "Other"]
280-
},
281-
"description": "One or more categories. Category MUST be one of the following schema definition."
282-
},
283-
"social": {
284-
"type":"object",
285-
"properties": {
286-
"website": {
287-
"type":"string",
288-
"description": "dApps website link.",
289-
"pattern": "(https?:\/\/(?:www\\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\\.[^\\s]{2,}|www\\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\\.[^\\s]{2,}|https?:\/\/(?:www\\.|(?!www))[a-zA-Z0-9]+\\.[^\\s]{2,}|www\\.[a-zA-Z0-9]+\\.[^\\s]{2,})"
290-
},
291-
"twitter": {
292-
"type":"string",
293-
"description": "An optional Twitter link.",
294-
"pattern": "(https?:\/\/(?:www\\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\\.[^\\s]{2,}|www\\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\\.[^\\s]{2,}|https?:\/\/(?:www\\.|(?!www))[a-zA-Z0-9]+\\.[^\\s]{2,}|www\\.[a-zA-Z0-9]+\\.[^\\s]{2,})"
295-
},
296-
"github": {
297-
"type":"string",
298-
"description": "An optional Github link.",
299-
"pattern": "(https?:\/\/(?:www\\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\\.[^\\s]{2,}|www\\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\\.[^\\s]{2,}|https?:\/\/(?:www\\.|(?!www))[a-zA-Z0-9]+\\.[^\\s]{2,}|www\\.[a-zA-Z0-9]+\\.[^\\s]{2,})"
300-
},
301-
"discord": {
302-
"type":"string",
303-
"description": "An optional Discord link.",
304-
"pattern": "(https?:\/\/(?:www\\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\\.[^\\s]{2,}|www\\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\\.[^\\s]{2,}|https?:\/\/(?:www\\.|(?!www))[a-zA-Z0-9]+\\.[^\\s]{2,}|www\\.[a-zA-Z0-9]+\\.[^\\s]{2,})"
305-
}
306-
},
307-
"required": ["website"]
308-
},
309-
"description": {
310-
"type": "object",
311-
"properties": {
312-
"short": {
313-
"type": "string",
314-
"description": "Short dApp description (no less than 40 and no longer than 168 characters).",
315-
"minLength": 40,
316-
"maxLength": 168
317-
},
318-
"long": {
319-
"type": "string",
320-
"description": "An optional long dApp description (no less than 40 and no longer than 1008 characters).",
321-
"minLength": 40,
322-
"maxLength": 1008
323-
}
324-
},
325-
"required": [
326-
"short"
327-
]
328-
},
329-
"releases": {
330-
"type": "array",
331-
"items": [
332-
{
333-
"type": "object",
334-
"properties": {
335-
"releaseNumber": {
336-
"type": "string",
337-
"pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(-((0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*)(\\.(0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*))*))?(\\+([0-9a-zA-Z-]+(\\.[0-9a-zA-Z-]+)*))?$",
338-
"description": "Semver compatible release number (major.minor.patch) or (major.minor.patch-some_text) e.g. 1.2.3 or 1.1.1-alpha"
339-
},
340-
"releaseName": {
341-
"type": "string",
342-
"description": "An optional human readable release name, e.g. V1"
343-
},
344-
"securityVulnerability": {
345-
"type": "boolean",
346-
"description": "Indicates that a given version has a security vulnerability."
347-
},
348-
"comment": {
349-
"type": "string",
350-
"description": "A free text field to provide comment about this particular release, e.g. new features it brings, etc."
351-
},
352-
"scripts": {
353-
"type": "array",
354-
"items": [
355-
{
356-
"type": "object",
357-
"properties": {
358-
"id": {
359-
"type": "string"
360-
},
361-
"version": {
362-
"type": "integer"
363-
}
364-
},
365-
"required": [
366-
"id",
367-
"version"
368-
]
369-
}
370-
]
371-
}
372-
},
373-
"required": [
374-
"releaseNumber"
375-
]
376-
}
377-
]
378-
},
379-
"scripts": {
380-
"type": "array",
381-
"items": [
382-
{
383-
"type": "object",
384-
"properties":{
385-
"id": {
386-
"type":"string",
387-
"description": "Unique Script ID (across all scripts from this dApp)."
388-
},
389-
"name":{
390-
"type":"string",
391-
"description": "An optional script name usually related to it's function."
392-
},
393-
"purposes":{
394-
"type":"array",
395-
"items": {
396-
"type": "string",
397-
"enum":["SPEND", "MINT"]
398-
},
399-
"description": "Purposes of the script, SPEND or MINT (notice it can be both for some modern Cardano languages)."
400-
},
401-
"type":{
402-
"enum":["PLUTUS", "NATIVE"],
403-
"description": "Script Type. PLUTUS refers to the typical PlutusV1 or PlutusV2 scripts, where as NATIVE means there has been no Plutus directly used by this is a native script."
404-
},
405-
"versions":{
406-
"type":"array",
407-
"items":[
408-
{
409-
"type":"object",
410-
"properties":{
411-
"version":{
412-
"type":"integer",
413-
"description":"Script version, monotonically increasing."
414-
},
415-
"plutusVersion":{
416-
"type":"integer",
417-
"enum":[1, 2]
418-
},
419-
"scriptHash":{
420-
"type":"string",
421-
"description":"Full on-chain script hash (hex).",
422-
"pattern":"[0-9a-fA-F]+"
423-
},
424-
"contractAddress": {
425-
"type":"string",
426-
"description":"An optional Bech32 contract address matching script's hash."
427-
}
428-
},
429-
"required": [
430-
"version",
431-
"plutusVersion",
432-
"scriptHash"
433-
]
434-
}
435-
]
436-
}
437-
},
438-
"required": [
439-
"id",
440-
"purposes",
441-
"type",
442-
"versions"
443-
]
444-
}
445-
]
446-
}
447-
},
448-
"required": [
449-
"subject",
450-
"projectName",
451-
"link",
452-
"social",
453-
"categories",
454-
"description"
455-
]
456-
}
457-
```
110+
[Off-chain dApp Registration certificate schema (Version 1)](./version_1_offchain.json)
458111

459112
This schema describes the minimum required fields for a store to be able to display and validate your dApp. You can add any other fields you want to the metadata, but we recommend that you use at least the ones described above.
460113

0 commit comments

Comments
 (0)