Commit Graph
2 Commits
Author SHA1 Message Date
jwinterm f26b432999 feat(verify): implement grin (Mimblewimble) settlement verification
Wire the family="grin" arm of POST /api/v1/verify, replacing the stub.

Grin has no address and no txid, so the request identifies a payment by its output COMMITMENT (tx_ref) and the recipient's rewind_hash (view_key). scan_rewind_hash proves recipient ownership AND the true received amount in one scan (only the recipient's rewind_hash recognizes the commitment), then gates on grin's 10-confirmation depth via get_height.

No get_kernel: MW aggregation/cut-through leaves no on-chain join binding a kernel excess to a specific output, so a kernel-only check can't soundly gate amount or recipient. Sender is unenforceable (MW reveals none -> sender:null) and dest_address is ignored (no addresses); a missing view_key returns not_found, never a false verify, mirroring the cryptonote arm.

Adds grin_for resolver + grin_amount_outcome helper + unit tests. 8/8 verify tests pass, clippy and rustfmt clean.
2026-08-01 07:36:34 -04:00
jwinterm 0f0ec2af49 feat(verify): delegated settlement verification endpoint
Add POST /api/v1/verify, the server side of moon.vote's delegated
settlement check: confirm a specific tx_ref paid at least the expected
base-unit amount to dest_address, confirmed to this backend's per-asset
depth.

- UTXO (btc/ltc): mirror ElectrumClient semantics; consult get_history
  first to distinguish not_found from a node error, then attribute the
  exact amount via VerboseTransaction::total_received_at.
- CryptoNote (xmr/wow): require a private view_key, scan via
  get_address_txs, match tx_ref, gate on mempool/height and the daemon
  confirmation depth (XMR 10, WOW 4).
- grin: deferred (reports not_found with a warn).

Business outcomes (incl. failures) are always 200 with a fixed reason
vocabulary; only infrastructure failures return non-2xx AppError so
moon.vote retries. Unauthenticated by design (nginx allow-list gates it);
no utoipa/openapi wiring (server-to-server, not in the wallet client).
2026-07-29 07:39:08 -04:00