Skip to content

Instantly share code, notes, and snippets.

View 0xB10C's full-sized avatar
💿

0xB10C 0xB10C

💿
View GitHub Profile
@0xB10C
0xB10C / bitcoin-core-tracepoint-nop-assembly.md
Created December 14, 2021 17:03
Answering the question "7. Can you verify that the tracepoints are NOPs in the binaries? If yes, how?" from https://bitcoincore.reviews/23724

Can you verify that the tracepoints are NOPs in the binaries? If yes, how?

Yes, we can verify that the tracepoints are indeed nop assembly operations in a Bitcoin Core binary with tracepoints.

Listing tracepoint locations in the binary

The Bitcoin Core doc/tracing.md contains a section on listing avaliabe tracepoints.

For example, readelf -n src/bitcoind can be used to list ELF notes in the binary. There is an ELF note in the stapsdt section for each tracepoint. This note contains the location of the tracepoint in the binary.

@0xB10C
0xB10C / pruned-nodes-kits-data.ipynb
Created November 12, 2021 09:48
Percentage of pruned nods based on https://www.dsn.kastel.kit.edu/bitcoin/ data
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@0xB10C
0xB10C / perf-block-connect.bt
Created August 17, 2021 21:35
bpftrace script to benchmark the `CChainState::ConnectBlock` function of Bitcoin Core. Outputs CSV.
#!/usr/bin/env bpftrace
/*
USAGE:
bpftrace perf-block-connect.bt <end-height>
This script requires a 'bitcoind' binary compiled with eBPF support and the
'validation:block_connected' tracepoint. By default, it's assumed that 'bitcoind' is
@0xB10C
0xB10C / bips.txt
Last active July 23, 2021 11:34 — forked from ajtowns/bips.txt
bip-activation-history
1MB limit (no bip):
commited: 2010-09-07
flag-day: 79400 2010-09-12
burial: 2010-09-20
dup-tx (bip 30):
bip: 2012-02-22
flag-day: 2012-03-15
p2sh (bip 16):
@0xB10C
0xB10C / shell.nix
Last active March 28, 2024 16:35
Nix shell for Bitcoin Core development (moved to https://github.com/0xB10C/nix-bitcoin-core)
# MOVED:
# To enable better collboration, I've moved the shell.nix to https://github.com/0xB10C/nix-bitcoin-core.
# Older revisions remain avaiable here.
# https://gist.github.com/0xB10C/1fd0d4a68bf96914775b1515340926f8/revisions
#
#
#
#
#
#
from __future__ import print_function
from bcc import BPF, USDT
import sys
from datetime import datetime
if len(sys.argv) < 2:
print("USAGE:", sys.argv[0], "path/to/bitcoind")
exit()
path = sys.argv[1]
debug = False
@0xB10C
0xB10C / toYYYYMMDDString.js
Created March 30, 2018 11:19
Creates an YYYY-MM-DD String from a Date
Date.prototype.toYYYYMMDDString = function () {
return this.getFullYear() + "-" + ("0" + (this.getMonth()+1)).slice(-2) + "-" + ("0" + this.getDate()).slice(-2);
};
@0xB10C
0xB10C / 1000sat.py
Last active January 5, 2018 20:33
generates a list of mempool transactions with more than one 1000sat output
#!/usr/bin/env python
# requires https://github.com/petertodd/python-bitcoinlib
# just retry if a TypeError occurs on nodes without tx indexing (e.g. pruned nodes)
import bitcoin
import bitcoin.rpc
rpc = bitcoin.rpc.RawProxy()
rawmempool = rpc.getrawmempool(False);
@0xB10C
0xB10C / nixcmds.md
Last active November 11, 2017 12:37
linux cmds I often forget
command function usage notes
scp remote -> local scp uname@remotehost:filename /local/dir
scp local -> remote scp filename uname@remotehost:/remote/dir
tar untar to dir tar -xfv archive.tar -C /target/directory (create dir first)
@0xB10C
0xB10C / buckets.py
Created October 17, 2017 21:23
a playground for bitcoin Core's fee estimation buckets
#!/usr/bin/python
# last bucket with more than 2^14 sat/byte
BUCKETCOUNT = 200
# defines a 5% increase per bucket
# https://github.com/bitcoin/bitcoin/commit/e5007bae35ce22036a816505038277d99c84e3f7#diff-8c0941572d1cdf184d1751f7b7f1db4eR109
FEE_SPACING = 1.05
# list of fee buckets