Skip to main content

Prepare data

The first step of the certification process is to prepare the data that you want to certify through BLOOCK.

This basically translates to load this data to the SDK, standardize it and compute a hash using the algorithm that BLOOCK uses internally (Keccak256). Luckily, all this process is done by the SDK internally so all you need to do is:

Examples

import { RecordClient } from '@bloock/sdk';
import fs from 'fs';

try {
const recordClient = new RecordClient();
const record = await recordClient.fromString('Hello world').build();

// we can get the hash of the record
const hash = await record.getHash();
console.log(hash);

// build a record from an existing record
const _record2 = await recordClient.fromRecord(record).build();

// we can read a file as an array of bytes
const file = fs.readFileSync('sample.pdf');
const _record3 = await recordClient.fromFile(file).build();
} catch (e) {
console.log(e);
}