Description
External verifiers (auditors, regulators) need to validate that a payment occurred without being given access to the full payment history. This issue adds a payment proof mechanism where each payment writes a Merkle-style commitment hash to storage, and a verify_payment_proof function checks inclusion without exposing other payments.
Technical Context
Maintain a payment_root_key(invoice_id) -> BytesN<32> rolling hash in lib.rs. On each pay_invoice, compute new_root = sha256(old_root || payer || amount || ledger) using env.crypto().sha256(). Expose get_payment_root(env, invoice_id) -> BytesN<32> and verify_payment_proof(env, invoice_id, proof_elements: Vec<BytesN<32>>, payer: Address, amount: i128, ledger: u64) -> bool.
Acceptance Criteria
Description
External verifiers (auditors, regulators) need to validate that a payment occurred without being given access to the full payment history. This issue adds a payment proof mechanism where each payment writes a Merkle-style commitment hash to storage, and a
verify_payment_prooffunction checks inclusion without exposing other payments.Technical Context
Maintain a
payment_root_key(invoice_id) -> BytesN<32>rolling hash inlib.rs. On eachpay_invoice, computenew_root = sha256(old_root || payer || amount || ledger)usingenv.crypto().sha256(). Exposeget_payment_root(env, invoice_id) -> BytesN<32>andverify_payment_proof(env, invoice_id, proof_elements: Vec<BytesN<32>>, payer: Address, amount: i128, ledger: u64) -> bool.Acceptance Criteria
pay_invoicecallget_payment_rootreturns the current rolling hashverify_payment_proofreturnstrueonly for valid inclusion proofssha256(invoice_id)(deterministic seed)