A privacy-preserving password verification zkApp built on Mina Protocol (Devnet).
This project demonstrates how a user can prove knowledge of a correct password using zero-knowledge proofs, without revealing the password or any sensitive data on-chain.
Traditional smart contracts require inputs to be public.
This zkApp leverages Mina’s zero-knowledge architecture to allow secure authentication where:
- The password is never revealed
- Only a cryptographic proof is verified on-chain
- Incorrect passwords fail locally before any transaction is sent
- 🔒 Zero-knowledge password verification
- 🧠 Poseidon hashing inside zk circuits
- 🧾 On-chain storage of password hash only
- ⚡ Proof-based verification (no re-execution on-chain)
- 🌐 Deployed and tested on Mina Devnet
User (Client)
│
│ Password (private)
▼
Local Proof Generation (prove)
│
│ Zero-Knowledge Proof
▼
Mina Blockchain (verify proof only)
- Client: Generates proofs and signs transactions
- zkApp: Stores password hash and verifies correctness
- Blockchain: Verifies proofs, not raw inputs
project-root/ │
├── src/
│ ├── PasswordVerifierDevnet.ts
├── scripts/
│ ├── deployDevnetPassword.ts
│ ├── callVerifyPasswordDevnet.ts
│ └── readStatePasswordDevnet.ts
├── package.json
├── tsconfig.json
├──.env
└── README.md
The zkApp stores a Poseidon hash of a password on-chain.
- Reads the stored password hash
- Hashes the provided password inside the circuit
- Asserts both hashes are equal
- Generates a zero-knowledge proof
If the assertion fails:
- Proof generation fails
- Transaction is never sent
- No fees are paid
- Zero-Knowledge Proofs
- Poseidon Hashing
- zkApp State
- Private/Public Key Cryptography
- Proof-based Smart Contracts
npm installFEE_PAYER_KEY=<fee_payer_private_key>
ZKAPP_PRIVATE_KEY=<zkapp_private_key>
ZKAPP_ADDRESS=<zkapp_public_key>npm run buildnode build/scripts/deployDevnetPassword.jsOutput includes:
-
zkApp address
-
Deployment transaction hash
node build/scripts/callVerifyPasswordDevnet.js-
✅ Correct password → transaction succeeds
-
❌ Wrong password → proof fails locally
node build/scripts/readStatePasswordDevnet.jsThis reads:
The Poseidon hash of the password stored on-chain
Mina Protocol (Devnet)
o1js
TypeScript
Node.js
Password is never stored or revealed
Only the Poseidon hash exists on-chain
Proofs ensure correctness without disclosure
Invalid attempts fail before reaching the blockchain
Apache 2.0 License