Dark Gravity Wave difficulty retargeting algorithm in JavaScript
npm install @dashevo/dark-gravity-wave
const dgw = require('@dashevo/dark-gravity-wave');
dgw.hasValidTarget(header, previousHeaders, 'testnet');
// -> true or false
Type: object
Type: array
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)
Feel free to dive in! Open an issue or submit PRs.
MIT © Dash Core Group, Inc.