Skip to content
pin2tPublic

About

Bitcoin transactions notification bot

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

310 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bitnsbot (bitnsbot.com)

CI

@bitnsbot

Bitcoin blockchain explorer and events notification bot. It can send notifications on watched addresses and transactions. It also sends various information and statistics on Bitcoin network

transaction notificationAddress notification

Mini App

InfoInfoInfo

How to run

Prerequisites

  • Bitcoin Core 31+ node running with RPC, ZMQ notification and transactions index enabled. Fully synced and not pruned
  • telegram-bot-api running locally on the same machine

Command-line flags

Flag Default Description
-botToken (required) Telegram bot token used to authenticate
outbound Bot API calls
-listen :8080 Address the webhook server listens on
-webhookPath /bot Path the Bot API server will POST updates to
-webhookURL URL the Bot API server should send updates to
e.g. http://localhost:8080/bot
-apiBaseURL http://localhost:8081 Base URL of the local telegram-bot-api server
-secretToken Optional secret checked against the
X-Telegram-Bot-Api-Secret-Token header
-registerWebhook true Call setWebhook on startup
-db bitnsbot.db Path to the database
-coreURL Bitcoin Core JSON-RPC URL
e.g. http://127.0.0.1:8332 (leave empty
to skip connecting to the node)
-coreUser Bitcoin Core RPC username (or use -coreCookie)
-corePass Bitcoin Core RPC password (or use -coreCookie)
-coreCookie Path to Bitcoin Core's .cookie file, an alternative to
-coreUser/-corePass
-coreZMQ Comma-separated ZMQ endpoints publishing
hashblock and rawtx,
e.g. tcp://127.0.0.1:28332,tcp://127.0.0.1:28333
-backup Path to copy the database to periodically
(empty disables backups)
-backupInterval 24h How often to back up the database
-backupScript Command run after each backup,
with the backup path as $1 and in $BACKUP_FILE
-verbose 0 Log verbosity: 0 = ERR/WARN/status, 1 = +INFO,
2 = +NET/DB
-dbuiListen Ignored, and kept only so a config file
that sets it still starts —
the database UI speaks bbolt and is now
bboltwui
-historyFile Path to a JSON file containing
historical BTC/USD rates
-config Path to a properties file
(name=value lines) with flag values;
command-line flags take precedence

Configuration file

Instead of passing all flags on the command line, you can use a properties file. Lines are name=value pairs (without the leading -). Comments start with #.

Example bitnsbot.conf:

# Telegram
botToken=123456:ABC-DEF1234ghijklmnop
webhookURL=http://127.0.0.1:8082/bot
listen=127.0.0.1:8082
apiBaseURL=http://localhost:8081

# Database
db=bitnsbot.db

# Bitcoin Core RPC (use either cookie or user/pass)
coreURL=http://127.0.0.1:8332
# coreUser=rpcuser
# corePass=rpcpassword
coreCookie=/path/to/.cookie

# Bitcoin Core ZMQ for real-time block/tx notifications
coreZMQ=tcp://127.0.0.1:28332,tcp://127.0.0.1:28333

# Backups
backup=/var/backups/bitnsbot.db
backupInterval=24h

# Logging
verbose=1

Running

Build and run:

go test ./... && go build .

With a configuration file:

./bitnsbot -config=bitnsbot.conf

Any flags passed on the command line override values from the config file:

./bitnsbot -config=bitnsbot.conf -verbose=2

With command-line flags only:

./bitnsbot -botToken=... -webhookURL=http://127.0.0.1:8082/bot -listen=127.0.0.1:8082 -db=bitnsbot.db -coreURL=http://127.0.0.1:8332 -coreCookie=cookie -coreZMQ=tcp://127.0.0.1:28332 -verbose=1

Another option: there are scripts to deploy a bot as a systemd service.

Useful tools

advertise - simple command line tool which sends advertising packets with a specific IP to all nodes in Bitcoin network

bboltwui - simple web interface to manage a bbolt database, in a repository of its own

i18n-vet - check translation

addrindex - build transaction history index on addresses. Gather other statistics

Roadmap

  • I18N
  • Mini App
  • Addresses statistics
  • Daily statistics. Send every day market, transactions volume, moved coins, etc statistics
  • Improve data quality. More reliable and correct answers on addresses

About

Bitcoin transactions notification bot

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages