Built by o1Labs
Build zero knowledge apps in TypeScript.
o1js lets you write zk programs in plain TypeScript, prove locally in the browser, and verify anywhere.
Runs fully in your browser
No setup. No wallet connection. Just ship.
Prove you're 18+ without revealing your birthday
The Circuito1js
1
const AgeCheck = ZkProgram({
2
methods: {
3
checkAge: {
4
privateInputs: [Field],
6
async method(currentYear, birthYear) {
7
const age = currentYear.sub(birthYear);
8
age.assertGreaterThanOrEqual(Field(18));
10
return Field(1);
11
}
12
}
13
}
14
});
birthYear stays private. Only the proof that age ≥ 18 is revealed.
Why o1js
⚡
Write zk apps in TypeScript
No circuits in a separate language. No cryptography PhD required.
🌐
Prove in the browser
Proof generation runs locally. No server round-trip.
✓
Verify anywhere
Smart contracts, backend services, or even another browser tab.
How it works
Three steps to privacy-preserving applications
1
Define your zkProgram
You write normal TS. The math disappears.
import { Field, ZkProgram } from 'o1js';
const AgeCheck = ZkProgram({
name: 'age-check',
publicInput: Field,
methods: {
checkAge: {
privateInputs: [Field],
async method(currentYear, birthYear) {
const age = currentYear.sub(birthYear);
age.assertGreaterThanOrEqual(Field(18));
},
},
},
});
2
Generate a proof
Runs in your browser. Privacy by default.
// Compile once
await AgeCheck.compile();
// Generate proof
const { proof } = await AgeCheck.checkAge(
Field(2024), // current year (public)
Field(2003) // birth year (private)
);
// Birth year stays private.
// Only the proof is shared.
3
Verify it anywhere
On-chain, off-chain, or in another tab.
// Verify the proof
const isValid = await AgeCheck.verify(proof);
if (isValid) {
console.log('✓ User is 18+');
// Proceed with age-gated feature
}
// You never saw their birth year.
// You just know they're 18+.
