Skip to content

Notarize Hash

This example rappresent the case of hash notarization using sdk

const { BcodeSDK, Hash, QRCode } = require("../build");

const sdk = new BcodeSDK({
  apiKey: "<your-api-key>",
  config: {
    env: "MUMBAI",
    debugMode: true,
  },
});

async () => {
  await sdk.init();

  const hash = Hash.fromString("your text")
  //or you can use a SHA256 previous calculated hash with 0x prefix

  const requestId = await sdk.notarizeHash(
    hash
  );

  // Before calling this function you have to wait at least 30sec to get the system
  // time to process and update the result

  let { data } = await sdk.checkBundledNotarization(
    requestId,
    ["merkleRoot", "inclusion", "hash"]
  );

  console.log(data)

});