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
- Content:
{ "cid": "bafyreihgmyh2srmmyiw7fdihrc2lw2uodvpxb2hbpyxo7w2jlqizga6pne", "docId": "doc_875c56f9-9d5d-4031-8d3d-d171a91b15aa" }
- Content:
-
Success Response:
- Code: 201
Content:{ "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 }
- Code: 201
Creates CID anchor request.
-
URL
/requests/:cid
-
Method:
GET
-
URL Params
Required:
cid=[string]
-
Data Params
None
-
Success Response -
PENDING
:- Code: 200
Content:{ "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 }
- Code: 200
-
Success Response -
PROCESSING
:- Code: 200
Content:{ "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" }
- Code: 200
-
Success Response -
FAILED
:- Code: 200
Content:{ "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 }
- Code: 200
-
Success Response -
COMPLETED
:- Code: 200
Content:{ "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" } } }
- Code: 200
-
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:
- Code: 200
Content:{ "chainId": "eip155:1" }
- Code: 200
Perform a healthcheck against the anchor service itself
-
URL
/healthcheck
-
Method:
GET
-
Success Response:
- Code: 200
- Code: 200
-
Error Response:
- Code: 503
- Code: 503
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.