From: Mshehu5 Date: Mon, 16 Feb 2026 13:51:18 +0000 (+0100) Subject: Document payjoin recovery commands and SQLite setup X-Git-Url: http://internal-gitweb-vhost/blockdata/script/encode/-script/display/FromScriptException.UnrecognizedScript.html?a=commitdiff_plain;h=b9ca88ff6fbd8846d9f6122a7695cc129b71ad8a;p=bdk-cli Document payjoin recovery commands and SQLite setup Update the README to cover the new `resume` and `history` commands so users can recover interrupted payjoin sessions and inspect saved session state. Also add the SQLite dependency needed for the payjoin persistence workflow. This keeps the user-facing setup and command documentation aligned with the new persistence and recovery behavior. --- diff --git a/Cargo.toml b/Cargo.toml index e5e54bb..9c0cd57 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -58,7 +58,7 @@ esplora = ["bdk_esplora", "_payjoin-dependencies"] rpc = ["bdk_bitcoind_rpc", "_payjoin-dependencies"] # Internal features -_payjoin-dependencies = ["payjoin", "reqwest", "url"] +_payjoin-dependencies = ["payjoin", "reqwest", "url", "sqlite"] bip322 = ["bdk_bip322"] # Use this to consensus verify transactions at sync time diff --git a/README.md b/README.md index 624e6ba..20d8689 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ And yes, it can do Taproot!! This crate can be used for the following purposes: - Instantly create a miniscript based wallet and connect to your backend of choice (Electrum, Esplora, Core RPC, Kyoto etc) and quickly play around with your own complex bitcoin scripting workflow. With one or many wallets, connected with one or many backends. - The `tests/integration.rs` module is used to document high level complex workflows between BDK and different Bitcoin infrastructure systems, like Core, Electrum and Lightning(soon TM). - - Receive and send Async Payjoins. Note that even though Async Payjoin as a protocol allows the receiver and sender to go offline during the payjoin, the BDK CLI implementation currently does not support persisting. + - Receive and send Async Payjoins with session persistence. Sessions can be resumed if interrupted. - (Planned) Expose the basic command handler via `wasm` to integrate `bdk-cli` functionality natively into the web platform. See also the [playground](https://bitcoindevkit.org/bdk-cli/playground/) page. If you are considering using BDK in your own wallet project bdk-cli is a nice playground to get started with. It allows easy testnet and regtest wallet operations, to try out what's possible with descriptors, miniscript, and BDK APIs. For more information on BDK refer to the [website](https://bitcoindevkit.org/) and the [rust docs](https://docs.rs/bdk_wallet/1.0.0/bdk_wallet/index.html) @@ -175,6 +175,33 @@ It's also possible to drain all balance to a silent payment wallet by using the cargo run --features electrum,sp -- --network testnet4 wallet --wallet sample_wallet --ext-descriptor "wpkh(tpubEBr4i6yk5nf5DAaJpsi9N2pPYBeJ7fZ5Z9rmN4977iYLCGco1VyjB9tvvuvYtfZzjD5A8igzgw3HeWeeKFmanHYqksqZXYXGsw5zjnj7KM9/*)" --database-type sqlite --client-type electrum --url "ssl://mempool.space:40002" create_sp_tx --send_all --to-sp :0 ``` +### Payjoin + +#### Payjoin Session Persistence + +Payjoin sessions are automatically persisted to a SQLite database (`payjoin.sqlite`) in the data directory. This allows sessions to be resumed if interrupted. Old completed sessions and stale inactive sessions older than 30 days are pruned automatically when the payjoin database is accessed. + +##### Resume Payjoin Sessions + +Resume all pending sessions: +``` +cargo run --features rpc -- wallet --wallet resume_payjoin --directory "https://payjo.in" --ohttp_relay "https://pj.bobspacebkk.com" +``` + +Resume a specific session by ID: +``` +cargo run --features rpc -- wallet --wallet resume_payjoin --directory "https://payjo.in" --ohttp_relay "https://pj.bobspacebkk.com" --session_id +``` + +Sessions are processed sequentially (not concurrently) due to BDK-CLI's architecture. Each session waits up to 30 seconds for updates before timing out. If no session ID is specified, the most recent active sessions are resumed first. + +##### View Session History + +View all payjoin sessions (active and completed) and also see their status: +``` +cargo run -- wallet --wallet payjoin_history +``` + ## Justfile We have added the `just` command runner to help you with common commands (during development) and running regtest `bitcoind` if you are using the `rpc` feature.