Skip to content

Instantly share code, notes, and snippets.

@justinmoon
justinmoon / error.md
Last active July 14, 2019 00:33
lnd error logs
$ lnd --lnddir=$HOME/lndbackup/
Attempting automatic RPC configuration to bitcoind
Automatically obtained bitcoind's RPC credentials
2019-07-13 19:24:56.933 [INF] LTND: Version: 0.7.0-beta commit=v0.7.0-beta-73-g616750184ef9316b849f1ec092176e6814cb2661, build=production, logging=default
2019-07-13 19:24:56.933 [INF] LTND: Active chain: Bitcoin (network=mainnet)
2019-07-13 19:24:56.934 [INF] CHDB: Checking for schema update: latest_version=9, db_version=7
2019-07-13 19:24:56.934 [INF] CHDB: Performing database schema migration
2019-07-13 19:24:56.934 [INF] CHDB: Applying migration #8
2019-07-13 19:24:56.934 [INF] CHDB: Migrating to the gossip message store new key format
2019-07-07 13:12:13.123 [INF] LNWL: Opened wallet
2019-07-07 13:12:13.433 [INF] LTND: Primary chain is set to: bitcoin
2019-07-07 13:12:13.479 [INF] LTND: Initializing bitcoind backed fee estimator
2019-07-07 13:12:13.479 [INF] LNWL: Started listening for bitcoind block notifications via ZMQ on tcp://0.0.0.0:28832
2019-07-07 13:12:13.479 [INF] LNWL: Started listening for bitcoind transaction notifications via ZMQ on tcp://0.0.0.0:28833
2019-07-07 13:12:13.482 [DBG] LNWL: Using minimum fee rate of 253 sat/kw
2019-07-07 13:12:16.034 [INF] LNWL: The wallet has been unlocked without a time limit
2019-07-07 13:12:16.189 [INF] LTND: LightningWallet opened
2019-07-07 13:12:16.191 [DBG] LNWL: Birthday block has already been verified: height=568159, hash=00000000000000000003e6aca881b8eae22684db2033b408f1b6d7881e329776
2019-07-07 13:12:16.275 [INF] HSWC: Restoring in-memory circuit state from disk
@justinmoon
justinmoon / SETUP.md
Last active July 3, 2019 00:30
Build Micropython ESP32 port and upload to m5stack

Linux

Installing ESP32 Dependencies

We will install all esp32 dependencies into ~/esp (you can change if you like)

mkdir -p ~/esp
cd ~/esp
@justinmoon
justinmoon / getaddr_profile.py
Created March 26, 2019 04:05
Measure speed of `addr` response to `getaddr` message on Bitcoin network
# Depends on python-bitcoinlib only
import socket, time, bitcoin
from bitcoin.messages import msg_version, msg_verack, msg_addr, msg_getaddr, MsgSerializable, msg_pong
from bitcoin.net import CAddress
from statistics import mean
from threading import Thread
from concurrent.futures import ThreadPoolExecutor
@justinmoon
justinmoon / gist:8128e66fc11d90ae5732f2491570bfc5
Last active February 8, 2024 04:45
Recovering from a lost BTCPay password w/o SMTP set up

You setup a btcpay server account, forgot to setup SMTP (or set it up wrong) and then forgot your password. Now you can't get back in. Here's how I recovered from this situation:

  1. Create a new user according to these instructions. But this isn't enough because (1) Your new user isn't a member of any stores and (2) for me at least this new user couldn't setup SMTP ...

  2. There is a postgres table called UserStore which tracks membership of users in stores. When you execute the following command in postgres

select * from "UserStore";
@justinmoon
justinmoon / btcpay-migration.md
Last active January 9, 2024 19:37
Transferring BTCPayServer data from one server to another

First, update your old BTCPayServer to the newest version. This way there aren't any database schema conflicts with the your server.

SSH to old server you are migrating from. Create a dump of the your database's schema and data

docker exec generated_postgres_1 pg_dumpall -c -U postgres > backup.sql

Try opening that backup.sql file in your text editor of choice. You will see it's just a series of SQL statements which:

### Keybase proof
I hereby claim:
* I am justinmoon on github.
* I am justinmoon (https://keybase.io/justinmoon) on keybase.
* I have a public key ASAUUTp8gNM-v2dKHQ5KCp71jDQMyiIDbhWCpcpGTAkSygo
To claim this, I am signing this object:
@justinmoon
justinmoon / lambda-calculus.scm
Created January 9, 2019 20:14
The lambda calculus in Racket / Scheme
#lang lazy
; - single argument procedures are the only thing
; - nothing else
(define (TRUE x)
(lambda (y) x))
(define (FALSE x)
(lambda (y) y))
"""
BanknetCoin
Usage:
banknetcoin.py serve
banknetcoin.py ping
banknetcoin.py tx <from> <to> <amount>
banknetcoin.py balance <name>
Options:
@justinmoon
justinmoon / mynewblockcoin.py
Created November 7, 2018 21:43
mynewblockcoin.py
"""
BanknetCoin
Usage:
banknetcoin.py serve
banknetcoin.py ping
banknetcoin.py tx <from> <to> <amount>
banknetcoin.py balance <name>
Options: