Skip to content

Add experimental silent payment transaction creation support#220

Open
nymius wants to merge 10 commits intobitcoindevkit:masterfrom
nymius:feat/sp-psbt-send
Open

Add experimental silent payment transaction creation support#220
nymius wants to merge 10 commits intobitcoindevkit:masterfrom
nymius:feat/sp-psbt-send

Conversation

@nymius
Copy link

@nymius nymius commented Sep 10, 2025

Description

This PR adds experimental support for creating silent payment transactions through a new CreateSpTx command. The implementation integrates the bdk_sp crate to enable sending Bitcoin to silent payment addresses.

Key changes:

  • Adds bdk_sp dependency as an optional feature
  • Implements CreateSpTx command with support for silent payment recipients
  • Includes parser for silent payment address:amount pairs
  • Returns signed transactions ready for broadcast (not PSBTs due to silent payment derivation constraints)

Notes to the reviewers

  • This feature is marked as EXPERIMENTAL and includes warnings against mainnet use
  • The command returns signed transactions directly rather than PSBTs because silent payment script pubkey derivation cannot be performed securely in a trustless manner with standard PSBT workflows
  • RBF is disabled for silent payment transactions (sequence set to MAX)
  • The implementation handles both single key and extended key signers
  • Error handling uses temporary .expect() calls that should be addressed in future iterations

Changelog notice

Added: Experimental silent payment transaction creation via CreateSpTx command (feature-gated behind sp flag)

Checklists

All Submissions

New Features

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

  • I've added docs for the new feature

@nymius nymius requested review from notmandatory and tvpeter and removed request for notmandatory September 10, 2025 19:39
Copy link
Collaborator

@tvpeter tvpeter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for working on adding this feature @nymius,

I couldn't test because I don't know how to construct sp recipients. I will check the documentation on the library and will come back to test it. In the meantime, I have left some comments.
Thank you

nymius added 10 commits November 3, 2025 14:39
…actions

Add experimental silent payment sending capabilities with new CreateSpTx
command. This command creates signed transactions directly rather than
PSBTs due to current limitations in secure shared derivation.

- Add bdk_sp dependency with "sp" feature flag
- Implement CreateSpTx subcommand for offline wallet operations
- Add silent payment recipient parsing utility
- Support mixed recipients (regular addresses + silent payments)
- Generate signed transactions ready for broadcast
- For the moment is not possible to enable RBF for the created
  transactions.

Note: This is experimental functionality for testing only, not
recommended for mainnet use.
The input for this command are two compressed public keys.

The network is obtained from the wallet current network.

The silent payment code generated is independent from any of the other
stateful features of bdk-cli.

This command is mainly intended for experimental use, do not lock any
funds to the generated code if you don't know what you are doing and
don't have the keys matchin the public keys used.
@nymius nymius force-pushed the feat/sp-psbt-send branch from bc40b76 to 8d15df7 Compare November 4, 2025 14:12
@nymius nymius requested a review from tvpeter November 4, 2025 14:12
Copy link
Collaborator

@tvpeter tvpeter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for working on this feature @nymius

I left a few comments.

Pls remember to rebase too.

#[error("Create transaction error: {0}")]
CreateTx(#[from] bdk_wallet::error::CreateTxError),

#[error("Silent payment address decoding error: {0}")]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#[error("Silent payment address decoding error: {0}")]
#[cfg(feature = "sp")]
#[error("Silent payment address decoding error: {0}")]

Comment on lines +366 to +368
if send_all {
tx_builder.drain_wallet().drain_to(recipients[0].0.clone());
} else {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to drain to an SP address? if so, it will be great to cover that as well.

Comment on lines +467 to +470
for psbt_input in psbt.inputs.iter_mut() {
psbt_input.final_script_sig = None;
psbt_input.final_script_witness = None;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't it be ideal to check if they were actually finalized before resetting?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants