Skip to content

Conversation

@FreeOnlineUser
Copy link

Addresses #569 (Silent Payments bounty)

Description

Adds full Silent Payments send support, enabling SeedSigner to sign transactions to sp1... addresses while verifying the output derivation is correct.

Key features:

  • BIP-352 Silent Payments: Parse, display, and verify sp1.../tsp1... addresses
  • BIP-375 PSBT support: Full support for SP PSBT fields (PSBT_OUT_SP_V0_INFO, PSBT_GLOBAL_SP_ECDH_SHARE, PSBT_GLOBAL_SP_DLEQ)
  • BIP-374 DLEQ proofs: Cryptographic verification that ECDH shared secret was computed correctly
  • Two verification workflows:
    1. Automatic (BIP-375): Coordinator includes proof data in PSBT → SeedSigner verifies via DLEQ
    2. Manual: User scans SP address first → SeedSigner re-derives and verifies the output
  • Dual verification: When both methods are available, both are checked

Why this matters:
Without this, users see only a random bc1p... address with no way to confirm it corresponds to their intended sp1... recipient. Buggy, compromised, or MITM-attacked wallet software could substitute a different address. SeedSigner now independently verifies the derivation before signing.

Demo video:

New.project21.mp4

Test tool: https://github.com/FreeOnlineUser/bip375-test-tools
Generates valid BIP-375 PSBTs with fake inputs for testing the complete signing flow.

Files Changed

  • src/seedsigner/helpers/silent_payments.py - Core SP/DLEQ implementation
  • src/seedsigner/models/psbt_parser.py - BIP-375 field extraction and verification
  • src/seedsigner/models/decode_qr.py - SP address QR decoding
  • src/seedsigner/views/scan_views.py - SP address scanning flow
  • src/seedsigner/views/psbt_views.py - Display verified SP addresses
  • src/seedsigner/gui/screens/psbt_screens.py - UI for SP verification status
  • docs/silent_payments.md - User documentation
  • tests/test_silent_payments.py - Comprehensive test suite

Related BIPs

This pull request is categorized as a:

  • New feature
  • Bug fix
  • Code refactor
  • Documentation
  • Other

Checklist

  • I've run pytest and made sure all unit tests pass before submitting the PR

If you modified or added functionality/workflow, did you add new unit tests?

  • No, I'm a fool
  • Yes
  • N/A

I have tested this PR on the following platforms/os:

FreeOnlineUser and others added 10 commits January 4, 2026 22:20
Implements verification for sending to Silent Payment addresses (sp1.../tsp1...).
SeedSigner independently re-derives the expected Taproot output from the scanned
SP address and verifies it matches a PSBT output from the coordinator wallet.

User flow:
1. Scan SP address QR -> SeedSigner stores B_scan, B_spend
2. Scan PSBT from coordinator (BlueWallet, Sparrow, etc.)
3. SeedSigner verifies a P2TR output matches the SP-derived address
4. User sees "Silent Payment Verified" with original sp1... address
5. User approves and signs

New files:
- src/seedsigner/helpers/silent_payments.py - BIP-352 crypto operations
- tests/test_silent_payments.py - Unit tests with official test vectors

Modified:
- QR detection for sp1.../tsp1... addresses
- PSBT parser with SP output verification
- Views/screens for SP address handling

Passes BIP-352 test vectors from bitcoin/bips repository.

Related: SeedSigner#569

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add docs/silent_payments.md: comprehensive user guide explaining:
  - What Silent Payments are and privacy benefits
  - How verification works (before vs after)
  - The risk of unverified SP transactions
  - Step-by-step usage instructions
  - Why SeedSigner can only verify, not generate SP addresses
- Update docs/qr_formats.md: add SP address to supported QR formats
- Expand silent_payments.py docstring with detailed security model

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implements automatic Silent Payment verification when coordinator wallets
include BIP-375 fields in PSBTs, eliminating the need to scan SP addresses
separately.

New functionality:
- BIP-374 DLEQ proof verification (verify_dleq_proof)
- BIP-375 PSBT field parsing:
  - PSBT_GLOBAL_SP_ECDH_SHARE (0x07)
  - PSBT_GLOBAL_SP_DLEQ (0x08)
  - PSBT_OUT_SP_V0_INFO (0x09)
  - PSBT_IN_SP_ECDH_SHARE (0x1d) - parsing only, aggregation future
  - PSBT_IN_SP_DLEQ (0x1e) - parsing only
- SP address encoding (encode_silent_payment_address)

Verification priority:
1. BIP-375 fields present → verify via DLEQ (automatic)
2. User scanned SP address → verify via re-derivation (fallback)
3. Neither → display bc1p... only (no verification)

Tests: 25 tests passing (8 new for BIP-375/374)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Documents the relationship between BIP-375 fields and PSBT versions,
noting that embit preserves BIP-375 fields in its unknown dict regardless
of PSBT version, and most coordinators use v0-compatible PSBTs.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add get_psbt_version() and is_psbt_v2() helper functions
- PSBT_GLOBAL_VERSION (0xFB) field detection for v2 PSBTs
- Log PSBTv2 detection in PSBT parser for diagnostics
- Add 5 new tests for PSBTv2 detection (30 tests total)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Previously _verify_sp_outputs() was only called when pending_sp_address
was set (user scanned SP address first). Now it's always called, allowing
BIP-375 automatic verification to work without pre-scanning.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The embit secp256k1.ec_pubkey_negate() function RETURNS the negated
point as a 64-byte raw value - it does NOT modify the input in-place.

This was causing DLEQ proof verification to always fail because the
original (non-negated) points were being used in the combine operation.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Link to bip375-test-tools for testing BIP-375 verification
without needing a full coordinator wallet setup.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Document new testing tool capabilities:
- Seed QR export for loading test keys
- Animated UR QR codes
- Camera scanning for signed PSBT verification
- Full end-to-end signing flow testing

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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.

1 participant