Small collection of JavaScript functions for Nxt. Allows for local signing of transactions, token creation/validation and encryption/decryption of arbitrary messages.
npm install nxtjs
npm test
var nxtjs = require('nxtjs');
// Create an account
var acc = nxtjs.secretPhraseToAccountId('secret');
console.log(acc);
Create the bundle with browserify:
browserify index.js -s nxtjs > build/nxtjs.js
Use in HTML file:
<script src="nxtjs.js"></script>
<script>
var acc = nxtjs.secretPhraseToAccountId('secret');
console.log(acc);
</script>
Returns public key of a given passphrase
Returns account ID of a given public key. Set the second parameter to true to get numeric account ID instead of RS format
Returns account ID of a given passphrase. Set the second parameter to true to get numeric account ID instead of RS format.
Signs a hex string of unsigned transaction bytes (e.g. as received from NRS API) with the provided passphrase and returns it.
Generates a Nxt cryptographic token
Parses a Nxt cryptographic token. Returns an object with the keys isValid
,
timestamp
, publicKey
and accountRS
.
Returns an object with the keys nonce
and message
Returns the deciphered text as string
Converts address in numeric format to Reed-Solomon format, or vice versa. Returns an object with the keys account
and accountRS
The purpose of this repo is to consolidate code from multiple sources into one easy to use package for node.js and the browser. Original code was taken from:
- NRS client
- [Jay] (https://github.com/jonesnxt/jay) (Token functions)