🔗 A toolkit for the Nano cryptocurrency, allowing you to derive keys, generate seeds, hashes, signatures, proofs of work and blocks.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
__tests__ Fix checkAddress when address contains 0 or 2 (#53) Sep 3, 2018
docs Add more explanation on HashBlockParams in docs Jul 22, 2018
examples BREAKING CHANGE: change some API to named parameters Jul 12, 2018
src Fix checkAddress when address contains 0 or 2 (#53) Sep 3, 2018
types-local
.editorconfig
.gitignore
.gitmodules feat: refactor to JS, allowing support for env without WebAssembly li… Mar 15, 2018
.prettierrc
.travis.yml add tslint May 11, 2018
LICENSE
README.md Remove JS standard Jul 12, 2018
native.d.ts feat: migrate to TypeScript, add type definition files (#32) May 7, 2018
package.json fix: trigger checkAddress fix release Sep 3, 2018
rollup.config.js
showcase.js BREAKING CHANGE: change some API to named parameters Jul 12, 2018
showcase.png BREAKING CHANGE: change some API to named parameters Jul 12, 2018
tsconfig.json
tslint.json simplify linting / format with prettier and airbnb preset May 16, 2018
yarn.lock fix: embed nano-base32 for ES5 compilation (#47) Jul 27, 2018

README.md

nanocurrency-js

npm version build status semantic-release


A battle-tested toolkit for the Nano cryptocurrency.

If you are looking for legacy blocks, you will want the ^1.0.0 versions.

Code showcase

The documentation is available locally in docs/ or online at https://marvinroger.github.io/nanocurrency-js.


Features

  • Generate seeds
  • Derive secret keys, public keys and addresses
  • Hash blocks
  • Sign and verify blocks
  • Compute and test proofs of work
  • Check the format of seeds, secret keys, public keys, addresses, amounts, etc.
  • Convert Nano units
  • CLI doing all of the above

Usage

To install the library:

npm install nanocurrency
# or yarn add nanocurrency
import * as nanocurrency from 'nanocurrency';

To install the CLI:

npm install -g nanocurrency
# or yarn global add nanocurrency
nanocurrency --help

Performance

You might be wondering how fast is the work generation. There's a pow-benchmark example in the examples/ directory. On an Intel Core i7-8550U CPU, with 100 iterations, the average computation time is 18.5s per work.

Considering you can pre-compute and cache the work prior to an actual transaction, this should be satisfying for a smooth user experience.


Contribute

Contributions are very welcome. To develop, make use of the following commands (using Yarn):

  • yarn build:dev: build the C++ code to WebAssembly and bundle the files into the dist directory, without optimization so that it is fast while developing. Note that you'll need to have Docker installed

  • yarn test: test the code

  • yarn lint: lint the code against JavaScript Standard Style

  • yarn format: format the code with Prettier

  • yarn generate-docs: generate the DOCUMENTATION.md file from the JSDoc annotations


Donations

If you like the project, feel free to donate some nano:

xrb_3mrogerjhkdyj6mzf4e7aatf3xs3gp4stwc9yt9ymgasw7kr7g17t4jwwwy8