Skip to content

Instantly share code, notes, and snippets.

View notmandatory's full-sized avatar

Steve Myers notmandatory

View GitHub Profile
@notmandatory
notmandatory / iCal-BDK-Team-Meeting-Recurring.ics
Created November 3, 2020 21:14
BDK Team Meeting Recurring Calendar File
BEGIN:VCALENDAR
CALSCALE:GREGORIAN
VERSION:2.0
X-WR-CALNAME:BDK Team Meeting
METHOD:PUBLISH
PRODID:-//Apple Inc.//Mac OS X 10.15.7//EN
BEGIN:VEVENT
TRANSP:OPAQUE
DTEND:20201117T210000Z
RRULE:FREQ=WEEKLY;INTERVAL=2;BYDAY=TU;WKST=SU
@notmandatory
notmandatory / gh_manual_merge_pr.txt
Last active March 24, 2022 07:37
Manual merge PRs to preserve commit signatures
# from target repo clone directory
# make sure you're in sync with origin
git checkout master
git fetch --all
git pull upstream master
# fetch PR to FETCH_HEAD
git fetch upstream pull/<PR#>/head
# double check the changes
git diff master FETCH_HEAD
# merge to master and push to upstream (github)
git clone git@github.com:bitcoindevkit/BDWallet.git
cd BDWallet
git filter-repo --analyze
more .git/filter-repo/analysis/blob-shas-and-paths.txt
git filter-repo --force --invert-paths --path-glob '*.aar' --path-glob '*/mountain_cover.jpg' --path-glob '*/mountain_background.jpg' --path-glob '*/temp_graph.png'
git gc
git remote add origin git@github.com:bitcoindevkit/BDWallet.git
git push origin --force 'refs/heads/*'
## to fix fork git@github.com:notmandatory/BDWallet.git
use bdk::blockchain::compact_filters::{Mempool, Peer};
use bitcoin::Network;
use std::sync::Arc;
use bdk::bitcoin::network::constants::ServiceFlags;
use trust_dns_resolver::config::*;
use trust_dns_resolver::Resolver;
// add to [dev-dependencies] trust-dns-resolver = "^0.20"
// fix peer version timeout to 5 seconds (from None) and handle unexpected response
@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
@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 / 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 / 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 / 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"
# 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