Skip to content

xazabevo/dapi

 
 

Repository files navigation

DAPI

Build Status API stability

A decentralized API for the Dash network

Table of Contents

Install

npm install

Dependencies

DAPI targets the latest LTS release of Node.js. Currently, this is Node v10.13.

DAPI requires Insight-API and the latest version of dashcore with Evolution features (special branch repo).

  1. Install core. You can use the docker image (dashcore:evo) or clone code from the repository, switch to the evo branch, and build it by yourself. Note: you need to build image with ZMQ and wallet support. You can follow the build instructions located here
  2. Configure core. DAPI needs dashcore's ZMQ interface to be exposed and all indexes enabled. You can find the example config for dashcore here. To start dashcore process with this config, copy it somewhere to your system, and then run ./src/dashd -conf=/path/to/your/config.
  3. Install Insight-API. You can use docker image (evoinsight:latest) or install it manually.
    1. To install it manually, clone the dashcore-node repo. cd to that repo, run npm i
    2. Copy config file to the repo directory
    3. Install Insight-API service. Run ./bin/dashcore-node install https://github.com/dashevo/insight-api/ from the repo directory
    4. Run ./bin/dashcore-node start

Usage

After you've installed all the dependencies, you can start DAPI by running the npm start command inside the DAPI repo directory.

npm start

Configuration

DAPI is configured via environment variables either explicitly passed or present in the .env dotfile. For example, to change the DAPI port, execute DAPI with the following arguments: RPC_SERVER_PORT=3010 npm start. Consult the sample environment file. You can see the full list of available options here.

Making basic requests

DAPI uses JSON-RPC 2.0 as the main interface. If you want to confirm that DAPI is functioning and synced, you can request the best block height.

Send the following json to your DAPI instance:

{"jsonrpc": "2.0","method": "getBestBlockHeight", "id": 1}

Note that you always need to specify an id, otherwise the server will respond with an empty body, as mentioned in the spec.

API Reference

A list of all available RPC commands, along with their various arguments and expected responses can be found here

Implementation of these commands can be viewed here.

Contributing

Feel free to dive in! Open an issue or submit PRs.

License

MIT © Dash Core Group, Inc.

About

A decentralized API for the Xazab network

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 98.6%
  • Shell 1.1%
  • Dockerfile 0.3%