How to Create and Verify a Chainpoint Proof
This guide shows how developers can use a Chainpoint Node to create and verify a Chainpoint proof. Chainpoint is an open standard for creating a timestamp proof of any data, file, or process.
Each Chainpoint Node has a HTTP API. You can interact with the Node using any programming language that supports HTTP calls. If you’re using Node.js, we recommend using a client library such as chainpoint-client-js which simplifies the processes outlined below.
Things to know before getting started:
Chainpoint Node Service Discovery
The first step is to acquire the IP addresses of some of the 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.
Use any of the URI’s returned to make your Node API requests. We recommend submitting hashes to multiple Nodes. This ensures that you will be able to retrieve a proof even 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 id’s in response.
- Get Proofs — retrieve one or more proofs, based on the hash id’s provided.
- Verify Proofs — submit a proof to a Node for verification, and receive the verification result.
Chainpoint Node API Documentation
You can find the complete 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.
Creating and Verifying Proofs
Creating a Chainpoint proof is an easy, multi-step process that can take up to two hours to complete, due to transaction times. This tutorial will walk you through the basic steps.
Step 1. Create a Hash
Create a SHA-256 hash of the content that you’d like to anchor to the Bitcoin blockchain.
*You can convert any document into a SHA-256 hash using online converters, like this one: https://hash.online-convert.com/sha256-generator
Step 2. Submit a Hash
Submit your hash to a Node’s POST /hashesendpoint. The API’s JSON response will include a hash_id_nodeproperty, which is the unique identifier for your Chainpoint Proof.
Step 3. Retrieve a partial Chainpoint Proof
Wait approximately 15 seconds for your hash to be anchored to the Chainpoint Calendar. Retrieve the proof by using the Node’s GET /proofs/:hash_idendpoint. 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. This is because Chainpoint publishes a Bitcoin transaction and waits for six confirmations to ensure its permanence on the Bitcoin blockchain. After two hours, you need to retrieve your updated, full proof using the Node’s GET /proofs/:hash_idendpoint. The node will return the updated version of your proof that’s anchored to both 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 /verifyendpoint. The API response will specify if the proof is valid or not.
Congratulations! You’ve just created and verified your own Chainpoint proof.