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

samotari/ct-api-server

Repository files navigation

CryptoTerminal API Server

No longer maintained

The CryptoTerminal app no longer requires the CT-API-Server to function. The app now communicates directly with ElectrumX servers.

Build Status

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).

About

This project is no longer maintained

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published