feat: P2BK #1253
No reviewers
Labels
No labels
DB & Storage
Deployment
Error Handling & Logging
Maintenance
Payment Backend
backport
backport v0.13.x
backport v0.14.x
backport v0.15.x
bindings
blocked
bug
cdk-sql
ci
cli
deps
documentation
duplicate
enhancement
good first issue
help wanted
invalid
keep-open
ldk-node-ui
migrations
mint
mutation-testing
needs rebase
needs review
new nut
nut change
question
ready
rust-version
rustfmt
stacked hold
stale
testing
wallet
weekly-report
wontfix
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
cashubtc/cdk!1253
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "blinded-p2pk"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Pay-to-Blinded-Key (P2BK) Implementation for Enhanced Privacy
Overview
This PR implements NUT-28: Pay-to-Blinded-Key, a privacy enhancement for P2PK (NUT-11) transactions that enables "silent payments" in Cashu. P2BK allows tokens to be locked to a public key without exposing which public key they're locked to, even to the mint itself.
Key Features
Technical Implementation
User-Facing Changes
use_p2bkoption to the wallet's send operations to toggle P2BK functionalityChecklist
just final-checkbefore committingIs there a way to do
Option<&dk_common::nuts::nut11::Conditions>Nice just noticed one thing.
I think we're updating the index in the wrong spot here and it should only be done after the loop so the refund can see it. The pubkeys gets increment by idx incrementing it in the loop causes a slot to get skipped. See the below test that fails with the current implementation but passes with the suggested fix.
@ -0,0 +37,4 @@use crate::nuts::nut01::{PublicKey, SecretKey};// Create a static SECP256K1 context that we'll use for operationsstatic SECP: LazyLock<Secp256k1<bitcoin::secp256k1::All>> = LazyLock::new(Secp256k1::new);Not really a comment on this PR but more note to sell. Currently we use secp from bitcoin whitch is an older version then available if we had it as a direct dep, in newer version they removed the context so we should not have to do this. I'm not sure if we use anything else from bitcoin (besides hashes) and should keep doing it this way or we just use it to get secp and should use use that directly.
I've fixed this issue and included the test
Please note: keyset id has now been removed from the blinding factor calculation in the NUT spec.
Is also now tentatively renamed NUT-28, as BECH32 PR was merged first.
Payment request support has been removed from the spec for now
@ -0,0 +1,207 @@//! # Pay-to-Blinded-Key (P2BK) Implementationkeyset_id was removed in latest spec
@ -150,7 +150,7 @@ impl<'a> ReceiveSaga<'a, Initial> {.unwrap_or_default()Some ai comments we should remove
We're in the wallet mod so I don't think we need the feature flag here.
@ -301,2 +337,4 @@// P2BK requires ephemeral keys which is handled at creation.blinded_message.sign_p2pk((**signing_key).clone())?}}We should probably put the new argument at the end. It maybe worth creating a SwapOptions struct to reduce the number or augments on the swap fn, but that can be a separate pr.
Should we add the SecretKeys to the PreSwap struct instead of a tuple?
@ -150,7 +150,7 @@ impl<'a> ReceiveSaga<'a, Initial> {.unwrap_or_default()yes