Skip to content

Instantly share code, notes, and snippets.

@AdamISZ
AdamISZ / test_taproot_script_path.py
Created November 22, 2021 19:53
Testing script path spending in taproot with python-bitcointx
import bitcointx as btc
btc.allow_secp256k1_experimental_modules()
btc.select_chain_params("bitcoin/testnet")
from bitcointx.wallet import CCoinKey
from bitcointx.core import COutPoint, CTxIn, CTxOut, CMutableTransaction, CTxInWitness
from bitcointx.core.script import (CScript, OP_CHECKSIGADD, OP_CHECKSIG, OP_NUMEQUAL,
TaprootScriptTree, CScriptWitness)
from bitcointx.wallet import P2TRCoinAddress
from binascii import hexlify, unhexlify
@AdamISZ
AdamISZ / musig2-demo.py
Created April 25, 2021 16:24
MuSig2 toy implementation in Python for learning purposes
""" THIS CODE IS ONLY EDUCATIONAL - NO
PART OF IT IS FIT FOR PRODUCTION USE.
NO, SERIOUSLY, I MEAN IT!!
As for reading it, start with the `__main__`
section at the bottom and go from there.
Comments are, deliberately, voluminous.
If you want to run the example, just:
(a) install Joinmarket (else see the notes on import)
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active November 5, 2024 18:44
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@hrldcpr
hrldcpr / tree.md
Last active September 1, 2024 07:04
one-line tree in python

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!