@faustbrian/node-delegated-proof-of-stake
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

You can help the author become a full-time open-source maintainer by sponsoring him on GitHub.


@faustbrian/node-delegated-proof-of-stake

npm version

Installation

pnpm install @faustbrian/node-delegated-proof-of-stake

Usage

import { IValidator, mine, round, validator } from "@faustbrian/node-delegated-proof-of-stake";

const validators: IValidator[] = [
  validator(
    "02062f6f6d2aabafd745e6b01f4aa788a012c4ce7131312026bdb6eb4e74a464d2",
    [{ stake: 1 }],
  ),
  validator(
    "020aac4ec02d47d306b394b79d3351c56c1253cd67fe2c1a38ceba59b896d584d1",
    [{ stake: 2 }],
  ),
  validator(
    "0212a11582a28f178b906edbf8e8c447ce1ba86041ee731e595ae4d39ef034c2ad",
    [{ stake: 3 }],
  ),
  validator(
    "0215789ac26155b7a338708f595b97c453e08918d0630c896cbd31d83fe2ad1c33",
    [{ stake: 4 }],
  ),
  validator(
    "021b0f58eca7f123428a8647ffe0644a9454c510f066d3864c27d8c7ad8f5a8aa4",
    [{ stake: 5 }],
  ),
];

const validatorsByRound: round({
  limit: 5,
  round: 1,
  validators,
});

mine({
  height: 1,
  slot: 1,
  validator: validators[4],
  validators: validatorsByRound,
}); // Will return a new SHA256 hash.

mine({
  height: 2,
  slot: 2,
  validator: validators[1],
  validators: validatorsByRound,
}); // Error because someone else was expected to mine.

License

This is an open-sourced software licensed under the AGPL-3.0-or-later.

Readme

Keywords

none

Package Sidebar

Install

npm i @faustbrian/node-delegated-proof-of-stake

Weekly Downloads

3

Version

1.1.0

License

AGPL-3.0-or-later

Unpacked Size

51.6 kB

Total Files

40

Last publish

Collaborators

  • faustbrian