Skip to content

Instantly share code, notes, and snippets.

View fjahr's full-sized avatar
🏠
Working from home

Fabian Jahr fjahr

🏠
Working from home
View GitHub Profile
@fjahr
fjahr / ffm_topics.md
Last active August 27, 2020 13:59
Bitcoin Socratic Seminar @ Bitcoin Week Frankfurt (27.08.2020)

Bitcoin Socratic Seminar in Frankfurt (27.08.2020)

Part of Bitcoin Week. For more information on Bitcoin Socratic Seminars in general, see https://bitdevs.org/ and https://bitdevs.berlin/.

Usually we talk about new topics of the last 4 weeks but since this group is not meeting regularly it will be more of a "best-of" of the last ~2 months. Also, feel free to bring your own topic if you feel something is missing (has to be in line with our general selection guidelines, no promotion of commercial services please). Ideally notify me before we start so I can make time for it or send me a message on twitter (@fjahr).

Security

@fjahr
fjahr / load_all_comments_gh.js
Last active August 13, 2020 16:15
Load all the GH comments
function f() {
setTimeout( () => {
if(document.getElementsByClassName("ajax-pagination-btn").length){
Array.from(document.getElementsByClassName("ajax-pagination-btn")).forEach(l => l.click());
f();
} else {
console.log("Done");
}
}, 1000); // May need to adjust this depending on your internet connection and machine performance
}
@fjahr
fjahr / ibd.md
Last active January 21, 2020 18:44
IBD outputs filesizes for https://github.com/bitcoin/bitcoin/pull/17887

With --enable-debug

$ src/bitcoin-cli getblockchaininfo
{
  "chain": "main",
  "blocks": 220002,
  "headers": 613884,
  "bestblockhash": "00000000000000f8e6ea4282254b6cbc518a519ac7e1de83a8b7f413c16bc2c7",
  "difficulty": 3275464.586565617,
@fjahr
fjahr / tests.md
Created December 31, 2019 13:06
Destination Group coin selection

This succeeds:

  • 50 outputs of 1 BTC in the same destination
  • Send 10.5 BTC
  • 2 groups are used for the inputs, in total there are 20 inputs
    def test_destination_groupings(self):
        '''
        If a destination has more than 10 outputs, exactly 10 outputs should
        be used when spending from that destination
        '''
@fjahr
fjahr / lightning_mw_messages.md
Last active February 11, 2019 17:28
List of all Lightning Network MW Message Types

Lightning Network MW Message Types

List of all Lightning Network Message Types for easy & quick overview.

Messages with strikethrough style exist in the original RFCs but are currently removed in Lightning MW.

Setup & Control (0 - 31)

Messages related to connection setup, control, supported features, and error reporting.

@fjahr
fjahr / lightning_messages.md
Last active February 2, 2019 20:22
List of all Lightning Network Message Types

Lightning Network Message Types

List of all Lightning Network Message Types for easy & quick overview.

Setup & Control (0 - 31)

Messages related to connection setup, control, supported features, and error reporting.

@fjahr
fjahr / lightning_resources.md
Last active November 14, 2018 23:37
Technical Lightning Network Resources
@fjahr
fjahr / debug.ex
Created April 24, 2018 23:07
Debugging Plug as a last resort for debugging nasty production issue in Elixir/Phoenix/AWS ECS Fargate
defmodule MyApp.Plugs.Debug do
@behaviour Plug
require Logger
def init(default), do: default
def call(conn, _) do
case conn.request_path do
"/path/to/error" ->
@fjahr
fjahr / pb.py
Last active April 20, 2018 15:48
Minimize Change Output for Bitcoin transactions, naive implementation
"""
Suppose you are given a list of possible Bitcoin that you control (inputs). You
need to pay someone exactly 0.71 BTC. How would you select exactly 2 inputs in
such a way as to minimize the change output if you could ignore fees? Write a
python function that selects the two inputs.
"""
from itertools import permutations
TEST_INPUTS = [0.21, 0.59, 1.34, 3.45, 0.3, 0.84, 0.53, 0.62, 0.70, 0.21, 0.44,
0.28, 0.39, 200.9, 4.34]