Project Story: Zypher
Inspiration
The initial spark for Zypher came from a failed experiment. We were building an autonomous financial agent ("FinanceGPT") designed to execute real money transactions. As we demoed it, we hit a wall: trust. Users asked, "How do I know this trade recommendation actually came from the AI and wasn't injected by a middleman?" and "If this agent loses money, how do I prove what instructions it was following?"
We realized this wasn't just our problem—it's the fundamental bottleneck for the entire "Agentic AI" economy. As AI handles critical tasks in finance, legal, and healthcare, we can't afford black boxes. We need mathematical proof. We looked for an "SSL layer for AI" but found nothing that could cryptographically bind a prompt to a response without exposing private data. So, we built it.
What it does
Zypher is an open-source TypeScript SDK that allows developers to cryptographically "seal" any AI interaction. It generates a Zero-Knowledge Proof (ZK-SNARK) attesting that a specific prompt $P$ produced a specific response $R$ from a specific model $M$.
Crucially, because it uses Zero-Knowledge proofs, you can verify the integrity of the interaction without revealing the private prompt or the model's weights. It turns ephemeral AI text into an immutable, verifiable asset.
How we built it
We built Zypher as a developer-first SDK, abstracting away the heavy cryptography.
- Core Cryptography: We used Circom to write the arithmetic circuits and SnarkJS for proof generation.
- Hashing: We implemented Poseidon Hashing, a ZK-friendly hash function ($O(n)$ constraints vs $O(n^2)$ for SHA-256), to efficiently fingerprint prompts within the circuit.
- Proof System: We utilized Groth16, ensuring constant-size proofs ($\approx 200$ bytes) and millisecond verification times, making it feasible to run on-chain.
- The SDK: The entire logic is wrapped in a TypeScript library that integrates with standard AI providers (OpenAI, Anthropic, Ollama). A developer simply adds
.seal()to their existing API calls.
Challenges we ran into
Taking ZK-proofs out of the theoretical realm and into a JavaScript SDK was brutal.
- Circuit Complexity: Our initial circuits for hashing variable-length strings were massive. We had to optimize the Poseidon implementation to handle batched inputs to keep proof generation under 3 seconds on a standard laptop.
- The "Binding" Bug: During our internal audit, we discovered our proofs weren't correctly binding the public output hash to the private input—meaning a valid proof could be reused for fake data. We had to rewrite the
prompt_hash.circomcircuit to strictly enforce public signal constraints ({public [promptHash]}). - Developer Experience: Dealing with
.zkeyand.wasmfiles is a nightmare for web devs. We spent weeks building a seamless post-install script that manages these artifacts automatically, so the user just seesnpm install.
Accomplishments that we're proud of
- It Works: We successfully generated valid Groth16 proofs for real-world OpenAI responses in under 3 seconds.
- NPM Launch: We published
@zypher-sdk/sdkand it's practically usable today. - Security: We implemented a robust "zkStamp" system that links the ZK proof to an EVM wallet signature, creating a full chain of custody from the AI to the blockchain.
What we learned
We learned that trust is an infrastructure problem, not a policy problem. You can't regulate AI into being truthful, but you can cryptographically prove its actions. We also learned that the gap between "working ZK circuit" and "usable NPM package" is massive—50% of our time went into developer experience, and it was worth every second.
What's next for Zypher
We are working on on-chain verification. Right now, proofs are verified off-chain. The next step is a smart contract that can accept a Zypher proof and trigger blockchain transactions (like releasing funds from a DAO) only if the AI's logic is cryptographically verified to be sound.
Built With
- circom:
- circomlib:
- circuits
- contracts.
- cryptography
- ethers.js:
- groth16
- hash
- in
- javascript/typescript.
- languages-typescript:-the-core-language-for-the-entire-sdk
- node.js:
- prompt-hash.circom).
- snarkjs:
- solidity:
- zero-knowledge
- zk