Skip to content

Instantly share code, notes, and snippets.

View nothingmuch's full-sized avatar
🤔

Yuval Kogman nothingmuch

🤔
View GitHub Profile

Manifest

  • gitian-verify/
    • README.md
    • step_1/
      • verify-keys.sh
      • fingerprints.txt
      • signatures/
        • ...
  • step_2/
@fernandonm
fernandonm / bitcoin_derivatives.md
Last active May 29, 2019 08:03
Trust-minimized derivatives

Trust-minimized derivatives

Options contracts can be implemented as trust-minimized smart contracts using Bitcoin script. These contracts don't require oracles feeding the price into the blockchain or any other trusted third party. Recipients will only trust miners to mine (and not reverse) transactions paying a reasonable feerate, securing their payouts.

The underlier of these derivatives can be any digital asset available on a blockchain that can do HLTCs.

Call options

The buyer of an American-style call binary option pays a premium (eg: 0.1 BTC) for <seller secret> wich gives the right to buy Q units (quantity) of the underlying asset (100 LTC) at a specified strike price (0.016 BTC per LTC) at any time until the expiration date.

@sipa
sipa / golomb_loss.md
Last active July 30, 2023 18:25
Minimizing the redundancy in Golomb Codes Sets

Actual TPS of Bitcoin

Counting on-chain transactions alone to illustrate pretty much anything is wrong. One should take into account at least TX batching.

A possibly better way is to calculate based on new UTXOs created excluding the change outputs.

Doing rough calculations, we assume the worst case of every TX having a change output, so the results are the most pessimistic version and actual numbers are better.

Month TXs UTXOs created Net UTXOs [1] Naive TPS [2] Actual TPS [3]
@zsedem
zsedem / snapshot.sh
Last active June 7, 2022 13:48
NixOS with Btrfs
# I have 3 btrfs subvolume /root, /home, /nix-store and these are used as the name suggest
# Now, when i create new nixos configuration i can make a snapshot of root and home, before i switch to a new config.
CURRENT_GENERATION=`readlink /nix/var/nix/profiles/system | cut -d'-' -f2`; echo Determined current generation: $CURRENT_GENERATION
sudo mkdir -p /btrfs
# the / is not mounted in my btrfs filesystem by default, because my filesystem root is the /root subvolume
sudo mount /dev/mapper/NixOS /btrfs
sudo btrfs subvolume snapshot /btrfs/root /btrfs/root-$CURRENT_GENERATION-snapshot
# I also make a snapshot of home, because i use gnome or KDE, which contains a lots of config and cache, which can broke by a rollback.
sudo btrfs subvolume snapshot /btrfs/home /btrfs/home-$CURRENT_GENERATION-snapshot
@ryancdotorg
ryancdotorg / rotate_dkim.py
Last active October 27, 2023 15:22
Experimental DKIM rotate/revoke/repudiate script for Exim+Route53. I take no responsibility for its use.
#!/usr/bin/env python
import os
import grp
import sys
import stat
import time
import hmac
import boto3
import tempfile
@ageis
ageis / YubiKey-GPG-SSH-guide.md
Last active April 10, 2025 08:49
Technical guide for using YubiKey series 4 for GPG and SSH

YubiKey 4 series GPG and SSH setup guide

Written for fairly adept technical users, preferably of Debian GNU/Linux, not for absolute beginners.

You'll probably be working with a single smartcard, so you'll want only one primary key (1. Sign & Certify) and two associated subkeys (2. Encrypt, 3. Authenticate). I've published a Bash function which automates this slightly special key generation process.

@morcos
morcos / FeeEstimationHighLevel.md
Last active December 9, 2024 03:20
Bitcoin Core Fee Estimation Algorithm

High level description Bitcoin Core's fee estimation algorithm

The algorithm takes as input a target which represents a number of blocks within which you would like your transaction to be included in the blockchain. It returns a fee rate that you should use on your transaction in order to achieve this.

The algorithm is conceptually very simple and does not attempt to have any predictive power over future conditions. It only looks at some recent history of transactions and returns the lowest fee rate such that in that recent history a very high fraction of transactions with that fee rate were confirmed in the block chain in less than the target number of blocks.

Transactions can occur with a nearly continuous range of fee rates and so in order to avoid tracking every historical transaction independently, they are grouped into fee rate "buckets". A fee rate bucket represents a range of fee rates within which the algorithm treats all transactions as having approximately the same fee rate and the answer th

@AdamISZ
AdamISZ / Newcoinswap-backout.md
Last active April 3, 2023 20:17
Notes on backout / recovery of coins in coinswap proposal
@jpouellet
jpouellet / qvm-port-forward.sh
Last active February 1, 2024 12:50
Forwards a specified port to a specified VM, auto-detecting its NetVM chain. (Qubes OS)
#!/bin/sh
# Inspired by https://gist.github.com/daktak/f887352d564b54f9e529404cc0eb60d5
ip() { qvm-ls --raw-data ip -- "$1"; }
netvm() { qvm-prefs -g -- "$1" netvm; }
forward() {
local from_domain=$1
local to_domain=$2