Skip to content

Implement confidential payment settlement using Pedersen commitments #352

Description

@Kingsman-99

Overview

Allow payers to hide payment amounts on-chain using Pedersen commitments. The contract stores commitments during payment and verifies the opening (value + blinding factor) at settlement time. Only after settlement are the actual amounts visible on-chain.

Requirements

  • Extend pay to accept an optional commitment: Option<BytesN<32>> — if set, store the commitment instead of the raw amount
  • reveal_payment(env, invoice_id, payer, value: i128, blinding: BytesN<32>) — verifies the Pedersen commitment C = value*G + blinding*H and credits the payment
  • Use a fixed generator point H stored in contract instance storage (set at init)
  • Reject reveals where the commitment doesn't match
  • Emit ConfidentialPaymentRevealed { invoice_id, payer } (no amount in event — privacy preserved)
  • Write tests: commit → reveal succeeds, tampered value rejected, tampered blinding rejected, double-reveal rejected

Acceptance Criteria

  • Commitment stored during pay (amount hidden)
  • reveal_payment verifies commitment correctly
  • Tampered reveals rejected
  • Double-reveal rejected
  • No amount leaked in events
  • All existing tests pass
  • cargo test --workspace passes with zero failures
  • cargo clippy --all-targets -- -D warnings produces zero warnings

Definition of Done

All CI checks must pass before the PR is reviewed.

Metadata

Metadata

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial CampaignCampaign: Official CampaignOfficial Campaign | FWC26Campaign: Official Campaign | FWC26complexity: highComplex feature requiring deep knowledge - 200 ptsgrantfoxIssue for GrantFox programsecuritySecurity hardening and access control

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions