Newton's Preposterous Miscalculation
Get unlimited public & private packages + package-based permissions with npm Pro.Get started »

@axerunners/axe-util

2.0.5 • Public • Published

axe-util

npm version Build Status Dependency Status

Utility functions for AXE hashes and targets

Usage

npm install @axerunners/axe-util

Methods

toHash(hex)

Takes a hex string that contains a AXE hash as input, and returns a AXE-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.

Install

npm i @axerunners/axe-util

DownloadsWeekly Downloads

4

Version

2.0.5

License

MIT

Unpacked Size

8.15 kB

Total Files

8

Last publish

Collaborators

  • avatar
  • avatar