Skip to content

Add PayJoin (BIP78) support for enhanced transaction privacy #192

Description

@nejos97

Implement PayJoin (BIP78) in Grimm App to improve on-chain transaction privacy by allowing the receiver to contribute an input to the transaction.

This breaks common blockchain heuristics (e.g., input ownership assumptions) and makes transactions more private without requiring complex user interaction.


Objectives

  • Improve transaction privacy without complex UX
  • Break common chain analysis heuristics
  • Maintain a seamless payment experience

Scope

1. PayJoin Transaction Flow

  • Detect PayJoin-capable invoices (BIP21 with pj= parameter)

  • Fallback to normal transaction if PayJoin not available

  • Build initial PSBT (sender side)

  • Send PSBT to receiver endpoint

  • Receive modified PSBT (with receiver input added)

  • Validate updated transaction:

    • Inputs/outputs integrity
    • No malicious fee manipulation
  • Sign and broadcast final transaction


2. Receiver Side (Optional – Advanced)

  • Implement PayJoin server endpoint
  • Add receiver input selection logic
  • Ensure no address reuse
  • Return updated PSBT

3. Security & Validation

  • Verify:

    • Output amounts are correct
    • No output redirection
    • Fee increase is acceptable
  • Protect against:

    • Fee overpayment attacks
    • Input probing

4. UX/UI

  • Automatic usage when available (no user friction)
  • Optional indicator: “Enhanced Privacy Payment”
  • Silent fallback if PayJoin fails

Acceptance Criteria

  • Wallet detects and processes PayJoin invoices
  • Transaction includes inputs from both sender and receiver
  • Privacy heuristics (common-input ownership) are broken
  • No degradation of UX for non-technical users
  • Works on testnet

Risks / Considerations

  • Requires receiver support (low adoption currently)
  • Endpoint availability issues
  • Additional round-trip latency
  • Complex validation logic

References

  • BIP78 specification
  • PayJoin Dev Kit (PDK)
  • BIP21 URI scheme

Nice-to-have (Future)

  • PayJoin batching
  • Integration with merchants
  • Stats: “Privacy improved via PayJoin”

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions