nChain Event
Back to All
V.1.4.3
V.1.4.3
  • nChain Event User Guide
  • πŸ“”Overview
    • Introduction
    • Configuration Symbols
    • Features and Benefits
    • Core Concepts
    • Encoded and Unencoded ‑ Records
  • πŸ€”Using nChain Event
    • How to Use nChain Event
    • Initial Set-Up
  • πŸ”Independent Records
    • Introduction
    • Functional Description
      • Write Record
      • Read Record
      • Verify Record †
    • Use Cases
      • Lucky Number Tickets
      • Internet of Things (IoT) Data
      • Intellectual Property Rights (IPR) Evidence
      • Car Dealership
    • Tutorials
      • Data Integrity
      • Blockchain Unique Identifiers
    • API Workflow
      • Configure API
      • Write Record
      • Get Location Status
      • Read Record
      • Verify Record †
  • πŸ”—Linked Records Β§
    • Introduction
    • Functional Description
      • Create Link Record Β§
      • Read Link Record Β§
      • Update Link Record Β§
      • Delete Link Record Β§
      • Verify Link Record Β§ †
      • Navigate Linked Record Β§ ΒΆ
    • Use Cases
      • Luxury Handbag Provenance
      • Random Prize Draw
    • Tutorials
      • Collection Integrity
      • Provenance Integrity
    • API Workflow
      • Configure API
      • Create Link Record Β§
      • Get Link Location Status Β§
      • Read Link Record Β§
      • Update Link Record Β§
      • Delete Link Record Β§
      • Verify Link Record Β§ †
      • Navigate Link Record Β§ ΒΆ
  • βš™οΈAPI Documentation
    • nChain Event API
  • ⛓️Bitcoin SV Blockchain
    • Features and Benefits
    • Writing to Blockchain
    • Reading from Blockchain
    • Transaction Format
  • ⁉️Troubleshooting
    • Troubleshooting
    • Error Codes
    • Glossary
    • Contact Us
Powered by GitBook
On this page
  • Item Registration
  • Item Verification
  • Benefits
  1. πŸ”Independent Records
  2. Tutorials

Data Integrity

PreviousTutorialsNextBlockchain Unique Identifiers

A business wants to be assured about the data integrity (accuracy and authenticity) of their user account balances (or any other data) in their database. To achieve that, the business wants to easily verify the user account balances.

Verification and validation are often seen as an important part of Data Integrity (for instance see here). The solution includes these steps:

  • Item registration – the user account balance is hidden but registered on the blockchain

  • Item verification – the user account balance is compared with the blockchain to determine validity

Please be aware that verification always requires the original item.

We will use this class wrapper around the Independent Record REST API (described here):

Class Event(aUrl, aApiKey) {

  write(record, salt) // write a fingerprint on the blockchain and return location

  verify(record, salt, location) // verify on blockchain, return match/mismatch/error

}

Item Registration

Every time that the user account balance is updated in the application's database, this procedure is performed to register a fingerprint of the new balance on the blockchain:

  aRecord = "get the user account balance for the userId"

  aSalt = time.now()

  aLocation = event.write(aRecord, aSalt) // Register the record on the blockchain

  // ensure that you persist aSalt, aLocation for the userId

"aRecord" contains whatever fields you want to register, e.g. a single field, a set of fields such as id, balance, dates, indices, a complete record, a set of records, or even complete tables or datasets.

Item Verification

At any arbitrary time later, the business can verify the original user account balance with this procedure:

  aRecord = "get the user account balance for the userId"

  aSalt, aLocation = "load the stored salt and location for the userId"

  result = event.verify(aRecord, aSalt, aLocation) // Compare with the blockchain

  if result = match // aRecord is verified as valid
  if result = mismatch // aRecord is verified as invalid
  if result = error // try again later

"aRecord" must contain identical fields to those that were originally registered to the blockchain.

Normally, you can expect that the result will be "match".

If you encounter a "mismatch", then you know that either there is something wrong with your process or the local record. These will need further investigation on your part. Maybe an updated record was not written to the blockchain or your local copy of the record location has become corrupted?

If you encounter an "error", you can try again later. If the error persists for more than an hour or so, then this is unlikely to simply be a delay in writing to the blockchain and again there appears to be something seriously wrong with the process which will need further investigation on your part. Maybe your local copy of the record location has become corrupted?

The actual syntax is shown in Verify Record below.

Benefits

  • Provides high confidence of the validity of verified data for the business.

  • Provides high confidence to data auditors/users who have access to the original data of its validity.