Skip to main content

Create raw documents

Every OA document has a checksum that provides it a tamper-proof property. At the same time, because the checksum can be used to uniquely identify a document, the checksum (or its derived value) is stored onto the document store as evidence of issuance. To compute the checksum, a raw document goes through a process known as wrapping to become a wrapped document.

Only then, the document is ready to be issued onto the blockchain.

In this guide, you will create a raw document for issuance via Ethereum. It will conform to the OpenAttestation v2.0 schema.

OA document schema

The OpenAttestation v2.0 defines the shape of data for the raw document - the data before the wrapping process. It is defined in JSON Schema format.

The official OpenAttestation v2.0 schema can be found at https://schema.openattestation.com/2.0/schema.json

Using online schema validator

For this guide, you will use an online JSON Schema validator to write the raw document.

Setting up the JSON schema validator with OA schema

Visit https://www.jsonschemavalidator.net/

Paste the contents from https://schema.openattestation.com/2.0/schema.json into the left panel under "Select Schema".

This will setup the JSON schema validator to validate the JSON inputs on the right against the defined schema.

Validator Preview

If you start editing the JSON data on the right you should see errors if the data does not conform to the OpenAttestation v2.0 schema. A summary of the number of errors is found on top of the right panel and the details of the errors are found below the two panels.

Creating raw document

To create data for your document, paste the following JSON data into the right panel of the JSON schema validator tool:

{
"$template": {
"name": "main",
"type": "EMBEDDED_RENDERER",
"url": "https://tutorial-renderer.openattestation.com"
},
"recipient": {
"name": "John Doe"
},
"issuers": [
{
"name": "Demo Issuer",
"documentStore": "0xBBb55Bd1D709955241CAaCb327A765e2b6D69c8b",
"identityProof": {
"type": "DNS-TXT",
"location": "broad-tomato-ferret.sandbox.openattestation.com"
}
}
]
}

To makes things simple, you will use the existing renderer hosted at https://tutorial-renderer.openattestation.com/

However, you will still need to replace the following values in your own document, including the issuer's document store and the identity proof location.

Replacing the issuer's document store

Replace the value of issuers[0].documentStore from 0xBBb55Bd1D709955241CAaCb327A765e2b6D69c8b to the smart contract address of your document store in the previous step.

Replacing the identity proof location

Replace the value of issuers[0].identityProof.location from broad-tomato-ferret.sandbox.openattestation.com to the DNS name used to bind the document store's identity in the previous step.

Validator Completed

Verification

Once all the values are configured and the raw document conforms to the schema, you will see the message No errors found. JSON validates against the schema.

Saving the raw document

To save the raw document:

  1. At the same level with the wallet.json file, create a folder named raw-documents.

  2. Inside that folder create a file named certificate-1.json and paste the validated JSON from above.

  3. Create another file named certificate-2.json.

  4. Paste the same validated JSON into the certificate-2.json file. Change the recipient.name to a different name.

At this point in time, your directory should look like the following:

wallet.json
raw-documents
|-- certificate-1.json
|-- certificate-2.json

You are now ready to wrap the documents.