Skip to content

Instantly share code, notes, and snippets.

View openoms's full-sized avatar
🏗️
building

openoms openoms

🏗️
building
View GitHub Profile
@SeverinAlexB
SeverinAlexB / scidConverter.ts
Last active April 2, 2024 11:06
Lightning Network short channel id (CLN) to decimal id (LND) converter
/** By LnRouter.app */
function bitShift(n: number, shiftBy: number): number {
let base = n;
for (let i = 0; i < shiftBy; i++) {
base = base * 2;
}
return base;
}
export function shortChannelIdToDecimalId(shortChannelId: string): string {
@BitcoinWukong
BitcoinWukong / Fund c-lightning channel with JoinMarket.md
Last active November 1, 2022 18:39
Creating a Core Lightning channel funded by JoinMarket

Software Version

bitcoin core: 0.21.0
core lightning: 0.11.1
joinmarket: 0.9.6

Step 1:

@zerofeerouting
zerofeerouting / reasons-for-force-closes.md
Last active July 23, 2022 10:39
Common reasons for force-closes

Why did our channel get force-closed?

There are a bunch of possible reasons for a force close - I will elaborate on the most common ones.

⚠ This is a work in progress and will get expanded.

1. Stuck HTLC timed out

WHAT HAPPENED?
An HTLC (a lightning transaction) timed out, which means it did neither succeed in arriving at it's

@RubenSomsen
RubenSomsen / Silent_Payments.md
Last active November 20, 2023 18:16
Silent Payments – Receive private payments from anyone on a single static address without requiring any interaction or extra on-chain overhead

Silent Payments

Receive private payments from anyone on a single static address without requiring any interaction or extra on-chain overhead.

Update: This now has a BIP and WIP implementation

Overview

The recipient generates a so-called silent payment address and makes it publicly known. The sender then takes a public key from one of their chosen inputs for the payment, and uses it to derive a shared secret that is then used to tweak the silent payment address. The recipient detects the payment by scanning every transaction in the blockchain.

#!/bin/bash
#alias lightning-cli="docker exec -it cln lightning-cli"
#docker exec -it cln lightning-cli getinfo
#working_path=/home/bitcoin/script-earning
BASEDIR=$(dirname $0)
working_path=${BASEDIR}
_now=$(date +"%d:%m:%Y")
JSON=`docker exec cln lightning-cli clboss-status | jq .offchain_earnings_tracker`
echo $JSON | jq -r 'map({in_earnings, in_expenditures}) | (first | keys_unsorted) as $keys | map([to_entries[] | .value]) as $rows | $keys,$rows[] | @csv' > $working_path/status.csv
awk -F"," '{x+=$1}END{print "Total earning: " x/1000}' $working_path/status.csv
@vindard
vindard / README.md
Last active March 29, 2022 19:20
Galoy graphql api demo for #LightningHackdayIST

Description

This gist contains 3 files that can be imported into postman to play with our api:

  • grapqhql_api collection which has our queries and mutations
  • devnet environment variables for local testing (uses regtest network)
  • staging environment variables for testing against our staging endpoint (uses testnet network)
@laurentdebricon
laurentdebricon / raspiblitz-and-cloudflare.md
Last active March 18, 2022 14:31
Raspiblitz BTCpayserver on Clearnet with Cloudlare, without paying a VPN

Inspired by openoms tips box : http://tips.diynodes.com

If you already have a domain name setup with Cloudflare.com, you can easily do that, for free, without paying a VPN.

Trusting the vpn provider VS trusting Cloudflare. If that's ok for you go on :)

(for the example my domain is spiritualcomputing.com, be sure to replace it with yours) :

Go to cloudflare, dns, add 2 A records to your domain

NAME tips your_isp_public_ip
NAME pay your_isp_public_ip
@freenancial
freenancial / xpub_zpub_convert.py
Created August 5, 2020 06:31
Convert xpub/xprv to zpub/zprv
import base58
x = 'xprv9s21ZrQH143K2f55zo5GiXiX16MiPzBgc2bEXNd77e1ooGsjxAyXjozyuniqiSB76VESjTW8s7vdsK3NFboha6tZgF9BzcDdNtUT6Aw99P2'
zp = b'\x04\xb2\x43\x0c'
base58.b58encode_check(zp + base58.b58decode_check(x)[4:]).decode('ascii')
# output: 'zprvAWgYBBk7JR8GjFTKfWeX8huXM2ecHEAgSFdg6AQssemZuUWCTVJeywKFxCe1iFUwumU4EQhFnSdjdtGVgzdjAaFmQvY3ARrbvLbjsLf6oNE'
# xprv = b'\x04\x88\xad\xe4'
# yprv = b'\x04\x9d\x78\x78'
# zprv = b'\x04\xb2\x43\x0c'
@chris-belcher
chris-belcher / coinswap-design.md
Last active March 22, 2024 04:10
Design for a CoinSwap Implementation for Massively Improving Bitcoin Privacy and Fungibility

Design for a CoinSwap Implementation for Massively Improving Bitcoin Privacy and Fungibility

25/5/2020

Abstract

Imagine a future where a user Alice has bitcoins and wants to send them with maximal privacy, so she creates a special kind of transaction. For anyone looking at the blockchain her transaction appears completely normal with her coins seemingly going from address A to address B. But in reality her coins end up in address Z which is entirely unconnected to either A or B.

Now imagine another user, Carol, who isn't too bothered by privacy and sends her bitcoin using a regular wallet which exists today. But because Carol's transaction looks exactly the same as Alice's, anybody analyzing the blockchain must now deal with the possibility that Carol's transaction actually sent her coins to a totally unconnected address. So Carol's privacy is improved even though she didn't change her behaviour, and perhaps had never even heard of this software.

@21isenough
21isenough / check_ssh_tunnel.sh
Created May 10, 2020 09:44
Check if SSH still up, reconnect if not (run as a cron job)
#/bin/bash
DATE=$(date)
runAutossh() {
/usr/bin/autossh -M 20000 -Nf -R PORT:127.0.0.1:PORT USER@REMOTE_IP
if [[ $? -eq 0 ]]; then
echo Tunnel to REMOTE_IP created successfully
else
echo An error occurred creating a tunnel