Skip to content

Instantly share code, notes, and snippets.

@luisschwab
luisschwab / op-return-builder.py
Last active October 14, 2024 17:07
add an OP_RETURN output to a PSBT
#!/usr/bin/python3
'''
this script takes in an PSBT and adds an
OP_RETURN output (OP_RETURN OP_PUSHDATA1 <len(message)> <message>)
with the chosen message payload
usage:
interactive:
./op-return-builder.py
'''
A simple example illustrating
message signing and signature
verification using secp256k1
'''
import coincurve
import hashlib
# order of the finite field in secp256k1
@luisschwab
luisschwab / nostr-keygen.py
Last active March 15, 2023 20:52
nostr key generator
#!/usr/bin/python3
'''
usage:
trusted:
./nostr-keygen.py (will generate a private key)
trustless:
./nostr-keygen.py <32 byte hex privkey> (will derive the pubkey)
./nostr-keygen.py "$(openssl rand -hex 32)"