SDK Overview
The ZKVAULT SDK provides a comprehensive TypeScript library for building zero-knowledge applications on Solana.
SDK Architecture
The SDK is organized into several core modules:
- Prover - Circuit building and proof generation
- Verifier - On-chain proof verification interface
- Vault - Encrypted data storage and retrieval
- Solana - Blockchain integration utilities
Example Usage
import { ZKVault, Circuit } from '@zkvault/sdk'
import { Connection, Keypair } from '@solana/web3.js'
// Initialize connection
const connection = new Connection('https://api.devnet.solana.com')
const wallet = Keypair.generate()
// Initialize ZKVAULT client
const zkvault = new ZKVault({
connection,
wallet,
cluster: 'devnet'
})
// Create a simple circuit
const circuit = new Circuit()
.addPublicInput('x')
.addPrivateInput('y')
.assertEqual('x', 'y * y') // Prove x = y²
// Generate and verify proof
const proof = await zkvault.prover
.build(circuit)
.prove({ x: 9, y: 3 })
const tx = await zkvault.solana.verify(proof)
console.log('Proof verified on-chain:', tx)TypeScript Configuration
Ensure your tsconfig.json includes:
{
"compilerOptions": {
"target": "ES2020",
"module": "ESNext",
"lib": ["ES2020", "DOM"],
"moduleResolution": "node",
"esModuleInterop": true,
"strict": true,
"skipLibCheck": true
}
}Browser Support
The SDK works in both Node.js and browser environments with automatic configuration.