Skip to content

Instantly share code, notes, and snippets.

View theStack's full-sized avatar
💭
BUIDL

Sebastian Falbesoner theStack

💭
BUIDL
View GitHub Profile
@theStack
theStack / bip352_scanning_approaches.txt
Last active December 4, 2025 18:43
Different approaches for scanning in Silent Payments (BIP-352)
Different approaches for scanning in Silent Payments (BIP-352)
=============================================================================================
===== "calculate label candidates for each tx output, look them up in the labels cache" =====
=============================================================================================
The current approach for scanning in secp #1765 is as follows, following BIP-352:
For each k value, derive the unlabeled output candidate P_k, then loop over the
transaction x-only outputs linearly to check whether there is either a unlabeled or a
labeled match. For the latter, two label candidates are calculated for each transaction
@theStack
theStack / secp_pr1767_bench_results.txt
Created November 7, 2025 20:30
Benchmark results for secp PR #1767 on my arm64 notebook (Lenovo Thinkpad T14s Gen 6, with a Qualcomm Snapdragon X Elite CPU)
$ cc --version | head -1
cc (Ubuntu 14.2.0-19ubuntu2) 14.2.0
$ lscpu | head -3
Architecture: aarch64
CPU op-mode(s): 64-bit
Byte Order: Little Endian
$ uname -a
Linux thestack-ThinkPad-T14s-Gen-6 6.17.0-8-qcom-x1e #8-Ubuntu SMP PREEMPT_DYNAMIC Sun Aug 31 21:03:54 UTC 2025 aarch64 aarch64 aarch64 GNU/Linux
===== Baseline =====
@theStack
theStack / bench_pr1767.sh
Last active November 7, 2025 17:49
Benchmarking secp256k1 PR #1767
#!/usr/bin/env bash
set -e
git checkout master
git fetch upstream pull/1767/head:pr1767
git checkout pr1767
build_bench_at_commit() {
local commit=$1
local suffix=$2
@theStack
theStack / secp256k1-proto-extract.txt
Last active February 18, 2025 01:36
Extract secp256k1proto from bip-frost-dkg repository with history using git-filter-repo
$ git clone https://github.com/BlockstreamResearch/bip-frost-dkg secp256k1proto-extract-history
$ cd secp256k1proto-extract-history
$ git filter-repo --path-rename reference/secp256k1ref:python/secp256k1proto
$ git filter-repo --path-rename python/secp256k1ref:python/secp256k1proto
$ git filter-repo --path python/secp256k1proto
$ git filter-repo --path-rename python/secp256k1proto:src/secp256k1proto
$ uv init --package --lib --name secp256k1proto --python 3.11
$ git add . && git commit -m 'initialized package via "uv init"'
$ git remote add origin https://github.com/theStack/secp256k1proto-playground
$ git push origin master:with_history2
@theStack
theStack / gist:0893258c3aba91c28539b9334d2e0608
Created October 19, 2024 13:22
considerations for a possible secp256k1 hazmat module
considerations for a possible secp256k1 hazmat module
- exposed data types
* as discussed at coredev lisbon: provide scalar and point types in the
first version, field element type can still be added later if needed
* responsibility for allocating space for the types?
the PoC secp-zkp pr #153 [1] provides a function _scalar_size and forces
the user to allocate dynamic memory, which seems not ideal, especially
in embedded systems where malloc usage is often strongly discouraged
(or not even possible); it seems better to know the size already at
summary for #28970:
let's assume we have a 1p1c-package consisting of low-feerate parent tx_p
and high-feerate child tx_c. a node receives this package in form of two
single tx messages, tx_p and then tx_c.
to my current understanding, the following happens on this receiving node:
on master:
@theStack
theStack / gist:b41884e31ebc5cdca3220bcaa674cb70
Created February 18, 2024 01:36
Bitcoin depends BDB build fail on OpenBSD
configure:6211: checking whether C++ supports the ISO C++ standard includes
configure:6231: clang++ -m64 -c -pipe -std=c++20 -O2 -I/home/thestack/bitcoin/depends/amd64-unknown-openbsd7.4/include -D_XOPEN_SOURCE=600 conftest.cpp >&5
In file included from conftest.cpp:10:
In file included from /usr/include/c++/v1/iostream:37:
In file included from /usr/include/c++/v1/ios:214:
In file included from /usr/include/c++/v1/__locale:37:
In file included from /usr/include/c++/v1/__support/openbsd/xlocale.h:13:
/usr/include/c++/v1/__support/xlocale/__strtonum_fallback.h:23:64: error: unknown type name 'locale_t'
char **endptr, locale_t) {
^
@theStack
theStack / arm_32bit_qemu.txt
Last active November 22, 2023 15:15
Running Bitcoin Core on an emulated 32-bit ARM system using qemu
# Running Bitcoin Core on an emulated 32-bit ARM system using qemu (for reproducing issue #28906 and testing the fix PR #28913)
# guide based on https://translatedcode.wordpress.com/2016/11/03/installing-debian-on-qemus-32-bit-arm-virt-board/
# tested on Ubuntu 22.04 LTS
$ sudo apt-get install qemu-system-arm libguestfs-tools
$ wget -O installer-vmlinuz http://http.us.debian.org/debian/dists/bookworm/main/installer-armhf/current/images/netboot/vmlinuz
$ wget -O installer-initrd.gz http://http.us.debian.org/debian/dists/bookworm/main/installer-armhf/current/images/netboot/initrd.gz
$ qemu-img create -f qcow2 myarmdisk.qcow2 80G
$ qemu-system-arm -M virt -m 2048 -kernel installer-vmlinuz -initrd installer-initrd.gz \
-drive if=none,file=myarmdisk.qcow2,format=qcow2,id=hd \
@theStack
theStack / check_pr28008.py
Last active July 27, 2023 01:27
Verify test vectors of #28008 by using PyCryptodome (and implementing FSChaCha20{Poly1305,}, BIP324Cipher)
#!/usr/bin/env python3
from Crypto.Cipher import ChaCha20, ChaCha20_Poly1305
def nonce_bytes(nonce32, nonce64):
return nonce32.to_bytes(4, 'little') + nonce64.to_bytes(8, 'little')
#############################################################################################
### PR #28008, commit 2/8 "crypto: add the ChaCha20Poly1305 AEAD as specified in RFC8439" ###
#############################################################################################
def test_chacha20poly1305(plain, aad, key, nonce96, cipher_with_tag_expected):
@theStack
theStack / utreexo_readme_example.go
Created April 14, 2023 12:44
utreexo README.md example, corrected
package main
import (
"crypto/sha256"
"fmt"
"github.com/utreexo/utreexo"
"os"
)
func main() {