Use Silent Payment address for DFX buy flow#3090
Open
TaprootFreak wants to merge 1 commit intocake-tech:devfrom
Open
Use Silent Payment address for DFX buy flow#3090TaprootFreak wants to merge 1 commit intocake-tech:devfrom
TaprootFreak wants to merge 1 commit intocake-tech:devfrom
Conversation
Enable privacy-preserving Bitcoin payouts via BIP-352 Silent Payments when buying through DFX. Wallet layer: - Add addressForPrivateBuy getter to WalletAddresses (default: addressForBuy) - Override in BitcoinWalletAddressesBase to return sp1 address when available - Extract shared signing logic into _signWithPrivateKey() helper - signMessage() signs with b_spend key when address is sp1 Provider layer: - DFX buy action uses addressForPrivateBuy for Bitcoin wallets - Sell and non-Bitcoin flows remain unchanged - Other providers (MoonPay, Robinhood, etc.) are unaffected Hardware wallets automatically fall back to P2WPKH (no silentAddress).
e67c3ce to
1e2a2c1
Compare
OmarHatem28
reviewed
Mar 24, 2026
Contributor
OmarHatem28
left a comment
There was a problem hiding this comment.
Looks good, thanks for making the necessary changes.
But I would argue about making SP the default, since silentAddress will have a value regardless of whether the user enabled SP scanning or not, so technically, all users who have a bitcoin wallet, have their SP address already generated, but they might not be using SP or even know what it is, and having the buy flow use that, would result in users not finding their funds, and reach out to support, and support tell them to scan using SP, and explain what is SP, and so on.
so, I would rather it be a good privacy option for people who knows what they are doing, but not the default.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
addressForPrivateBuyproperty toWalletAddressesbase class (default:addressForBuy)BitcoinWalletAddressesto return Silent Payment (sp1) address when available, fallback to P2WPKHsignMessage()usesb_spendkey when signing for ansp1addressaddressForPrivateBuyfor Bitcoin buy actions — other providers (MoonPay, Robinhood, Onramper) unaffectedsilentAddressavailable → automatic fallback to P2WPKHContext
Companion PR to DFXswiss/api#3426 which adds
sp1address recognition and signature verification on the DFX API side. Together they enable privacy-preserving Bitcoin payouts via BIP-352 Silent Payments.Changed files
cw_core/lib/wallet_addresses.dart— newaddressForPrivateBuygettercw_bitcoin/lib/bitcoin_wallet_addresses.dart— SP overridecw_bitcoin/lib/electrum_wallet.dart—signMessage()SP pathlib/buy/dfx/dfx_buy_provider.dart— useaddressForPrivateBuyfor buyTest plan
sp1address in Cake Wallet and DFX APIb_spendkey verified by DFX API verification logic