]> Untitled Git - bdk-cli/commitdiff
Document payjoin recovery commands and SQLite setup
authorMshehu5 <musheu@gmail.com>
Mon, 16 Feb 2026 13:51:18 +0000 (14:51 +0100)
committerMshehu5 <musheu@gmail.com>
Thu, 2 Jul 2026 11:30:28 +0000 (12:30 +0100)
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.

Cargo.toml
README.md

index e5e54bb583081ce5c2b66d6cd742023c6b212edb..9c0cd57da3e62a0e26ef3344deadf2f22d10d21f 100644 (file)
@@ -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
index 624e6ba4596cb45d4fcac76050d191c2511a31c1..20d86898cdaaca2011b77e0837fc945e464485a2 100644 (file)
--- 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 <SP_CODE_1>: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 <wallet_name> resume_payjoin --directory "https://payjo.in" --ohttp_relay "https://pj.bobspacebkk.com"
+```
+
+Resume a specific session by ID:
+```
+cargo run --features rpc -- wallet --wallet <wallet_name> resume_payjoin --directory "https://payjo.in" --ohttp_relay "https://pj.bobspacebkk.com" --session_id <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 <wallet_name> 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.