Skip to content

Instantly share code, notes, and snippets.

View notmandatory's full-sized avatar

Steve Myers notmandatory

View GitHub Profile
@notmandatory
notmandatory / gist:7846a6023627ea8c0a4b646f643ec73f
Last active April 15, 2024 18:51
How to import bdk descriptor into core wallet
echo create temp diretory to store bitcoind data
mkdir -p /tmp/regtest1/bitcoind

echo start bitcoind in regtest mode
bitcoind -datadir=/tmp/regtest1/bitcoind -regtest -server -fallbackfee=0.0002 -rpcallowip=0.0.0.0/0 -rpcbind=0.0.0.0 -blockfilterindex=1 -peerblockfilters=1 -daemon

echo create blank descriptor wallet
bitcoin-cli -datadir=/tmp/regtest1/bitcoind -regtest -named createwallet wallet_name="regtest1" blank=true disable_private_keys=true
{
@notmandatory
notmandatory / gist:6fa85dd942089833629bdb40d2b54858
Last active December 28, 2023 18:45
BDK rpc cli setup and testing

Some notes on my manual rpc cli setup and testing:

  1. start bitcoind in regtest mode
mkdir /tmp/bitcoind
bitcoind -datadir=/tmp/bitcoind -regtest -server -fallbackfee=0.0002 -rpcallowip=0.0.0.0/0 -rpcbind=0.0.0.0 -blockfilterindex=1 --peerblockfilters=1 -daemon
  1. create bitcoind test wallet and generate blocks
bitcoin-cli -datadir=/tmp/bitcoind -regtest createwallet "test"
@notmandatory
notmandatory / ppmsss.md
Last active July 25, 2023 13:45
Privacy preserving multi-sig signing service

Privacy preserving multi-sig signing service

Problem

Create a signing service that when properly authorized will add valid signatures to a client's PSBT without knowing the client's full wallet history. The signing service must be able to determine the transaction spending amount. The client must be able to sign and finalize a transactions independently of the service.

Solution

  1. For each client the signing service creates a signing bip39 xprv key and shares the corresponding xpub with the client's software. The signing service does not need to share any root key information with the client except the key fingerprint. Example:
@notmandatory
notmandatory / gist:a7cade3468e90c699037292123a1ca1a
Last active April 26, 2023 20:19
Create core descriptor wallet
# install bitcoind via your favorite method
# start regtest bitcoind
mkdir -p /tmp/regtest1/bitcoind
bitcoind -datadir=/tmp/regtest1/bitcoind -regtest -server -fallbackfee=0.0002 -rpcallowip=0.0.0.0/0 -rpcbind=0.0.0.0 -blockfilterindex=1 -peerblockfilters=1 -daemon
# cookie file location: /tmp/regtest1/bitcoind/regtest/.cookie
# create test bitcoind wallet
bitcoin-cli -datadir=/tmp/regtest1/bitcoind -regtest -named createwallet wallet_name="regtest1" disable_private_keys=true blank=true
# install bitcoind via your favorite method
# start signet bitcoind
mkdir -p /tmp/signet1/bitcoind
bitcoind -datadir=/tmp/signet1/bitcoind -signet -server -fallbackfee=0.0002 -rpcallowip=0.0.0.0/0 -rpcbind=0.0.0.0 -blockfilterindex=1 -peerblockfilters=1 -daemon
# cookie file location: /tmp/signet1/bitcoind/signet/.cookie
# get blockchain info
bitcoin-cli -datadir=/tmp/signet1/bitcoind -signet getblockchaininfo
@notmandatory
notmandatory / gist:e3bd0c36264744c948edd3d50a024f51
Last active February 11, 2023 21:14
bdk_core manual testing
# install bitcoind via your favorite method
# start regtest bitcoind
mkdir -p /tmp/regtest1/bitcoind
bitcoind -datadir=/tmp/regtest1/bitcoind -regtest -server -fallbackfee=0.0002 -rpcallowip=0.0.0.0/0 -rpcbind=0.0.0.0 -blockfilterindex=1 -peerblockfilters=1 -daemon
# cookie file location: /tmp/regtest1/bitcoind/regtest/.cookie
# create test bitcoind wallet
bitcoin-cli -datadir=/tmp/regtest1/bitcoind -regtest createwallet "regtest1"
@notmandatory
notmandatory / gist:e427dd478b026f9773fad1369857e768
Last active January 9, 2023 17:01
local regtest bitcoind bdk testing
# start regtest bitcoind
mkdir -p /tmp/regtest1/bitcoind
bitcoind -datadir=/tmp/regtest1/bitcoind -regtest -server -fallbackfee=0.0002 -rpcallowip=0.0.0.0/0 -rpcbind=0.0.0.0 -blockfilterindex=1 -peerblockfilters=1 -daemon
# generate keys and create test descriptor
cargo run --features rpc -- key generate
ALICE_KEY=tprv8ZgxMBicQKsPec2RXKZgdJhFsnm2s4xZvYXaaUzcyr3ybx9L2kCTtGAjYjAEuT1aPoLapD6M5Zrk99u4xHZf2NbdPT2X7zsu5qoWmSxoiVC
BOB_KEY=tprv8ZgxMBicQKsPfKtuWgVHdn5C1AJvXgSTPJqyCfAa5aCxFutmCnxS8DRT8Cyni4mk4NDes5Cpqb93RLsjy9a7ZXEw4sZDZ6Xpk3vpgYsiH22
DESC="wsh(multi(2,$ALICE_KEY/*,$BOB_KEY/*))"
@notmandatory
notmandatory / tr_wallet_test.md
Last active April 25, 2023 03:08
Creating a regtest taproot descriptor wallet with bitcoind

This gist demonstrates how to create a bitcoind wallet that is based on pay to taproot (P2TR) descriptors.

Tools used:

  • docker with image bitcoindevkit/bitcoind:v22.0rc2
  • bitcoin dev kit cli, bdk-cli

About bech32 vs bech32m addresses

Steps:

  1. Create aliases to work with bitcoind docker image
@notmandatory
notmandatory / build-ldk-java-bindings.md
Last active August 19, 2021 09:05
Steps to build LDK java bindings

How-to build LDK java bindings

Build LDK C bindings

  1. Clone rust-lightning git repo2.

  2. Install clang-12 and set it as the default version

    linux Ubuntu install and set it as the default version

    macos

@notmandatory
notmandatory / fmt_rust_doc_code.txt
Last active March 9, 2021 00:46
Format code in rust docs
cargo +nightly fmt -- --config format_code_in_doc_comments=true