Anchors
Anchoring allows users to store a digest of one or more credentials (or any document) on our blockchain, tying them to immutable timestamps and proving that they were generated at a certain moment in time. By enabling this feature, users will have more options for auditing credentials given and timestamping any documents.
The Dock Blockchain includes a module explicitly intended for proof of existence. You post the hash of a document on-chain at a specific block. Later you can use that hash to prove the document existed at or before that block.
The API allows you to create, get, and retrieve anchors as well as a list of all anchors created by the user.
For a detailed example of the anchor workflow. Please refer here.
Endpoints
POST /anchors GET /anchors GET /anchors/{anchor}
Create Anchor
Creating an anchor will state on the blockchain that one or more document hashes were created at a specific time. In the context of verifiable credentials, anchors are used to attest that the credential document was not altered and was created at a specific time. Batching multiple documents/credentials into a single anchor is done through a Merkle tree and can save on cost/time as only the Merkle root has to be anchored.
The API will store the blake2b256
hash of a document or string that you provide. Dock provides a fully functioning reference client and SDK example for anchoring.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | array of strings or JSON | true | Supply an array of strings or JSON documents to be hashed and anchored to the blockchain. For credentials, send the Verifiable Credential document(s) or anchor when issuing. |
Responses
200 | The request was successful and will try to create an anchor on the blockchain. | ||
400 | The request was unsuccessful, because of invalid params. | ||
402 | Transaction limit reached or upgrade required to proceed |
List Anchors
Return a list of all anchors created by the authenticated user, regardless of whether they have contributed to the batching or not.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
offset | query | integer | false | How many items to offset by for pagination |
limit | query | integer | false | How many items to return at one time (max 64) |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | The request was successful and will return all anchors created by the user. | Inline | |
402 | Transaction limit reached or upgrade required to proceed |
Get Anchor
Get a specific anchor with the given ID.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
anchor | path | true | An anchor id. |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | The request was successful and returns the anchor's details, e.g., | ||
404 | The request was unsuccessful, because the anchor was not found. | ||
402 | Transaction limit reached or upgrade required to proceed |
Verify Anchor
Verify an anchor's merkle root and proof by supplying the source documents (array of strings of JSON objects, same as in anchor creation).
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
documents | body | array of strings or JSON | true | An array of strings or JSON objects to represent documents to be hashed |
proofs | body | JSON object array | true | An array of proofs given on anchor creation |
root | body | true | The anchor merkle root/ID. |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | The request was successful and returns the anchor's details, e.g., | ||
402 | Transaction limit reached or upgrade required to proceed |
Last updated