Skip to content

Instantly share code, notes, and snippets.

View johnzweng's full-sized avatar

Johannes Zweng johnzweng

View GitHub Profile
@johnzweng
johnzweng / nostr_proof.txt
Created December 9, 2024 16:11
My NOSTR public key
Verifying that I control the following Nostr public key: npub1pzglxuz9crnkzep8tf4z0f7qd0jckr7upar4cx447gck5nhgw3vsckv25p
@johnzweng
johnzweng / ECDSA-sig-proof-no-key.md
Last active October 13, 2024 08:33
ECDA Signature that proves that I don't know the private key ;-)

A small ECDSA riddle.. ;-)

Message:

**********************************************************************

With this signed message, I, johnzweng, prove that I am NOT in possession of the private key of the signing address.

Not only do I claim this, no, this signed message proves this fact cryptographically beyond doubt. I have created this signature without outside help, yet I cannot know the private key of the signing address mentioned below.
@johnzweng
johnzweng / ECDSA_signature_without_private_key.sage
Created October 10, 2024 20:43
Demo how to generate an ECDSA signature without knowledge of private key (in SageMath)
import hashlib
# ECDSA Signature without private key
# An ECDSA signature without prior commitment to the signer's key
# does not prove that the signer knows the private key
# of the pubkey for which the signature validates.
# A short demonstration:
@johnzweng
johnzweng / export_testnet_difficulty_adjustments.sh
Created April 30, 2024 13:10
Export difficulty adjustments in testnet from BTC testnet node
#!/bin/bash
# Description:
# Analyze testnet difficulty changes.
# This script iterates over the blocks and exports blockheight, time, mediantime,
# difficulty, bits and blockhash for all blocks around difficulty adjustments
# (5 blocks before and 5 blocks afterwards).
#
# Author: John Zweng,30.04.2024
@johnzweng
johnzweng / New signs of satoshi.md
Last active November 18, 2024 03:14
Some technical facts around the story about the message allegedly signed by Hal Finney about Paul Le Roux being Satoshi.

New signs of Satoshi?

A few days ago, another sensationalist news story emerged, promising new clues regarding the true identity of Satoshi Nakamoto: Allegedly, an old message signed by Hal Finney had surfaced (published by Martin Shkreli in this blog post), suggesting that Paul Le Roux was the person behind the synonym of Satoshi Nakamoto.

I briefly highlight the facts surrounding this story:

The signed message:

Right away, yes indeed, a valid signed message has surfaced:

@johnzweng
johnzweng / SEC_2_Prime_order_koblitz_curves_generators_mystery.sage
Last active October 17, 2024 16:48
The mystery of the generation points of the secpXXXk1 curves.. :)
# The mystery around secpxxxk1 generation points :)
# -------------------------------------------------
#
# The SEC 2 familiy of elliptic curves are defined in https://www.secg.org/sec2-v2.pdf
# and widely used in cryptography.
#
# The generation points G of these curves are defined in the standard paper without any nearer
# explanation how they were chosen. Interestingly the generation points (G) of all prime order
# koblitz curves of the SEC 2 family (secp160k1, secp192k1, secp224k1, secp256k1) share some
# unusual mysterious property.
@johnzweng
johnzweng / BitcoinVersioning.md
Created August 6, 2021 05:55 — forked from gavinandresen/BitcoinVersioning.md
Suggestions on more smoothly rolling out blockchain validation rule changes

Blockchain Rule Update Process

We recently rolled out two changes to the Bitcoin block acceptance rules (BIP16 and BIP30); this document records the lessons learned and makes recommendations for handling future blockchain rule changes.

Note: there are "soft" rule changes and "hard" rule changes. "Soft" changes tighten up the rules-- old software will accept all the blocks and transactions created by new software, but the opposite may not be true. "Soft" changes do not require the entire network of miners and merchants and users to upgrade or be left behind.

"Hard" changes modify the rules in a way that old, un-upgraded software consider illegal. At this point it is much, much more difficult (some might say impossible) to roll out "hard" changes, because they require every miner and merchant and user to upgrade.

Lessons Learned

@johnzweng
johnzweng / check_taproot_signalling.sh
Created June 11, 2021 10:19
Check Taproot Signalling
#!/bin/bash
#
# This shell script allows you to check the Taproot signalling on your own
# Bitcoin fullnode (i.e. it does what https://taproot.watch/ does, but
# verified by your own node).
#
# Be a self-sovereign Bitcoiner!
#
# DON'T TRUST, VERIFY! :-)
@johnzweng
johnzweng / remap_keys.sh
Last active November 13, 2020 06:32
Remap key codes on macOS
#!/usr/bin/env bash
#
# Remap some keys on macOS (>=Sierra)
#
# Johnny, 2.11.2020
#
# Sources: based on https://gist.github.com/zbstof/6cba7d54e105cc5148c8a943d1581cad
#
@johnzweng
johnzweng / require_password_on_next_unlock.sh
Last active December 7, 2022 04:07
Require password for next unlock (disable touch-id for next unlock) – macOS
#!/bin/bash
# require_password_on_next_unlock.sh:
# -----------------------------------
# Johannes Zweng, 8.11.2020
#
# Disable and enable global touch id unlock on macOS.
#
# After re-enabling unlock by touch-id, macOS will ask for
# password on the first unlock event (which is exactly what we want). :-)