Skip to content

Feat/silentpayments dleq multisigner - #142

Open
Sosthene00 wants to merge 13 commits into
masterfrom
feat/silentpayments-dleq-multisigner
Open

Sosthene00 wants to merge 13 commits into
masterfrom
feat/silentpayments-dleq-multisigner

Conversation

@Sosthene00

Copy link
Copy Markdown
Collaborator
  • Add BIP-374 DLEQ-backed PartialSenderEcdhShare and GlobalSenderEcdhShare for multi-signer flows.
  • Add TransactionSharedSecret::new_from_global_share and new_from_partial_shares with vin coverage checks.
  • Introduce dleq-native / dleq-standalone feature flags via rust-dleq; legacy PartialSecret API retained.

@Sosthene00
Sosthene00 force-pushed the feat/silentpayments-dleq-multisigner branch from b1a2c81 to 269918b Compare June 23, 2026 13:22
@Sosthene00
Sosthene00 force-pushed the feat/silentpayments-dleq-multisigner branch from 269918b to a0cc0da Compare July 22, 2026 11:13
@Sosthene00
Sosthene00 force-pushed the feat/silentpayments-dleq-multisigner branch 3 times, most recently from d679ca4 to 6744fd8 Compare August 12, 2026 10:36
@Sosthene00
Sosthene00 force-pushed the feat/silentpayments-dleq-multisigner branch 3 times, most recently from 822abfb to e4cc145 Compare August 26, 2026 11:35
@Sosthene00
Sosthene00 force-pushed the feat/silentpayments-dleq-multisigner branch 3 times, most recently from ce841fe to 328c57e Compare September 7, 2026 11:31
@Sosthene00
Sosthene00 force-pushed the feat/silentpayments-dleq-multisigner branch 2 times, most recently from eefb10e to 08e2451 Compare September 11, 2026 13:45

@sdmg15 sdmg15 left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I just did a first review round and tests.
On first sights cargo clippy generates a lot of warnings might not all be related to this PR but worth mentioning.
Since you said you'll have to reword some of the commits and will do another round by then.

Comment thread spdk-wallet/src/client/coin_select.rs Outdated
);
}

fn selection_by_strategy<'a>(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this lifetime could be elided.

@Sosthene00
Sosthene00 force-pushed the feat/silentpayments-dleq-multisigner branch 4 times, most recently from d6ce5f2 to 55cbae4 Compare September 21, 2026 13:55
@Sosthene00
Sosthene00 force-pushed the feat/silentpayments-dleq-multisigner branch 6 times, most recently from d8da635 to df4a059 Compare September 28, 2026 14:52
@Sosthene00
Sosthene00 force-pushed the feat/silentpayments-dleq-multisigner branch 4 times, most recently from fa29e82 to 9aea6bc Compare October 3, 2026 13:39
@Sosthene00
Sosthene00 force-pushed the feat/silentpayments-dleq-multisigner branch from 9aea6bc to a4fbd22 Compare October 9, 2026 11:39
@Sosthene00
Sosthene00 force-pushed the feat/silentpayments-dleq-multisigner branch 3 times, most recently from 20f4502 to 5497775 Compare October 16, 2026 11:20
@Sosthene00
Sosthene00 force-pushed the feat/silentpayments-dleq-multisigner branch 2 times, most recently from 5001b2f to 92564bc Compare October 21, 2026 12:13
@Sosthene00
Sosthene00 force-pushed the feat/silentpayments-dleq-multisigner branch from 92564bc to e41a3be Compare November 4, 2026 21:07
Sosthene00 and others added 13 commits November 12, 2026 11:31
Callers supply the minimum outpoint. Later shared-secret constructors
pass `TransactionInputs::min_outpoint` instead of a `NonEmptyArray`.
Replace SharedSecret (PublicKey newtype) with TransactionSharedSecret,
which carries both the ECDH shared secret and the recipient scan key.

Introduce PublicTweakData in place of calculate_tweak_data /
calculate_ecdh_shared_secret, add ecdh_multiply and NormalizedSecretKey,
and migrate receiving/sending callers (scanners, wallet, examples, tests).
Add PartialSenderEcdhShare and GlobalSenderEcdhShare with rust-dleq proofs,
plus TransactionSharedSecret constructors from a global share or aggregated
partial shares. Gate sending on dleq-standalone or dleq-native (default:
dleq-standalone). Retain PartialSecret alongside the new path.

Also bump workspace bitcoin_hashes to 0.14 and silentpayments' bip39
dev-dependency to 2.2.
Replace `PartialSecret`-based generate_recipient_pubkeys with a DLEQ-aware
API taking a `TransactionSharedSecret` per scan key. Remove legacy
`calculate_partial_secret` helpers and update spdk-wallet spending to use
`TransactionSharedSecret` and `GlobalSenderEcdhShare`.

Update the `rand` feature of `bitcoin` to `rand-std`, needed for `OsRng`
Implements the BIP-375 signer roles as a new workspace crate built on top of
rust-psbt (psbt-v2) and the silentpayments crate.

Includes the BIP-375 test vector validation and signer e2e coverage, finalization
delegated to rust-psbt's Finalizer, and correct handling of mixed global/per-input
ECDH shares, labeled recipients sharing a scan key, and taproot tweaks in
extract_eligible_input_pubkey.

Ported from ba1e67b, adapted to SilentPaymentKeyMaterial instead of the obsolete
SilentPaymentAddressRaw.

Co-authored-by: macgyver13 <4712150+macgyver13@users.noreply.github.com>
Note in the workspace Cargo.toml why we default to rust-dleq's pure-Rust
standalone backend, its BIP-374 vector verification status, why the native
vendored-libsecp path is deferred, and the triggers to revisit it.
The hand-rolled unsigned transaction cannot carry DLEQ ECDH shares or hand signing off to the psbt crate. Freeze the selected inputs and outputs on a PSBT and derive scripts only at finalize time.
A co-sender can hand us a PSBT we would sign and a receiver would skip, or swap an output script after the shares are written. Either way the signature can be broadcast before we notice.

Uncompressed P2PKH keys are left out of the ECDH sum, matching BIP-352. A P2SH input now needs a redeem script that hashes to its prevout before we decide whether it is P2SH-P2WPKH; a missing or mismatched script is an error rather than a skipped input.

Signing goes through rust-psbt 2fb5abc, whose session takes a verifier and the exact input set. SpOutputVerifier re-derives the output scripts from the verified shares and rejects an empty or swapped script. A witness-only prevout is also rejected unless one of the inputs being signed is P2TR, because only that signature commits to every prevout. The wallet runs the same check when scripts are already set, and passes every input index because it signs them all.
input_count and spent_output_index are no longer plain integers, so the BIP-352 input set converts them.
Callers derive the scripts and commit them through the upstream Signer. The wrapper's lock-time and commit error variants go with it.
commit_sp_outputs now refuses a PSBT whose silent-payment scripts are already set. Checking those scripts is verify_committed_sp_outputs.
A missing outpoint fails inside assembly. The duplicate-outpoint preflight is dropped with the separate lookup.
@Sosthene00
Sosthene00 force-pushed the feat/silentpayments-dleq-multisigner branch from e41a3be to 0d3f452 Compare November 12, 2026 11:24
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.

2 participants