dfinity-block
v0.0.0
Published
This libary provides basic functions for creating serializing and deserializing blocks
Readme
Synopsis
This library provides basic functions for creating serializing and deserializing blocks
Installation
npm install dfinity-block
Usage
const block = new DfinityBlock({
version: 0,
height: 1000,
timestamp: 0,
preBlockHash: new Uint8Array(20),
stateRoot: new Uint8Array(20),
beaconSig: new Uint8Array(32),
preNotarySig: new Uint8Array(32),
minterID: 0,
minterSig: new Uint8Array(32)
})
const sk = crypto.randomBytes(32)
// sign the block as a minter and serialize the block
const signedBlock = await block.sign(sk)
// desialize the block
const block2 = await DfinityBlock.deserialize(signedBlock)
// read the height of the block
block2.heightAPI
Specification
License
All code and designs are open sourced under GPL V3.

