Inspiration
Agentic commerce is the future. AI agents will soon autonomously buy our groceries, pay our bills, and manage our subscriptions. But a fundamental trust problem exists: How does a payment processor know the AI didn't hallucinate the price, or worse, get hijacked by a malicious prompt injection to drain a user's bank account?
We built Proof of Inference to solve this. We don't just trust the AI; we mathematically enforce its constraints.
What it does
Proof of Inference is a production-grade, zero-trust architecture that sits between a local AI and the PayPal API.
- Local AI Engine: Uses Qwen 2.5 (7B) with GBNF grammar to guarantee 100% strict JSON output (no hallucinations).
- Cryptographic Lifecycle: The backend wraps the AI's JSON in a lifecycle envelope (containing a
tx_id,nonce, and 60-second expiry) and signs it using Ed25519. - Deterministic Risk Engine: A backend policy engine calculates a Trust Score. It blocks suspicious prompts, high-value anomalies, and unknown merchants.
- Dead Man's Switch: The user has 60 seconds to authorize or revoke the exact signed transaction.
- Atomic State Machine: Uses SQLite to prevent race conditions (e.g., clicking "Abort" while the backend is calling PayPal).
- Crash-Safe Recovery: If the backend crashes mid-capture, a startup daemon reconciles the transaction with PayPal to prevent double-charging.
The Winning Demo: LLM Hijack Defense
We included an Adversarial Lab in the UI. A user can inject a malicious <system_override> into a product description. The local Qwen 2.5 model actually gets hijacked and attempts to generate a $999 purchase for a $30 item.
However, our independent backend policy engine catches the anomaly. The Trust Score spikes to 90/100, and PayPal Capture API Calls remain at 0. The AI is compromised, but the architecture holds. No money moves.
How we built it
- AI Engine: Ollama, Qwen 2.5, GBNF Grammar
- Cryptography: PyNaCl (Ed25519 signatures)
- Database: SQLite (Atomic state transitions)
- Payments: PayPal Orders v2 API (Idempotency, Create -> Capture flow)
- UI: Streamlit (6-tab enterprise SOC dashboard)
Accomplishments that we're proud of
- Implementing an atomic SQLite state machine that mathematically prevents race conditions between ABORT and CAPTURE.
- Writing a startup reconciliation daemon that guarantees no double-charging after a backend crash.
- Building a prompt injection demo that proves the AI can be fully compromised without resulting in financial loss.
What's next for Proof of Inference
- Migrating the Ed25519 private keys from local memory to a secure AWS KMS or HSM.
- Implementing real PayPal Webhooks with signature verification for production reconciliation.
- Expanding the Risk Engine with real-time behavioral anomaly detection.