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
Definition of Done
All CI checks must pass before the PR is reviewed.
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
payto accept an optionalcommitment: Option<BytesN<32>>— if set, store the commitment instead of the raw amountreveal_payment(env, invoice_id, payer, value: i128, blinding: BytesN<32>)— verifies the Pedersen commitmentC = value*G + blinding*Hand credits the paymentHstored in contract instance storage (set at init)ConfidentialPaymentRevealed { invoice_id, payer }(no amount in event — privacy preserved)Acceptance Criteria
pay(amount hidden)reveal_paymentverifies commitment correctlycargo test --workspacepasses with zero failurescargo clippy --all-targets -- -D warningsproduces zero warningsDefinition of Done
All CI checks must pass before the PR is reviewed.