Ceramic anchor service is a PoC implementation of an anchor service according to the Ceramic specification.
This implementation currently uses the Ethereum blockchain but is built in order to be blockchain agnostic. It is fairly easy to add more modules to support other blockchains as well.
In order to run the simulation you need to install Node.js.
Configuration file is located under ./config directory.
In order to build the application start the IPFS node locally and run the following commands:
docker-compose up -d
npm run build
npm run start
RESTful APIs are enabled on http://localhost:3000/api/v0/ by default.
Creates CID anchor request.
URL
/requests
Method:
POST
Data Params
{
"cid": "bafyreihgmyh2srmmyiw7fdihrc2lw2uodvpxb2hbpyxo7w2jlqizga6pne",
"docId": "doc_875c56f9-9d5d-4031-8d3d-d171a91b15aa"
}
Success Response:
{
"id": "06a483c9-eb73-4e08-a019-7b5665588172",
"status": "PENDING",
"message": "Request is pending.",
"cid": "bafyreihgmyh2srmmyiw7fdihrc2lw2uodvpxb2hbpyxo7w2jlqizga6pne",
"docId": "doc_875c56f9-9d5d-4031-8d3d-d171a91b15aa",
"createdAt": 1586438625,
"updatedAt": 1586438625,
"scheduledAt": 1586438625
}
Creates CID anchor request.
URL
/requests/:cid
Method:
GET
URL Params
Required:
cid=[string]
Data Params
None
Success Response - PENDING:
{
"id": "06a483c9-eb73-4e08-a019-7b5665588172",
"status": "PENDING",
"message": "Request is pending.",
"cid": "bafyreihgmyh2srmmyiw7fdihrc2lw2uodvpxb2hbpyxo7w2jlqizga6pne",
"docId": "doc_875c56f9-9d5d-4031-8d3d-d171a91b15aa",
"createdAt": 1586438625,
"updatedAt": 1586438625,
"scheduledAt": 1586438625
}
Success Response - PROCESSING:
{
"id": "06a483c9-eb73-4e08-a019-7b5665588172",
"status": "PROCESSING",
"message": "Request is processing.",
"cid": "bafyreihgmyh2srmmyiw7fdihrc2lw2uodvpxb2hbpyxo7w2jlqizga6pne",
"docId": "doc_875c56f9-9d5d-4031-8d3d-d171a91b15aa",
"createdAt": "2020-04-08T12:10:06.000Z",
"updatedAt": "2020-04-08T12:10:07.000Z"
}
Success Response - FAILED:
{
"id": "06a483c9-eb73-4e08-a019-7b5665588172",
"status": "FAILED",
"message": "Request failed. Staled request.",
"cid": "bafyreihgmyh2srmmyiw7fdihrc2lw2uodvpxb2hbpyxo7w2jlqizga6pne",
"docId": "doc_875c56f9-9d5d-4031-8d3d-d171a91b15aa",
"createdAt": 1586438625,
"updatedAt": 1586438625
}
Success Response - COMPLETED:
{
"id": "06a483c9-eb73-4e08-a019-7b5665588172",
"status": "COMPLETED",
"message": "CID successfully anchored.",
"cid": "bafyreihgmyh2srmmyiw7fdihrc2lw2uodvpxb2hbpyxo7w2jlqizga6pne",
"docId": "doc_875c56f9-9d5d-4031-8d3d-d171a91b15aa",
"createdAt": 1586438625,
"updatedAt": 1586438625,
"anchorRecord": {
"cid": "bafyreicq6rwooyi2dk24p52nutgysi4gpu2lvoeilooekqypk4h4f32wpy",
"content": {
"path": "L/L",
"prev": "bafyreihgmyh2srmmyiw7fdihrc2lw2uodvpxb2hbpyxo7w2jlqizga6pne",
"proof": "bafyreid3fjhoybtbgzdt2afdrxzikprbmgvufn3z7oavodd37k2tnof5ry"
}
}
}
Error Response - NOT FOUND:
Code: 404 (NOT FOUND)
Content: { error : "Request doesn't exist" }
Indicates that no anchor request was found for the given CID.
Error Response - BAD REQUEST:
Code: 400 (BAD REQUEST)
Content: { error : "error message" }
Indicates that the request was malformed or missing necessary arguments like the CID.
Returns the CAIP-2 chain id of the configured blockchain.
URL
/service-info/chainid
Method:
GET
Success Response:
{
"chainId": "eip155:1"
}
Perform a healthcheck against the anchor service itself
URL
/healthcheck
Method:
GET
Success Response:
Error Response:
The image below represents requested CID IPLD document.
The image below represents anchor record IPLD document.
The image below represents anchor proof IPLD document.
Tests are located in the test directory. In order to run test start the following command:
npm run test
In order to run tests with coverage run:
npm run coverage
Apache-2.0 OR MIT
Built with
from 3Box team.
Content type
Image
Digest
sha256:b6541aa38…
Size
796.9 MB
Last updated
about 2 years ago
docker pull ceramicnetwork/ceramic-anchor-service