Skip to content

Instantly share code, notes, and snippets.

View harding's full-sized avatar

David A. Harding harding

View GitHub Profile
@harding
harding / instructions.md
Last active May 7, 2024 06:25
Working With Multiple Repositories On GitHub

Working With Multiple Repositories On GitHub

Most projects on GitHub have a main repository that's the focal point of activity. For example, the Example organization has the Example.com repository:

https://github.com/example/example.com

Developers of Example.com typically call this the 'upstream' repository. We'll come back to it in a moment.

@harding
harding / bip100-fork.py
Created October 14, 2015 23:32
Code to scan for BIP100 coinbase strings
## (python3) Objective: count the number of blocks voting for BIP100 or
## using the BVnnnnnnn convention
# Requires: sudo pip3 install json-rpc
## WARNING: read and understand the following link before writing
## production JSON-parsing code for Bitcoin:
## https://en.bitcoin.it/wiki/Proper_Money_Handling_%28JSON-RPC%29
import requests
## Objective: mine the Bitcoin genesis block
from struct import pack
from hashlib import sha256
from codecs import decode
from binascii import hexlify
## Bitcoin uses the SHA256d hash function, which is the SHA256 function
## run twice (double).
def sha256d(data):

A description of known problems in Satoshi Nakamoto's paper, "Bitcoin: A Peer-to-Peer Electronic Cash System", as well as notes on terminology changes and how Bitcoin's implementation differs from that described in the paper.

Abstract

The longest chain not only serves as proof of the sequence of events witnessed, but proof that it came from the largest pool of CPU power.

@harding
harding / txes-over-10k.txt
Created May 31, 2017 15:03
Transactions with combined output values over 10,000 BTC
This file has been truncated, but you can view the full file.
1195000000000 1aae9d58e8826aa65ce985061a78642ec2d920e8a8bb1679aae35f7d496d25b4 2009-10-22
1225000000000 5d79327054118bfc51475b82319d11e041e23b581d36a4ff47302b95380a735e 2009-10-24
1300000000000 3cd9410fc4642ce3e4591f5f5600965bf5b104c81160d204afb2d9169c5b4ce8 2009-10-27
1550000000000 6029e51c4706c8b12bfdc9bab2311cc99d7fd5ccca3701bff4af2935c4a89215 2009-11-04
1550000000000 1043eb5c8b85764358f21127ed51de772db594222d650be07b45f3a9c68bdc78 2009-11-10
1450000000000 c6dbae4c8ca97a746030b390441cdfc750218a20b07d29b56f07b157cdc0bbd3 2009-11-10
1350000000000 b34d15d7b7e6c2a4333fe13f354de1d715b7d8d00ec86b4cf0f8d24bfa71a2e1 2009-11-10
1250000000000 a40d0843b9868a26792e952851a082442eace99f2c384f0ed6ca991612fd2f60 2009-11-10
1150000000000 0b8f2d77c16afaa08435d71cd31467e62011cc39fe1d1318959bc74f1ad5b064 2009-11-10
1050000000000 214f42239036b95ba5dd94f9969b4b4eb8485de51a458fe76cabe95b510b4468 2009-11-10
@harding
harding / scan-for-txes-over-10x.py
Created May 31, 2017 15:05
Scan for transactions with combined output values over 10,000 BTC
from bitcoin import rpc
from bitcoin.core import x, lx, b2x, b2lx
#from multiprocessing.dummy import Pool
from multiprocessing import Pool
from retrying import retry
threshold = 10000e8 # satoshis
high_height = rpc.Proxy().getinfo()["blocks"]
@harding
harding / craig-wright-2017-06-30.md
Created July 1, 2017 00:02
Craig Wright talk at Future of Bitcoin on 30 June 2017

[This is a transcript of Craig Wright's presentation at the Future of Bitcoin conference on 30 June 2017. This transcription should not be seen as an endorsement of Mr. Wright, a person who previously fraudulently claimed to be the creator of Bitcoin, among many other fraudulent claims.

Note that ellipses in the text ("...") represent the speaker trailing off or switching topics mid-sentence, rather than the omission of any text by the transcriber. All comments and additions from the transcriber appear between square brackets.

@harding
harding / reporter-1-email-1.md
Last active January 2, 2023 19:45
Reply to journalists about BIP148 network disruption

Hi Dave, I found your name among those contributing to the Bitcoin code. Would you be willing to field a question or two about the significance of this potential Bitcoin network outage?

https://bitcoin.org/en/alert/2017-07-12-potential-split

I'm happy to answer questions by email, but please note that I can only speak for myself. I don't speak for the Bitcoin project, Bitcoin.org, or any other Bitcoin project, and nobody can speak for Bitcoin any more

@harding
harding / foo.sh
Created July 15, 2017 12:07
Get in-block fees
sudo apt-get install jq num-utils
height=$( bitcoin-cli getblockchaininfo | jq .blocks ) ; for i in $( seq $((height-1008)) $height ) ; do echo -n "$i " ; bitcoin-cli getrawtransaction $( bitcoin-cli getblock $( bitcoin-cli getblockhash $i ) | jq -r '.tx[0]' ) true | jq '.vout[].value' | sed '$a-12.5' | numsum ; done > block-fees.dat
@harding
harding / top-feerate-txes.txt
Created July 15, 2017 13:47
The first 10 transactions in the past 50 blocks
The first transaction is the coinbase. The rest are probably
the highest feerate transactions in the block because Bitcoin Core
and most other nodes sort the transactions in block by modified_feerate
(feerate factoring in unconfirmed ancestor/descendant transactions).
Code:
height=$( bitcoin-cli getblockchaininfo | jq .blocks ) ; for i in $( seq $((height-(49))) $height ) ; do echo -e "\nBlock $i" ; bitcoin-cli getblock $( bitcoin-cli getblockhash $i ) | jq -r '.tx[]' | head -n 10 ; done > top-feerate-txes.txt
Block 475862
0ed65347f618c257309d29c1d921aeddccaf1b502580b2b098dbc30b9710c396