Git Product home page Git Product logo

lsp-worker-btc's Introduction

LSP Bitcoin Worker

Microservice worker to interact with Bitcoin node

Features

  • Support for various Bitcoin RPC endpoints
  • Support for watching mempool
  • Support for sweeping the blockchain
    • Alerts on new block

Getting started

npm install

Next set up your config by copying the examples...

cp ./config/blocks.worker.config.json.example ./config/blocks.worker.config.json
cp ./config/mempool.worker.config.json.example ./config/mempool.worker.config.json
cp ./config/worker.config.json.example ./config/worker.config.json

worker.config.json will require credentials of a Bitcoin node in it. For a development environment, we recommend installing Polar so you can easily spin up a node for testing. The example credentials in the config file match the defaults for a Bitcoin node created in Polar.

You will also need MongoDB running. worker.config.json can be updated to include connection information for your DB.

Blocktank uses Grenache, a DHT based high performance microservices framework, to distribute and hand out tasks to workers. To create the DHT network, run 2 instances of Grape to get started...

grape --dp 20001 --aph 30001 --bn '127.0.0.1:20002'
grape --dp 20002 --aph 40001 --bn '127.0.0.1:20001

Running everything

You can either launch each of the workers in this repo manually as follows...

node start.bitcoin.js
node start.blocks.js
node start.mempool.js

or use pm2 to run them all and manage all the processes for you...

pm2 start ecosystem.config.js

Workers

The following workers are started here...

  • start.bitcoin.js: svc:btc - provides access to calling the connected Bitcoin node
  • start.blocks.js: svc:btc:blocks - watches for new blocks and calls workers when that happens
  • start.mempool.js: svc:btc:mempool - watches for new transactions in the mempool and calls workers when that happens

By default, the following workers are called (though this can be changed in the config files)...

  • start.blocks.js: svc:btc_zero_conf_orders - called on each new block (see config)
  • start.blocks.js: svc:btc_address_watch - called on each new block (see config)
  • start.mempool.js: svc:btc_zero_conf_orders - called on each new transaction detected (see config)

lsp-worker-btc's People

Contributors

rbndg avatar bitcoinerrorlog avatar

Stargazers

22388o⚡️  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.