πŸ” Security

Only web cryptography standards applied

Each block must be signed using the private key assigned to each user or entity, adding the signature attribute to the block.

  block = {
    prevHash: block.prevHash,
    height: block.height,
    version: block.version,
    data: block.data,
    timestamp: block.timestamp,
    scope: block.scope,
    by: block.by,
    signature: ...,
    hash: ...,
  };

The final step is to generate the block's SHA256 hash and attach it to the hash attribute.

These steps are automated using the https://www.npmjs.com/package/@guerrerocarlos/blockchainlibarrow-up-right library: Example usage:

const pathToKey = "./KEY.priv.key";
const blockContent = "TEST";

const signedBlock = await clientSign(
  "ENTITY",
  "SCOPE",
  blockContent, // BLOCK CONTENT
  pathToKey // PATH TO LOCAL KEY
);

const submitResult = await submitBlock(signedBlock);
console.log("submitResult", submitResult);
console.log(await confirmBlock(signedBlock.hash));

Example results:

Last updated