@dashevo/dark-gravity-wave

1.1.1 • Public • Published

dark-gravity-wave-js

Build Status NPM version

Dark Gravity Wave difficulty retargeting algorithm in JavaScript

Install

npm install @dashevo/dark-gravity-wave

Usage

const dgw = require('@dashevo/dark-gravity-wave');

dgw.hasValidTarget(header, previousHeaders, 'testnet');
// -> true or false

API

hasValidTarget(header, previousHeaders, [network = 'mainnet'])

header

Type: object

previousHeaders

Type: array

network

Type: string (optional, default = 'mainnet')

Validates the target (bits) property of a block header. The 2nd argument, the array of most recent previous headers, must contain block header objects of the last 24 blocks. Arrays with length > 24 are allowed however only the latest 24 will be considered. The block header objects must contain timestamp and target properties (nBits field of the block header)

Contributing

Feel free to dive in! Open an issue or submit PRs.

License

MIT © Dash Core Group, Inc.

Readme

Keywords

Package Sidebar

Install

npm i @dashevo/dark-gravity-wave

Weekly Downloads

118

Version

1.1.1

License

MIT

Unpacked Size

64.8 kB

Total Files

17

Last publish

Collaborators

  • shumkov
  • alex-werner
  • nmarley
  • cofresi
  • antouhou
  • evodeploy
  • jawid-h