Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nanopow-rs-node

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nanopow-rs-node

A wrapper for nanopow-rs for Node to provide fast, fully multithreaded Nano proof-of-work generation in Node.js.

  • 0.2.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

nanopow-rs-node

A JavaScript wrapper for nanopow-rs to provide fast, safe, fully multithreaded Nano proof-of-work generation in Node.js.

Usage

First: Install Rust

See https://www.rustup.rs/ for instructions on installing Rust for your system.

With Node

$ yarn add nanopow-rs-node
$ yarn install
const nanopow = require('nanopow-rs-node')

let hash = 'AC101449364C84CDD7562AA724BE52757EF06BCE834C50CF610DD2949291B0D9'
const work = nanopow.generateWork(hash) // no limit to max iterations

const isValid = nanopow.checkWork(hash, work) // true

In Electron App

Basically same as above, see https://guides.neon-bindings.com/electron-apps/

API

/**
 * Attempts to generate valid work for a given hash. Runs 100,000,000 attempts and if no valid work is found, returns '0000000000000000'.
 * @param hash A 32-byte (64-character) hex-encoded string. This will either be the previous block hash, or, if there is no previous block, the account's public key.
 * @param maxIters (optional) The maximum iterations to try before returning. If this parameter is omitted, is null, or is 0, it will run until valid work is found.
 * @return An 8-byte (16-character) hex-encoded string that is the work found. If no valid work was found in maxIters, returns '0000000000000000'
 */
nanopow.generateWork(hash, maxIters)

/**
 * Attempts to generate valid work for a given hash. Will continue to run until valid work is found.
 * @param hash A 32-byte (64-character) hex-encoded string. This will either be the previous block hash, or, if there is no previous block, the account's public key.
 * @param work An 8-byte (16-character) hex-encoded string that is the work to be verified.
 * @return Boolean representing whether the given work was valid for the given hash.
 */
nanopow.checkWork(hash, work)

FAQs

Package last updated on 21 Feb 2018

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc