![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
foundation-kawpow
Advanced tools
KawPOW algorithm hashing and verification functions for NodeJS.
This is a Node module for simple hashing and verifying inputs using the KawPOW proof-of-work algorithm as implemented by Ravencoin. Most of the native code comes from or is adapted from Ravencoin code. This module has been developed and tested on Node v10.16.3 and Ubuntu 16.04.
If you need help with a code-related matter, the first place to look is our Discord, where the developers will be available to answer any questions. However, please do not come to me with issues regarding setup. Use Google and the existing documentation for that.
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt-get install nodejs -y
sudo apt-get install build-essential
git clone https://github.com/Blinkhash/foundation-kawpow.git
cd foundation-kawpow
npm install && npm test
const kawpow = require('foundation-kawpow');
const mixOutBuf = Buffer.alloc(32);
const hashOutBuf = Buffer.alloc(32);
/**
* Hash using a single nonce and place results into the specified output Buffers.
*
* Note that all input values are expected to be in little-endian format.
*
* All output values are in little endian format
*
* @param headerHashBuf {Buffer} 32-byte header hash
* @param nonceBuf {Buffer} 8-byte nonce value (64-bits)
* @param blockHeight {number} Block height integer
* @param mixOutBuf {Buffer} Mix hash result output Buffer
* @param hashOutBuf {Buffer} Hash result output Buffer
*/
kawpow.hashOne(headerHashBuf, nonceBuf, blockHeight, mixOutBuf, hashOutBuf);
console.log(mixHashBuf.toString('hex'));
console.log(hashOutBuf.toString('hex'));
const kawpow = require('foundation-kawpow');
const hashValueOut = Buffer.alloc(32);
/**
* Verify a mix hash.
*
* Note that all input values are expected to be in little-endian format.
*
* All output values are in little endian format.
*
* @param headerHashBuf {Buffer} 32-byte header hash
* @param nonceBuf {Buffer} 8-byte nonce value (64-bits)
* @param blockHeight {number} Block height integer
* @param mixHashBuf {Buffer} Mix hash for verification
* @param hashOutBuf {Buffer} Hash result output Buffer
* @returns {boolean} True if valid, otherwise false.
*/
const isValid = kawpow.verify(headerHashBuf, nonceBuf, blockHeight, mixHashBuf, hashValueOut);
if (isValid) {
console.log(hashValueOut.toString('hex'));
}
else {
console.log('Invalid');
}
Maintaining this project has always been driven out of nothing more than a desire to give back to the mining community, however I always appreciate donations, especially if this repository helps you in any way.
Released under the MIT License. See https://opensource.org/licenses/MIT for more information
FAQs
KawPOW algorithm hashing and verification functions for NodeJS.
The npm package foundation-kawpow receives a total of 5 weekly downloads. As such, foundation-kawpow popularity was classified as not popular.
We found that foundation-kawpow demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.