Skip to content

Instantly share code, notes, and snippets.

@awemany
awemany / .gitignore
Last active November 29, 2018 15:42
Testing multithreaded transaction counting methods
test
*~
@awemany
awemany / ZCF.md
Last active January 10, 2023 15:00
Solving the 0-conf problem using forfeits

Solving the 0-conf problem using forfeits

by /u/awemany

Overview

The problem of ensuring good security for unconfirmed transactions in Bitcoin is repeatedly discussed in the community. Right now these so-called 0-conf transactions are usually expected to be of low risk in the case of small amounts and face-to-face interaction of merchant and customer.

@awemany
awemany / bet.py
Created July 28, 2017 11:37
Peter Rizun's memorylessness bet against CSW
#!/usr/bin/env python
# CSW vs. Peter Rizun bet demo by awemany
# Note this discretizes time into seconds for easier understanding. This will
# however-so-slightly bias the calculations in here, due to coincidences etc.
import numpy as np
MEAN_BLOCK_TIME = 600
minute = 60
@awemany
awemany / stickygate.py
Created November 30, 2016 09:46
Python code awemany vs. dgenr8 block depth probability
#!/usr/bin/env python
import numpy as np
from scipy.special import binom
from scipy.integrate import quad
from scipy.stats import erlang
######################################################################
# awemany: look at binomial
def bprop(k, n, p):
"""Binomial probability density.
Probability of drawing exactly k x-like items out of n total, where