Skip to content

silent payments: add sending support (correction) - #68

Closed
pzafonte wants to merge 1 commit into
kernel-node:masterfrom
pzafonte:sp-send-to-address
Closed

silent payments: add sending support (correction)#68
pzafonte wants to merge 1 commit into
kernel-node:masterfrom
pzafonte:sp-send-to-address

Conversation

@pzafonte

Copy link
Copy Markdown
Contributor

I had an intermittent network issue, and my last commits from #64 didn't get pushed up.

Restating this, but this commit should resolve the following from that PR:

  • I changed coin selection to single random draw, which greatly simplifies things for the time being, and changed weight conversion to from_vb_unchecked.
  • Each input's signature is now verified against the output it spends before the transaction is returned, which partially addresses pre-broadcast validation by catching faulty signing but not whether the transaction is otherwise valid in other ways.

@yancyribbens

Copy link
Copy Markdown
Contributor

No problem, that's why we review. Also, @rustaceanrob, if I happen to do a review, would it be possible to hold of on merging until I've had a chance to see if the changes are good?

I'll plan to look over these changes more tomorrow. It's getting late here and I don't think this is super urgent tonight?

@rustaceanrob

Copy link
Copy Markdown
Contributor

Needs rebase

@rustaceanrob

Copy link
Copy Markdown
Contributor

if I happen to do a review, would it be possible to hold of on merging until I've had a chance to see if the changes are good?

Sure. The PR cycles should slow down now that we have the basis for a silent payments wallet. Also, I figured you may want to put your own pull requests up in your areas of interest. For now I think we should move on to testing.

Spending a received output needs its spend secret plus the tweak recorded
when the coin was scanned. Store the spend secret in the even Y form the
receiver derives against, so the secret plus the tweak reconstructs each
coin key.

Add build_transaction, which selects coins, builds the recipient and
change outputs, and signs each input as a taproot key spend. Each
signature is verified against the output it spends, so a faulty key
reconstruction fails here rather than as a rejected broadcast. The
recipient may be a silent payment or a normal bitcoin address, the
locktime follows the chain tip to discourage fee sniping, and selected
coins are reserved so a later spend cannot reuse them.

Coin selection uses single random draw from bdk_coin_select, which needs
no fee estimate. A more optimal selection algorithm can replace it once
long term fee estimation exists.
@yancyribbens

Copy link
Copy Markdown
Contributor

Also, see: #70

@yancyribbens

Copy link
Copy Markdown
Contributor

I changed coin selection to single random draw, which greatly simplifies things for the time being, and changed weight conversion to from_vb_unchecked.

FYI it looks like BDK is now adding SRD algo here: bitcoindevkit/coin-select#50

@yancyribbens

Copy link
Copy Markdown
Contributor

Anyway, I think this can be closed in light of #77

@pzafonte

Copy link
Copy Markdown
Contributor Author

Anyway, I think this can be closed in light of #77

It would supersede this in large part so I'll just stick this in draft status until #77 merges, and then close it out.

@pzafonte
pzafonte marked this pull request as draft July 17, 2026 15:59
@yancyribbens

Copy link
Copy Markdown
Contributor

Each input's signature is now verified against the output it spends before the transaction is returned, which partially addresses pre-broadcast validation by catching faulty signing but not whether the transaction is otherwise valid in other ways.

Not sure if you and Rob still want this change, but it could be a separate PR and commit.

@pzafonte pzafonte closed this Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants