Skip to content
This repository has been archived by the owner on Oct 1, 2021. It is now read-only.

Latest commit

 

History

History
151 lines (107 loc) · 3.87 KB

README.md

File metadata and controls

151 lines (107 loc) · 3.87 KB

Komodo RPC Library for modern JavaScript

Dependency Status devDependency Status Coverage Status GitHub Issues Build Status NPM version

This package doesn't include Komodo Binary because of security reason. Please setup Komodo Binary in your local first before run this package.

This project is bound by a [Code of Conduct][].

Quickstart

Prerequisites

  • Nodejs: v10.13.0 or newer

  • Yarn: v1.9.4 or newer

  • Npm: v6.3.0 or newer

Install

Install the package via yarn:

yarn add kmd-rpc

or via npm:

npm install kmd-rpc --save

To setup the Komodo daemon, download and unzip it here. Please follow this directory structure.

Your Project
├── bin
│   ├── mac
│   ├── linux
│   └── win
└── src

Create an application.

const path = require("path");
const KomodoRPC = require("kmd-rpc").default;

function getBinPath() {
  return path.join(__dirname, "bin");
}

const api = KomodoRPC(application, {
  bin: getBinPath()
});

Launch the daemon, we will launch KMDice for example.

const coin = "KMDICE";
const args = {
  ac_supply: 10500000,
  ac_reward: 2500000000,
  ac_halving: 210000,
  ac_cc: 2,
  addressindex: 1,
  spentindex: 1,
  addnode: "144.76.217.232"
};

const komodod = await api.startDaemon(coin);

await komodod.start({
  args
});

Wait until the daemon launches and start interact with it.

await komodod.waitUntilReady();

const getnewaddress = await api.rpc({
  coin,
  action: "getnewaddress"
});
debug(`getnewaddress = ${getnewaddress}`);

Stop the daemon.

if (komodod.isRunning() === true) {
  const rs = await api.stop({
    coin
  });
}

Examples

Documentation

Contributing

Familiarize yourself with contributing on github https://guides.github.com/activities/contributing-to-open-source/

  1. Fork the repo on GitHub
  2. Clone the project to your own machine
  3. Commit changes to your own branch
  4. Push your work back up to your fork
  5. Submit a Pull request so that we can review your changes

Issues

Feel free to submit issues and enhancement requests.

Credits

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT license, Copyright (c) 2018 Komodo. For more information see LICENSE.md.