Skip to content

Instantly share code, notes, and snippets.

View chris-belcher's full-sized avatar


View GitHub Profile
chris-belcher / forkers-we-re-not-raising-a-single-byte.txt
Last active December 28, 2017 02:00
Forkers, we're not raising a single byte
In cryptoland, cypherpunks get clever
Belief in freedom switches off never
So long as nodes are run, bitcoin stays untorn
Six an hour, new blocks are born
To honest miners, new coins are bestow
Going above 21 million is a no
[chorus x2]
chris-belcher /
Last active January 7, 2024 15:10
chris-belcher / calculating-equivalent-interest-rate.txt
Last active March 26, 2016 01:07
JoinMarket yield generators earn money on an unpredictable basis. It's worth calculating
the equivalent interest rate as if joinmarket was a savings account.
We can make a model of a bank account that takes deposits and withdrawals at any time and
where the balance accumulates interest, then the parameters from a JoinMarket yield-generator
wallet can be inputted to obtain the equivalent interest rate.
We know that the present value of a bank account (P) grows to the future value (F) determined
by the interest rate per unit time (r) and time (t)
chris-belcher /
Created May 15, 2016 02:55
block probability
import matplotlib
import numpy.random
import matplotlib.pyplot as plt
from matplotlib.ticker import FuncFormatter
cumulative = True
chris-belcher / no-longer-a-dream.txt
Last active July 29, 2016 21:30
No longer a dream
hey cypherpunks, it's the end of the old regime
cryptographic currency, no longer a dream
oh believers in liberty, feel the new sunrise
trustworthy coinage is right before our eyes
it's time to remember the early pioneers
ten thousand coins for a pizza, they look back in tears
chris-belcher /
Last active May 31, 2023 05:07
JoinMarket release 0.2.0 ameliorates this snooping attack.
chris-belcher /
Last active May 14, 2020 19:01
censorship on r/btc

r/btc markets itself as a "censorship-free" sub. In reality it attempts to silence the voices of people it disagrees with.

A few screenshot examples of censorship

this article was deleted when posted, which describes how the mods of r/btc are roger ver's employees at

"Exploit code for the recent BTU attack - apparently this was posted to /r/btc, and of course, got censored. :)"

chris-belcher /
Created December 14, 2016 15:55
IRC script which sends its own pings without creating any other threads
#irc script which sends its own pings without creating any other threads
import socket, random
from datetime import datetime
nick = 'testbot-' + hex(random.randint(0, 0xffffff))[2:]
hostport = ('', 6667)
ping_interval_seconds = 30
ping_timeout_seconds = 60
chris-belcher /
Last active April 13, 2019 21:19
#run with
#/path/to/bitcoin/bin/bitcoin-cli getpeerinfo | python
#output looks like
#zlato@zlato:~/bitcoin-0.17.1/bin$ ./bitcoin-cli getpeerinfo | python
# id addr user-agent iB se re conn'd ping serv lastr
# # host oO nt cv MMDD-HHMM msec ices HHMMSS
# 414 /Satoshi:0.17.1/ oF 20M 28M 0411-2005 358 LNBW 121021
# 417 /Satoshi:0.15.1/ oF 17M 46M 0411-2006 163 NBW 121019
chris-belcher /
Last active January 25, 2024 00:41
Sorted merkle tree as solution to issue #693

The Problem

JoinMarket has a problem where it assumes different nicknames have different bitcoin wallets. This can be exploited by people running multiple yield generator bots from the same wallet, so they get a higher rate of profit at the expense of de-legitimizing the system for privacy.

Crypto primitive 1: Merkle Tree

A merkle tree is a way of producing a commitment to a set, which can later can prove that elements are contained within the set using only O(logN) data, and only revealing one other element in the set.

For example here is a merkle tree commiting to a set of numbers {6, 3, 9, 0, 8, 4, 7, 2}