Inspiration
What it does
How we built it
Challenges we ran into
Inspiration
Counterfeit trade reached USD 467 billion in 2021, up to 2.3% of world trade (OECD/EUIPO, 2025). Medicines, car parts, cosmetics, toys and food are among the dangerous categories. Smartphones alone lost 12.9% of legitimate sales to fakes (EUIPO/ITU, 2015 data).
Authenticity checks today are optional and separate from paying, so most buyers skip them. What if the check happened before a payment could exist at all? Brands also spend USD 150B+ a year on market insights (ESOMAR, 2024 data). We built TrustLedger to put an authenticity gate in front of the payment, and to turn verified purchases into privacy-protected market insights.
What it does
- Enter the serial. The cashier enters the serial at checkout. The POS posts it to the TrustLedger API.
- Brand verifies. The brand checks that the serial is registered, unsold, and assigned to that store's channel. A deterministic yes or no from the brand's records, not AI.
- Pay or investigate. Verified: TrustLedger creates a PayPal Orders v2 order and stores the brand's verification ID in its
custom_id. Not verified: no PayPal order is ever created, so nothing can be paid, and an AI investigator opens a case. - Brand Insights. The same checkout data answers market questions. Buyer-level answers are privacy-protected and show a 95% interval.
How we built it
- Raw data stays home. Serials, batches and shipments stay in the brand node's database. Transactions and hashed buyer IDs stay in the PayPal-side node's database. Each service gets only its own database URL. The AI investigator has no database URL at all.
- Questions travel, data doesn't. Questions become structured JSON query specs, never SQL. The nodes return only group-level aggregates, so the AI never sees a buyer record.
- Privacy. Differential privacy via OpenDP (zero-concentrated DP, Gaussian noise). Each buyer's contribution is bounded, small groups are hidden, and buyer-level numbers carry a 95% interval.
- Stack. PayPal Server SDK for Orders v2, direct REST for webhook verification, AG Studio, AG Grid and AG Charts for the cockpit, a Bryntum Scheduler timeline for the supply chain, and an MCP server generated from our OpenAPI spec so AI agents can call the brand check as a tool.
Challenges
- Gate before the order. A failed check must return before the order call is ever made. A test asserts that a blocked checkout can never produce a payment order or be paid.
- Three services, no shortcuts. The brand node, the PayPal-side node and the platform each own their database, and the investigator works across all three without database access.
- Calibrating privacy. Bounding each buyer's contribution across released tables, hiding small groups, and showing an interval on every buyer-level number. The interval calibration is still being checked.
Accomplishments
- A sandbox order paid end to end, with the brand's verification ID stored in the PayPal order.
- A live deployment on Render (web and API), with a preflight check of 145 passing checks against the live URLs.
- An internal red-team battery of 11 attack types against the private release. None produced a confident individual-level fact.
What we learned
- Put the check where it can't be skipped. An optional check gets skipped. If no PayPal order can exist for an unverified product, nothing can be paid.
- Privacy has to be structural. Prompts and guardrails are not enough: it takes separate services, a strict query format, and differential privacy on every buyer-level number.
What's next
- Authenticated store devices, so the store channel can't be claimed in a request.
- Separate database roles per service, and a brand login for the cockpit.
- Physical authentication of units. This demo does not attempt it.
- Connectors from the brand node to brands' ERP and warehouse systems. ## Accomplishments that we're proud of
What we learned
What's next for TrustLedger: Counterfeit-Proof Checkout with PayPal + AI
Built With
- ag-charts
- ag-grid
- ag-studio
- bryntum
- docker
- fastapi
- mcp
- next.js
- opendp
- paypal
- postgresql
- python
- react
- render