GithubHelp home page GithubHelp logo

nyzo-js's Introduction

nyzo-js

Toolkit for Nyzo cryptocurrency allowing to create and manage acounts implementing BIP32, BIP39 and BIP 44.

The toolkit supports creating and importing wallets and encoding and decoding NyzoStrings

Features

  • Generate wallets with a BIP39 mnemonic phrase
  • BIP32/44 private key derivation
  • Import wallets with a mnemonic phrase or a seed
  • Runs in all web browsers and mobile frameworks built with Javascript
  • Validate addresses and mnemonic words
  • Encode and decode Nyzostrings

Usage

From NPM

npm install nyzo-js
WARNING: do not use any of the keys or addresses listed below to send real assets!

Wallet handling

import { wallet } from 'nyzo-js'

// Generates a new wallet with a mnemonic phrase, seed and an account
// You can also generate your own entropy for the mnemonic or set a seed password
// Notice, that losing the password will make the mnemonic phrase void
const wallet = wallet.generate(entropy?, password?)

// Import a wallet with the mnemonic phrase
const wallet = wallet.fromMnemonic(mnemonic, seedPassword?)

// Import a wallet with a seed
const wallet = wallet.fromSeed(seed)


// Derive private keys for a seed, from and to are number indexes
const accounts = wallet.accounts(seed, from, to)
// The returned wallet JSON format is as follows. The mnemonic phrase will be undefined when importing with a seed.
{
  mnemonic: 'hole kiss mouse jacket also board click series citizen slight kite smoke desk diary rent mercy inflict antique edge invite slush athlete total brain',
  seed: '1accdd4c25e06e47310d0c62c290ec166071d024352e003e5366e8ba6ba523f2a0cb34116ac55a238a886778880a9b2a547112fd7cffade81d8d8d084ccb7d36',
  accounts: [
    {
      accountIndex: 0,
      privateKey: '45498b388601bac4758dce54092449896ec2ffa041b9bfe96e30149bbd7ae1a7',
      publicKey: '65cad42982c4af901fa562384390e049e4e687b500594ebe9dfd1dfdc5810dd6',
      publicKeyAsNyzoString: 'id__86oaT2D2Pa~g7Ymze4egW4EBXFvT05CeMGV.7wV5xgVnqPGwR~g~',
      privateKeyAsNyzoString: 'key_84m9zRz60sI4upVem0BBipCLNM~xgsD_YnWN59L.vL6E4xQKTySS'
    }
  ]
}

Validating values

import { tools } from 'nyzo-js'


// Validate mnemonic words
const valid = tools.validateMnemonic('edge defense waste choose enrich upon flee junk siren film clown finish luggage leader kid quick brick print evidence swap drill paddle truly occur')

Contributions

You are welcome to contribute to the module. To develop, use the following commands.

  • npm install to install all the dependencies
  • npm run build to build the Typescript code
  • npm run test to run the tests

Donations

If you find this piece of software helpful, consider buying us a cup of coffe.

NYZO: id__80qi1DrCJZfcPPVeC83CgCX36SDN.StRhKYSeB-rrqr7z-_LShR7

BTC: bc1qsshn75ase5c66sjlfmefymw5dx8w384jvp4v0j

Made with ♥ for the community

nyzo-js's People

Contributors

itsmarcosolis avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.