Solana Program Overview

The ZKVAULT Solana program is a native BPF program that provides on-chain zero-knowledge proof verification.

Program Architecture

Program ID: ZKVau1tXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX (mainnet)
           ZKVd3vXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX (devnet)

Entry Point: process_instruction()
Language: Rust
Runtime: Solana BPF (eBPF VM)
Compute Budget: 200k-400k CU per instruction

Account Structure

Vault Account

#[account]
pub struct Vault {
    pub owner: Pubkey,                    // 32 bytes
    pub vk_hash: [u8; 32],                // 32 bytes
    pub nonce: u64,                       // 8 bytes
    pub is_locked: bool,                  // 1 byte
    pub created_at: i64,                  // 8 bytes
    pub proof_count: u64,                 // 8 bytes
    pub last_verified_proof: Option<ProofMetadata>, // 1+80 bytes
    pub bump: u8,                         // 1 byte (PDA bump seed)
}

Total size: ~171 bytes
Rent exempt minimum: ~0.00238 SOL

Proof Metadata

#[derive(AnchorSerialize, AnchorDeserialize, Clone)]
pub struct ProofMetadata {
    pub proof_id: u64,
    pub submitter: Pubkey,
    pub timestamp: i64,
    pub public_inputs_hash: [u8; 32],
    pub verified: bool,
}

Instruction Set

See Instruction Set for details.

Error Codes

#[error_code]
pub enum ErrorCode {
    #[msg("Vault is locked")]
    VaultLocked,
    
    #[msg("Invalid proof structure")]
    InvalidProof,
    
    #[msg("Verification key mismatch")]
    VKMismatch,
    
    #[msg("Nonce already used")]
    NonceReused,
    
    #[msg("Proof verification failed")]
    VerificationFailed,
    
    #[msg("Unauthorized")]
    Unauthorized,
    
    #[msg("Arithmetic overflow")]
    Overflow,
}

For complete program documentation, see the other Solana Program sections.