Skip to main content

VALIDATE DIGEST (bSQL) | Blockpoint Docs

Validate digests checks the current digest against the provided. For examples, see Examples

bSQL Syntax Conventions

Syntax​

VALIDTATE DIGEST { <datbase_object> } PATH "file_path";

database_object ::=
{
database_name.blockchain_name
| datbase_name
}

Arguments​

database_name
The target database to be checked against the provided digest.

blockchain_name
The target blockchain to be checked against the provided digest.

PATH "file_path"
The filepath to the provided digests. The provided digests must be in CSV format and follow the column order produced by the READ DIGEST command.

Permissions​

Requires READ permissions on the target blockchain(s).

READ permissions on all blockchains default to members of the admin fixed database role. READ permissions on user-defined blockchains default to the developer and reader fixed database roles. Members of the admin role can transfer permissions to other users.

Remarks​

  • Only blockchain pages in the archive are validated. Blockchain pages are pushed to the archive when the page is full and no currently open transaction have written to that page.

  • If data was added to the blockchain archive after the digest was exported. New data won't be validated.

  • Running a CHECK VALIDITY command before validating a digest ensures that digest is valid within the database and values haven't been illicitly changed.

  • A database or blockchain digest can be used to validate a blockchain.

  • Only a database digest can be used to validate a database.

  • DISCONNECTED blockchains are still validated as they can be reconnected to the database.

Examples​

The following examples uses the Financial Demo Database.

A. Validating a blockchain digest​

The following example validates the digest of the pricing blockchain. The provided digest can be a blockchain or database digest.

VALIDATE DIGEST financial.pricing PATH "digests/may_5_digest.csv";

Output​

If valid, the output provides the time at which the digest is valid given the last archived page's sealed time of the uploaded digest.

Database object financial_1.pricing is valid against the stored digests for
archived pages before 2021-05-24 16:46:05.992201900

B. Validating a database digest​

The following example reads all blockchain digests in the entire database.

VALIDATE DIGEST financial PATH "digests/may_5_digest.csv";

C. Invalid digest​

The following example illustrates an invalid digest being compared to a valid database.

VALIDATE DIGEST financial PATH "digests/may_5_bad_digest.csv";

Output​

An invalid digest returns specifics on the failed data. In this case, the timestamp on the first page of the system blockchain syscolumns has been modified in either the database or the imported digest.

Blockchain syscolumns: timestamp mismatch when verifying digest page 0, digest 
timestamp 2021-05-21 19:14:14.9512269 +0000 UTC not equal to system
timestamp 2021-05-24 16:46:05.9175726 +0000 UTC

See Also​