API Documentation
Integrate zkRune into your applications with REST API and Client-Side SDK
Recommended: Client-Side SDK
Faster, more secure, and no server costs! Generate and verify proofs directly in the browser.
Quick Start - Client-Side SDK
Recommended method - Runs in browser
1. Install the SDK:
npm install @zkrune/sdk
2. Generate proof (in browser):
import { generateProof } from '@zkrune/sdk';
const result = await generateProof({
templateId: 'age-verification',
inputs: {
age: '25',
minAge: '18'
}
});
if (result.success) {
console.log('Proof:', result.proof);
}3. Verify proof (in browser):
import { verifyProof } from '@zkrune/sdk';
const isValid = await verifyProof({
proof: result.proof.groth16Proof,
publicSignals: result.proof.publicSignals,
verificationKey: result.proof.verificationKey
});
console.log('Valid:', isValid); // true/falseAlternative: REST API
Server-side proof generation
const response = await fetch('https://zkrune.com/api/generate-proof', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
templateId: 'age-verification',
inputs: {
age: '25',
minAge: '18'
}
})
});
const data = await response.json();
console.log(data.proof);/api/generate-proofGenerate a zero-knowledge proof for a template
Request Body:
{
"templateId": "age-verification",
"inputs": {
"birthYear": "1995",
"currentYear": "2024",
"minimumAge": "18"
}
}Response:
{
"success": true,
"proof": {
"groth16Proof": {...},
"publicSignals": [...],
"verificationKey": {...},
"isValid": true,
"note": "Generated in Xs"
},
"timing": 1234
}/api/verify-proofVerify a zero-knowledge proof
Request Body:
{
"proof": {...},
"publicSignals": [...],
"vKey": {...}
}Response:
{
"success": true,
"isValid": true,
"message": "Proof verified!",
"timing": 50
}Available Templates
age-verificationAge Verification
Inputs: birthYear, currentYear, minimumAge
balance-proofBalance Proof
Inputs: balance, minimumBalance
membership-proofMembership Proof
Inputs: memberId, groupHash
range-proofRange Proof
Inputs: value, minRange, maxRange
private-votingPrivate Voting
Inputs: voterId, voteChoice, pollId
Interactive Playground
Test examples directly in your browser!
Client-Side Proof
Generate in browser
Server-Side Proof
Via REST API
Client-Side Verification
Verify proof in browser (never sent to server!)
Performance Comparison
Client-Side SDK
REST API
Blockchain Verify
Conclusion: Client-side SDK is 9x faster and more secure! Use client-side in production apps, only use API for metadata and record keeping.
Usage Recommendations
Client-Side SDK (Recommended)
- 9x faster performance
- Full privacy (data never leaves browser)
- No server costs
- Unlimited usage
- Runs in browser via WASM
REST API (Optional)
- Slower (~1.8s generate, 10s+ verify)
- Runs on server
- Use for metadata and record keeping
- Data sent to server
- Rate limits may apply
Production Recommendation: Use client-side for proof generation and verification. Only use API for recording proofs to blockchain or storing metadata.
