bitcoindevkit / blog-comments

Blog comments from https://bitcoindevkit.org/blog
1 stars 0 forks source link

blog/2020/11/descriptors-in-the-wild/ #1

Open utterances-bot opened 3 years ago

utterances-bot commented 3 years ago

Descriptors in the wild :: Bitcoin Dev Kit

Guide to setup a 2-of-2 multisig using Bitcoin Core and BDK

https://bitcoindevkit.org/blog/2020/11/descriptors-in-the-wild/

scgbckbone commented 3 years ago

great article! I was wandering how can one create psbt with repl? Looking for procedure to do the same as walletcreatefundedpsbt and walletprocesspsbt in core. Thanks

afilini commented 3 years ago

The complete interface is documented at https://bitcoindevkit.org/repl/interface/

Specifically, there's the create_tx command that can be used to create a psbt and then the sign command to sign.

scgbckbone commented 3 years ago

if anyone is interested how to do it other way around (create PSBT in BDK and finalize it in core):

export psbt=$(repl -d "$BDK_rec_desc_chksum" -c "$BDK_chg_desc_chksum" -n testnet -w $BDK_fingerprint create_tx --to mkHS9ne12qx9pS9VojpwU5xtRd4T7X7ZUt:500000|jq -r '.psbt')
export psbt=$(repl -d "$BDK_rec_desc_chksum" -c "$BDK_chg_desc_chksum" -n testnet -w $BDK_fingerprint sign --psbt $psbt|jq -r '.psbt')
bitcoin-cli -testnet -rpcwallet=multisig2of2withBDK sendrawtransaction $(bitcoin-cli -testnet -rpcwallet=multisig2of2withBDK finalizepsbt $(bitcoin-cli -testnet -rpcwallet=multisig2of2withBDK walletprocesspsbt $psbt | jq -r '.psbt') | jq -r '.hex')

Thanks again for this brilliant piece! Also you forgot to remove backticks from two code snippets: here

export BDK_rec_desc="wsh(multi(2,$BDK_xprv/84'/0'/0'/0/*,$core_xpub_84_for_rec_desc))"`

and here

repl -d "$BDK_rec_desc_chksum" -c "$BDK_chg_desc_chksum" -n testnet -w $BDK_fingerprint get_new_address`
notmandatory commented 3 years ago

This article has been updated to use bdk-cli instead of ku to generate keys, thanks @vmenond !