API server for the CryptoTerminal mobile application
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
controllers
docs
lib
middleware
providers
services
test
.eslintrc.js
.gitignore
.travis.yml
LICENSE
README.md
config.js
index.js
package-lock.json
package.json
processes.json
queues.js
server.js
sockets.js

README.md

CryptoTerminal API Server

Build Status Status of Dependencies

API server for the CryptoTerminal mobile application.

Running Your Own Instance

The ct-api-server is a Node.js application that can be run locally (for testing) or on your own publicly accessible server.

Requirements

The requirements differ based on the cryptocurrencies that you wish to support.

  • nodejs - For Linux and Mac install node via nvm.
  • For Bitcoin:
    • electrum - Used for the following:
      • Getting unspent transaction outputs
      • Getting the current network fee rate estimate
      • Broadcasting raw transactions
    • bitcoind - Used for receiving real-time transactions.
  • For Litecoin:
    • electrum-ltc - Used for the following:
      • Getting unspent transaction outputs
      • Getting the current network fee rate estimate
      • Broadcasting raw transactions
    • litecoind - Used for receiving real-time transactions.

Get the Code

Download the project files via git:

git clone https://github.com/samotari/ct-api-server.git

Install the project's dependencies:

cd ct-api-server
npm install

Electrum Daemon

The electrum RPC interface is used to get unspent transaction outputs, fee rate, and broadcast raw transactions. If you have not already done so, download and install electrum. Once you've got that, you will need to configure your RPC settings:

electrum --testnet setconfig rpcuser "user" \
electrum --testnet setconfig rpcport 7777 \
electrum --testnet setconfig rpcpassword "replace with something better"

Then start the electrum daemon:

electrum --testnet daemon start

You can use the same steps above to configure and start an electrum daemon for Bitcoin mainnet as well as use electrum-ltc to query the Litecoin network.

Environment Variables

Below are example environment variables for an instance of the ct-api-server:

CT_API_SERVER_ELECTRUM='{"bitcoinTestnet":{"uri":"http://localhost:7777","username":"user","password":"replace with something better"}}';
CT_API_SERVER_ZEROMQ='{"bitcoinTestnet":[{"dataUrl":"tcp://127.0.0.1:7000"}]}';

Setup bitcoind with ZeroMQ

Bitcoin core (bitcoind) is used to stream transactions in real-time to the ct-api-server. Use the following guide to install and configure bitcoind:

The above guide can also be used with litecoind.

Tests

To run all tests:

npm test

License

This project is licensed under the GNU Affero General Public License v3 (AGPL-3.0).