Manually Verifying Blockchain Records

Verifying Blockchain Records

An important aspect of recording data on the Blockchain is that it allows you to independently verify the data without needing to trust any particular organization.

In this guide, we'll walk through how to verify a Blockchain credential without using the Accredible interface.

Our Blockchain Process

The first step in independently verifying a Blockchain credential is to understand how we create the record and what the data represents.

  1. We make a JSON representation of the credential including the fields "credential name", "issuer name", "issuer URL", "recipient name", "recipient identity" etc. This representation is similar to the JSON schema here: https://github.com/blockchain-certificates/cert-schema.  
  2. Given this JSON representation of the credential, we generate a SHA256 of it. We store the JSON in our own records and we record the SHA256 hash.
  3. Using the Chainpoint standard, this hash forms the leaf node of a merkle tree.
  4. Once a merkle tree is large enough, the root node of the tree is recorded on the BTC Blockchain. 

Independent Verification

To independently verify a Blockchain credential record's data:

  1. Use this API endpoint to get the current JSON representation of the credential and to get the Blockchain record ID: https://accrediblecredentialapi.docs.apiary.io/#reference/credentials/blockchain-credential/verify-blockchain-credential
    1. Here's a specific example request URL: https://api.accredible.com/v1/credentials/blockchain_data/db5c88e1-188a-4be8-b766-5e0a8aa6fe44

      The UUID can be found in the parameter of the Credential URL.
    2. After getting a 200 response, you can compare the blockchain record (ie: name, issuer, dates, achievements, etc) with the digital credential.
    1. If the information is the same, the blockchain record and digital credential are current and up-to-date.
    2. If there are any discrepancies, the digital credential may have been updated recently and will need for the blockchain record to be updated.
  1. You can also verify that the blockchain record belongs to the digital credential by comparing the Blockchain ID (located on the Credential View) with the "anchor_id" ["type": "btc"].

Validating the Merkle root on the Blockchain (Chainpoint v2 Only)

Let's verify a real example, starting from the Blockchain. We'll verify the record for: https://www.credential.net/d228005c-f018-4f2d-b532-82d8c5be5963 

  1. We make a GET request to the Accredible API: https://api.accredible.com/v1/credentials/blockchain_data/d228005c-f018-4f2d-b532-82d8c5be5963 and this returns the BTC anchor of: c32beaca4fffc707fe16b9efe4a2ae2007b1a2559eb6f8b9fc0b81d76d0278dd

  2. Looking up this transaction: https://blockstream.info/tx/c32beaca4fffc707fe16b9efe4a2ae2007b1a2559eb6f8b9fc0b81d76d0278dd?expand we can see OPT_RETURN.SCRIPTPUBKEY showing the value 4f3434fca621664139d495190f1dd7d8f6179f718fd94bb0204e4f3aac0b2881 which corresponds to our merkle root node.

  3. Now, follow the instructions to validate a ChainpointV2 proof: https://github.com/chainpoint/chainpoint-validate-js#readme, or use the example below:
var chainpointvalidate = require('chainpoint-validate');

var chainpointValidate = new chainpointvalidate();

var validReceipt = {
 "@context": "https://w3id.org/chainpoint/v2",
 "type": "ChainpointSHA256v2",
 "targetHash": "8dff2a0138b47735bae48fbcfea409825d9fdaa4861cd3dd0ae50dc1e7d7641e",
 "merkleRoot": "4f3434fca621664139d495190f1dd7d8f6179f718fd94bb0204e4f3aac0b2881",
 "proof": [{"right":"e36f4538dfb42cb4da4168c17a7de82897e8e0be7a9f8ae09eb1566fec46ad22"},{"left":"d9506cecd7b326be8776c6e612c5d094fe8d256b8ff198c175a999ea5117373e"},{"left":"ff96e10cc9196582a69f1235909d58dde928f1807f205d8b3cc04f3b5134e4c5"},{"right":"6d5d54b7e209ecc894f8738f773e60e5f788b5769198a37adddc49b485e8690d"},{"right":"0ac5788758811c62e24ff8d39940a80840865c996b8b1854dcb84a975b404c33"}],
 "anchors": [
   {
     "type": "BTCOpReturn",
     "sourceId": "c32beaca4fffc707fe16b9efe4a2ae2007b1a2559eb6f8b9fc0b81d76d0278dd"
   }
 ]
};

var fullResult;

chainpointValidate.isValidReceipt(validReceipt, true, function (err, result) {
  if(err) {
    // handle this error
  } else {
    // result.isValid will equal true
    fullResult = result 
  }
});

fullResult



Has this article helped you? Let us know!

If you would like to tell us about any improvements you feel could be made to this page, you can email us at support@accredible.com.