Skip to content

Instantly share code, notes, and snippets.

View Stadicus's full-sized avatar

Stadicus Stadicus

View GitHub Profile

Announcing python-bitcointx v1.0.1 release

Python-bitcointx is a Python3 (3.6+) library to work with Bitcoin transactions, and other related things, like addresses, keys, Bitcoin script, etc.

It is based on popular python-bitcoinlib library, but with slightly different focus. Some functionality was removed to reduce the maintenance burden, while other useful functionaliy was added (full list of changes is in release notes).

This library should be viewed as a completely separate library from python-bitcoinlib, it diverges from python-bitcoinlib significantly and breaks the compatibility when it makes sense. Still, it can accomodate most of the code written for python-bitcoinlib, with minor adjustments.

I did not release the official announcement of the library until now, so here it goes.

@ageis
ageis / bitcoin-monitor.md
Last active February 17, 2023 01:25
Prometheus exporter for monitoring statistics of Bitcoin daemon

bitcoind-monitor.py

This is a script written in Python intended to run alongside a Bitcoin node and export statistics for monitoring purposes. It assumes the existence of bitcoin-cli in the PATH and access to the RPC interface over localhost.

It tracks stuff like: block height, difficulty, number of peers, network hash rate, errors, uptime in seconds, mempool size, size of recent blocks, number of transactions within blocks, chaintips, total bytes received and sent, and transaction inputs and outputs. These Bitcoin metrics are refreshed once every 5 minutes.

How it works

Prometheus is a monitoring system and time-series database.

@waja
waja / free_unused_loop_dev.sh
Last active September 30, 2022 12:37
Remove unused loop devices
#!/bin/sh
for LOOPS in $(losetup -a | awk -F':' {'print $1'} | awk -F'/' {'print $3'}); do
for LOOPPART in $(ls /dev/mapper/${LOOPS}*| awk -F'/' {'print $4'}); do
dmsetup remove ${LOOPPART};
done;
losetup -d /dev/${LOOPS};
done