Skip to content

Trigger a url / action after a bitcoin transaction has a certain number of confirmations

Notifications You must be signed in to change notification settings

samparsky/simple-bitcoin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bitcoin Notification Service

This is a web application that receives a

  • Valid Bitcoin transaction hash,
  • confirmations
  • trigger url

It checks to see if the specified transaction has met the confirmation level then triggers the url.

For example a bitcoin transcation with xxxxx transaction hash, trigger a url 'http://xxxx' when the confirmation level reaches 10.

Install components

  • Redis ( ensure redis is running )
  • Python 3.x ( x >= 4 )
  • Bitcoin node ( ZeroMQ and transaction indexing enabled )

Requirements

$ pip install -r requirements.txt

Architecture


| user query endpoint | -> | redis pub n sub |


Celery Asynchronous tasks

The background workers are managed using celery


| subscriber | -> trigger hooks ->


Configuration

cp .env.example .env

Fill in the details for the following

RPC_HOST=xxxx
RPC_PORT=xxx
RPC_USER=xxxxx
RPC_PASSWORD=xxxxxxxx
ZERO_MQ_HOST=xxx
ZERO_MQ_PORT=xxxx

Run Tests

pytest tests/

Run Server

To run the python server

python server.py

You should see the below output the port is based on what's specified in the env file

Accepting connections on http://0.0.0.0:8082

Server deployment

The background processes are managed using supervisord. The supervisor conf file can be found in scripts\bns-service.conf

Make the startup script executable by running

sudo chmod a+x ./startup.sh

Set the base path for the logs

export BNS_LOGPATH=/var/log/bns-service

Then run the below command:

./startup.sh

Contributor

@samparsky

About

Trigger a url / action after a bitcoin transaction has a certain number of confirmations

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published