Skip to content

Instantly share code, notes, and snippets.

View Stadicus's full-sized avatar

Stadicus Stadicus

View GitHub Profile
@Stadicus
Stadicus / deezy-swap.sh
Last active January 9, 2023 09:16
deezy-swap.sh
#!/bin/bash
set -eu
# Deezy Swap: push Bitcoin Lightning liquidity to LND on-chain address
# --------------------------------------------------------------------------
# This script automates swapping Bitcoin Lightning funds to Bitcoin on-chain
# through deezy.io, an external service.
#
# Use at your own risk.
#
@Stadicus
Stadicus / checkout-pull-requests.txt
Last active February 1, 2022 13:53
[alias] in .gitconfig
# Put the following "alias" in your `.gitconfig` file:
```
[alias]
pr = "!f() { git fetch -fu ${2:-$(git remote |grep ^upstream || echo origin)} refs/pull/$1/head:pr/$1 && git checkout pr/$1; }; f"
```
# Clone the RaspiBolt fork from your own GitHub user space (with SSH for write access)
$ git clone git@github.com:Stadicus/raspibolt.git
$ cd raspibolt
### (Optional) Autounlock LND wallet
Since version 0.13, LND can read the wallet password from a file.
There are many options to (more or less) securely store the password in a file.
LND [describes two options](https://github.com/lightningnetwork/lnd/blob/master/docs/wallet.md#auto-unlocking-a-wallet): an easy but insecure one, and a more secure option using additional software like a password mangager.
We explain an easy approach that is pretty secure for remote attacks (the main threat in our opinion), but not very secure if someone gains physical access to your RaspiBolt node. The main advantage of this method is that only the `root` user has access to the password, and it is exposed to the `bitcoin` group on startup in memory only.
* As user "admin", create a new directory, prepare it and create an empty file to which only `root` has access

Keybase proof

I hereby claim:

  • I am stadicus on github.
  • I am stadicus (https://keybase.io/stadicus) on keybase.
  • I have a public key ASBkk8jwD0Cq7LNK8PvN_YuJrUwcT2Kh8kfFaoCigi4XeAo

To claim this, I am signing this object:

@Stadicus
Stadicus / bitcoin-monitor.md
Last active December 19, 2022 19:58 — forked from ageis/bitcoin-monitor.md
Prometheus exporter for monitoring statistics of Bitcoin daemon

bitcoind-monitor.py

Updated to work with Bitcoin Core 16.0 and newer.

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

# Review of the "Virtual Markets Integrity Initiative" of the Office of the New York State Attorney General
## Mid-term assignment DFIN-522 by Roland Stadler, University of Nicosia
## Introduction
As one of the financial centers of the World, the State of New York has a defining role dealing with financial markets and its service providers. It is a leading player in creating legislation regarding consumer protection and prosecuting fraudulent market participants. The Office of the Attorney General (OAG) "is charged with the statutory and common law powers to protect consumers and investors" (1). As "People's Lawyer" it strives to protect customers of virtual currency platforms (exchanges) and to increase transparency by its "Virtual Market Integrity Initiative" report.
## Review of individual sections and key findings
### Section I: Jurisdiction, Acceptance of Currencies and Fees
# Trueno: dockerized Bitcoin Core
# Resources:
# https://github.com/Stadicus/docker-bitcoin-core (forked)
# https://hub.docker.com/r/truenolightning/bitcoin-core/
# Requirements:
# Git: to clone source (only 2 files)
# Python3: to create rpcauth
# Docker: to run docker image
@Stadicus
Stadicus / install.sh
Created July 31, 2018 13:30
Install script 20180731
#!/bin/sh
echo "$(date +'%Y-%m/%d %H:%M:%S') - init start" >> /home/pi/init.log
if [ -f "/home/pi/init.status" ]; then
initState=$( cat /home/pi/init.status )
echo "init state: $initState" >> /home/pi/init.log
else
initState=0
fi
@Stadicus
Stadicus / setup_clightning.md
Last active December 29, 2022 11:41
Setup c-lightning on Digital Ocean

E-Commerce c-lightning node on Digital Ocean

Prerequisites

  • based on small Digital Ocean VPS (1CPU / 1GB RAM) with Ubuntu 16.04
  • SSH keys are recommended, but not described here
  • (sub) domain name necessary for SSL certificate

UFW & basic stuff

Login as "root"

@Stadicus
Stadicus / 20-raspibolt-welcome
Last active March 28, 2018 19:17
RaspiBolt LND Mainnet: Status overview
#!/bin/sh
# RaspiBolt LND Mainnet: systemd unit for getpublicip.sh script
# /etc/systemd/system/20-raspibolt-welcome.sh
# make executable and copy script to /etc/update-motd.d/
# root must be able to execute bitcoin-cli and lncli
# set colors
color_red='\033[0;31m'
color_green='\033[0;32m'