kmd-rpc
v0.5.0
Published
komodo rpc library
Downloads
4
Readme
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
- Basic example
- Start KMDice chain
- Start mutil chain
- Start a chain and call RPC
- Start a chain and read its config
- Start a chain with log options
Documentation
Contributing
Familiarize yourself with contributing on github https://guides.github.com/activities/contributing-to-open-source/
- Fork the repo on GitHub
- Clone the project to your own machine
- Commit changes to your own branch
- Push your work back up to your fork
- Submit a Pull request so that we can review your changes
Issues
Feel free to submit issues and enhancement requests.
Credits
- pbca26 - Initial work - pbca26
- Nam Hoang - Maintainer - particle4dev
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
.