JSPM

@dashevo/dash-util

2.0.3
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 169
  • Score
    100M100P100Q85562F
  • License MIT

Utility functions for Dash hashes and targets

Package Exports

  • @dashevo/dash-util

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@dashevo/dash-util) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

dash-util

npm version Build Status Dependency Status

Utility functions for Dash hashes and targets

Usage

npm install @dashevo/dash-util

Methods

toHash(hex)

Takes a hex string that contains a Dash hash as input, and returns a Dash-protocol-friendly little-endian Buffer. Throws an error if the hex string is not of length 64 (representing a 256-bit hash).

compressTarget(target)

Converts the difficulty target target to its compact representation (used in the "bits" field in block headers). target should be a Buffer (little-endian, the zeroes should be at the end). Returns a number.

expandTarget(bits)

Converts the compressed target integer bits to its target hash representation. Returns a Buffer.