Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Chainpoint Node API: How to Create a Chainpoint Proof
This document explains how to use a Chainpoint Node's API to create and verify a Chainpoint proof.
Each Chainpoint Node has a HTTP API. You can interact with the Node using any programming language that supports HTTP calls. For more complex scenarios we recommend using a client library such as our chainpoint-client-js.
Chainpoint Node service discovery
The first step is to acquire the IP addresses of some Chainpoint Nodes on the network. The following URLs will provide a list of twenty-five public Chainpoint Nodes. The list of nodes is updated periodically.
https://a.chainpoint.org/nodes/random https://b.chainpoint.org/nodes/random https://c.chainpoint.org/nodes/random
Use any of resulting IP addresses to make your Node API requests. We recommend submitting hashes to multiple Nodes. This ensures you’re able to retrieve a proof if one of the nodes goes offline.
Node HTTP API endpoints
Each Chainpoint Node has a REST API with the functions necessary to create and verify Chainpoint proofs. The three most useful endpoints are:
- Submit Hashes - submit one or more hashes, and receive hash ids in response.
- Get Proofs - retrieve one or more proofs, based on the provided hash ids.
- Verify Proofs - submit a proof to a Node for verification, and receive the verification result.
Chainpoint Node API Documentation
You’ll find the full Chainpoint Node REST API documentation at SwaggerHub: https://app.swaggerhub.com/apis/chainpoint/node/1.0.0
SwaggerHub provides sample request and response data. You can also test the API calls in the browser and generate basic API wrappers for over 30 development environments.
How to Create a Chainpoint Proof
Creating a Chainpoint proof is a multistep process that can take up two hours to complete. This tutorial walks you through the basic steps.
Step 1 - Create a Hash
Create a SHA-256 hash of the content you’d like to anchor to the Bitcoin blockchain.
Step 2 - Submit a Hash
Submit your hash to a Node’s
POST /hashes endpoint. The API’s JSON response will include a
hash_id_node property, which is the unique identifier for your Chainpoint Proof.
Step 3 - Retrieve a partial Chainpoint Proof
Wait ~15 seconds for your hash to be anchored to the Chainpoint Calendar. Retrieve the proof by using the Node’s
GET /proofs/:hash_id endpoint. The Node will return a partial Chainpoint proof that points to the Chainpoint Calendar blockchain.
Step 4 - Retrieve a full Chainpoint Proof
It can take up to two hours before a Chainpoint Node is ready to return a full Chainpoint proof. Chainpoint publishes a Bitcoin transaction and waits for six confirmations to ensure its permanence on the Bitcoin blockchain. After two hours, retrieve the proof using the Node’s
GET /proofs/:hash_id endpoint. The node will return an updated version of your proof that is anchored to the Chainpoint Calendar and the Bitcoin blockchain.
Step 5 - Verify a Chainpoint Proof
You can verify a full or partial Chainpoint proof by submitting the proof to a Node’s
POST /verify endpoint. The API response will specify if the proof is valid or not.