Skip to content

Conversation

nymius
Copy link
Collaborator

@nymius nymius commented Oct 20, 2025

Description

Include the material prepared for TABConf7 workshop workshop Adding silent payments support to BDK.

Includes:

  • A README file explaining the setup of the environment.
  • 4 playbooks targeting different scenarios to show how to follow the workshop.
  • A justfile with recipes used by 3 of the 4 scenarios.
  • A flake.nix (and the corresponding lock) used to setup the environment with nix.
  • A presentation doing a step by step follow up of the workshop with details about the implementation in BDK.
  • Extra changes in the upstream crates coming up from the discovery of issues or room for improvements during the development of the workshop.

The workshop allows the execution of the following flow in regtest and signet:

  1. Setup
  2. Fund bdk-cli wallet
  3. Create a silent payment output
  4. Find a silent payment output
  5. Fund a transaction with a silent payment output
  6. Verify a silent payment change output
  7. Spend a silent payment output

Changelog notice

Checklists

New Features:

* [ ] I've added tests for the new feature
* [ ] I've added docs for the new feature

nymius and others added 30 commits October 18, 2025 12:39
Fix the trap command in the `cli/justfile` by quoting the "just stop" command.

This ensures the entire command is passed as a string to the trap,
preventing it from being split into separate arguments which could cause
the trap to malfunction when signals are received.
Pass an empty configuration file to bitcoin-cli to prevent it from
automatically loading any system-wide bitcoin.conf file.

This ensures that multiple bitcoind instances running on the same system
remain isolated from each other, avoiding configuration conflicts. The
commit also explicitly specifies connection parameters (-rpcconnect and
-rpcport) to ensure proper connection to the intended regtest instance.
Update the CLI to use the new SelectorParams API with DrainWeights. This
replaces the previous ChangeDescriptor::Manual approach with separate
parameters for change script and weight information, providing a more
flexible and explicit way to define transaction parameters for coin
selection.
…lter

The commit fixes a logic issue in the `apply_block_with_filter` function
where the filter was only applied to transactions that had partial
secrets.

This bug ruled out the indexing of changeless transactions spending
silent payment outputs owned by the wallet, but sending funds to non
taproot addresses. Those transacions have available inputs for shared
secret derivation according to BIP 352 (the silent payment output spend
by this transactions is a valid P2TR key path spend), but there aren't
any P2TR outputs on them, so any implementation using tweaks as proxy to
decide which transactions to scan, are going to miss these transactions.

Now the filter is applied to all transactions regardless of whether they
have partial secrets, ensuring that all transactions meeting the filter
criteria are properly indexed in the graph.
This functionality is needed to allow sp wallets to identify which
indexed script public keys have not been spent in transactions, enabling
better tracking and management of wallet transaction history.
Updates the BlindbitSubscriber to accept unspent script pubkeys and
includes them in the filter matching process.

This ensures the subscriber can properly detect matches against unspent
outputs, not just all script pubkeys. Previously, the code was only
checking against the script pubkeys extracted from a collection,
potentially missing relevant matches from unspent outputs in the wallet.
Adds an optional `height` parameter to the `scan-cbf` command that
allows specifying a custom height for the scan operation. When provided,
this value is used directly as the sync height. When not provided, the
sync height defaults to either the chain tip height or the wallet
birthday height, maintaining the previous behavior.

This change enables users to scan at specific blockchain heights on
demand.
This lockfile ensures consistent and reproducible builds for the
sp-cli2 tool.
Add the `--workspace` flag to the build recipe in the justfile to ensure
all packages in the workspace are built when running `just build`.

This makes the build command more consistent with the intended behavior,
which is to build the entire project workspace except for the excluded
`sp_fuzz` package.
Allow setting the database path through the DB_PATH environment
variable. If the variable is not set, the application falls back to the
default path ".bdk_example_silentpayments.db". This change makes the
database location configurable without requiring code changes allowing
the use of multiple database paths for different sp-cli2 wallets.
Modify the BlindbitSubscriber to continue processing when a request for
tweaks fails, instead of crashing with an unwrap(). This ensures that
temporary failures in tweak requests don't halt the entire subscriber
process.
Add support for regtest environment in scan-cbf CLI command by
implementing network-specific peer configuration.

This enables testing and development in regtest environments where local
Bitcoin nodes are used instead of remote peers.
Removes the network parameter from BlindbitClient's constructor and its
usage in the URL path construction.

This simplifies the client implementation by removing unnecessary
network-specific URL path modification, as the service endpoint should
handle network differentiation on its own rather than through URL paths.
Ensures blocks are indexed even when no partial secrets are found (i.e.,
when the block contains no p2tr outputs). Previously, blocks without
partial secrets were skipped, potentially missing relevant transactions.
This change ensures that all relevant blocks are properly processed
regardless of the presence of partial secrets.

This is similar to the bug that 4bd6c13
fixed.

That bug ruled out the indexing of changeless transactions spending
silent payment outputs owned by the wallet, but sending funds to non
taproot addresses. Those transacions have available inputs for shared
secret derivation according to BIP 352 (the silent payment output spend
by this transactions is a valid P2TR key path spend), but there aren't
any P2TR outputs on them, so if the tweak server is skipping
transactions not containing P2TR output, any implementation using tweaks
as proxy to decide which transactions to scan, are going to miss these
transactions.
Modified the BlindbitSubscriber to handle errors from client.tweaks() by
returning an empty vector of tweaks instead of None. This ensures the
stream continues processing even when API calls fail, preventing the
stream from terminating early when encountering network errors during
tweak retrieval.
The commit adds a clarifying comment in the BlindbitSubscriber
implementation explaining why unspent script pubkeys are only included
when scanning for tweaks.

These unspent script pubkeys must be checked alongside other script
pubkeys because they must be used for shared secret derivation, so can
only exist in blocks containing tweaks.
…eight

This provides more precise tracking of the synchronization point by
storing both the height and the hash of the block.

Changes include:
- Updated SpWallet struct to use BlockId for birthday
- Modified CLI commands to accept both height and hash parameters
- Adapted ScanCbf command to work with the new birthday structure
- Updated wallet creation to construct a BlockId from height and hash
Updates the codebase to use the renamed `bip157` crate which replaces
the `kyoto-cbf` crate.

The change includes:
- Replacing the `kyoto-cbf` dependency with `bip157` in Cargo.toml
- Updating module imports from `kyoto` to `bip157`
- Adapting function calls and types to match the new API
- Updating client initialization code and event handling
…reate

Removes default values from the height and hash parameters in the
ScanCbf and Create commands.
Adds a new Birthday command to the sp-cli2 tool that displays the
wallet's birthday block height and hash in JSON format. This information
is useful for wallet recovery and synchronization as it represents the
earliest block that needs to be scanned for wallet transactions.
Reduce the number of trusted peers for signet network from 3 to 1.

This change also updates the required_peers value from 2 to 1 to allow
faster synchronization.
Add support for specifying an additional peer when using the ScanCbf
command via the new --extra_peer option.

This allows users to connect to a custom peer beyond the default peers
configured for regtest and signet networks.
This commit introduces a Nix flake configuration to build the sp-cli2
application.

The flake sets up a reproducible build environment using the stable Rust
toolchain, configures package metadata, and defines both a development
shell and a default package for sp-cli2.
The flake sets up a reproducible development environment with all
necessary tools including Bitcoin Core, bdk-cli, sp-cli2, and supporting
utilities.

It configures two development shells: a default workshop shell that
initializes a Bitcoin signet node with required directories and
environment variables, and a debug shell for troubleshooting.

The environment simplifies workshop participation by ensuring all
participants have identical tooling regardless of their operating
system.
This commit adds a justfile to the TABConf7 workshop directory that
provides a complete regtest environment setup. The file includes
commands for:

- Creating and managing podman containers with Bitcoin Core and
  supporting services
- Initializing wallets for BDK and Silent Payments
- Managing container lifecycle (start/stop/cleanup)
- Mining blocks and interacting with the Bitcoin Core RPC
- Accessing logs from various services
- Connecting to Esplora, Frigate, Blindbit and a block explorer

The justfile allows participants to quickly launch a local Bitcoin
regtest network with all necessary tools on a sigle container.
Add script files that guide users through setting up and using silent
payments with BDK in different environments (regtest, signet, non-nix).
The playbooks provide step-by-step instructions to:

1. Set up the environment
2. Fund wallets
3. Create silent payment outputs
4. Find and verify silent payment outputs
5. Create and broadcast transactions with silent payments
6. Verify change outputs
7. Spend silent payment outputs

Also includes an interactive auto-playbook script that walks users
through each step with colored output and guidance. These scripts serve
as educational tools for the TabConf7 workshop on silent payments
implementation.
The document provides essential information for workshop participants,
including:

- Safety notice regarding signet/regtest usage only
- Workshop organization into 7 stages
- Details on available playbooks based on user environments
- Installation requirements for different setup options
- FAQs for common issues participants might encounter

This documentation ensures workshop participants can prepare and follow
the correct procedures during the session.
The slides cover background information, an interactive workshop for
using silent payments with BDK, technical explanations of the
implementation, challenges faced, and next steps for further
development.

The presentation demonstrates how to spend to silent payment addresses,
scan for received payments, derive silent payment outputs, verify change
outputs, and spend silent payment UTXOs using various command-line
tools.
@nymius nymius self-assigned this Oct 20, 2025
@nymius nymius added the documentation Improvements or additions to documentation label Oct 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants