Skip to content

nel349/zkSalaria

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

165 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

zkSalaria - Privacy-Preserving Payroll with ZKML Income Verification

zkSalaria

๐ŸŽฌ 30-Second Demo Video | ๐Ÿ“Š Pitch Deck (Google Slides) | ๐Ÿ“– Detailed Flow Explanation

Hackathon Track: Midnight Finance Innovation: First payroll system combining zero-knowledge proofs with machine learning for private income verification


๐Ÿ“ธ zkSalaria User Flows

๐Ÿ‘ค Employee Portal

Private Salary Management

Employee Dashboard

Key Features:

  • View encrypted salary balance
  • Generate income proofs (4 types)
  • Withdraw earned salary
  • Payment history timeline

๐Ÿข Company Dashboard

Privacy-First Payroll

Company Dashboard

Key Features:

  • Deposit funds & pay employees
  • Set up recurring payments
  • Track encrypted balances
  • Manage employment records

๐Ÿ” Auditor Workspace

ZKML Proof Verification

Auditor Dashboard

Key Features:

  • Validate EZKL income proofs
  • Sign attestations (~30 sec)
  • Build reputation score
  • Earn verification fees
๐ŸŽฏ See Complete User Journey (Click to Expand)

1. Company Flow: Setting Up Payroll

Company Login โ†’ Deposit Funds โ†’ Add Employees โ†’ Create Recurring Payments

Company Dashboard - Main View

Company Dashboard

Adding New Employee

Add Employee Form

Paying Employee

Pay Employee Form

Setting Up Recurring Payments

Setup Recurring Payment


2. Employee Flow: Generating Income Proof

Employee Login โ†’ View Payment History โ†’ Generate Proof โ†’ Submit to Auditor

Generate Income Proof Form

Generate Income Proof

Proof Generated - Details View

Proof Generated Details

Downloadable PDF Proof

PDF Income Proof


3. Auditor Flow: Verifying & Signing Proofs

Auditor Login โ†’ Receive Proof โ†’ Validate EZKL โ†’ Sign Attestation โ†’ Earn Fee
  • Auditors receive employee proof requests
  • Validate EZKL proof structure and history commitment
  • Sign attestation with private key
  • Earn 60-70% of verification fee + build reputation

4. Verifier Flow: Checking Income Eligibility

Bank/Lender โ†’ Call Smart Contract โ†’ Verify Proof โ†’ Approve Loan
  • Banks/landlords call verifyIncomeProof() on smart contract
  • Contract returns TRUE/FALSE (threshold met or not)
  • Verifier NEVER sees exact salary amount
  • Instant verification (~20ms on-chain)

๐ŸŽฏ The Problem We're Solving

Today's broken income verification:

When employees need to prove income for loans, leases, or credit applications, they must:

  • โŒ Share exact salary amounts with third parties
  • โŒ Provide full bank statements and payment history
  • โŒ Trust that verifiers won't misuse or leak their data
  • โŒ Accept document fraud risks and manual processing delays

The privacy crisis:

  • Employees lose control over sensitive financial data
  • Companies face data breach liability and compliance costs
  • Verifiers spend 3-5 days manually reviewing documents
  • Everyone trusts paper/PDFs that can be forged

๐Ÿ’ก Our Solution: Zero-Knowledge Income Proofs

zkSalaria lets employees prove income requirements without revealing exact amounts.

Example: Alice's Loan Application

Traditional Way (BAD):

Alice โ†’ Bank: "Here's my salary: $7,500/month" + paystubs
Bank sees: EXACT AMOUNT ($7,500)
Privacy: โŒ NONE

zkSalaria Way (GOOD):

Alice โ†’ zkSalaria: "I earn โ‰ฅ $4,000/month" + ZK Proof
Bank sees: THRESHOLD MET (โ‰ฅ $4,000)
Privacy: โœ… Exact amount hidden ($7,500 never revealed)
Trust: โœ… Cryptographic proof (no documents needed)

Result: Alice gets loan approval while keeping her exact salary private.


๐Ÿ† Value Proposition for Each Stakeholder

For Employees ๐Ÿ’ผ

What you get:

  • โœ… Privacy-first payroll: Receive salary payments with fully encrypted amounts on-chain
  • โœ… Selective disclosure: Prove "I earn โ‰ฅ $4,000/month" without revealing exact salary
  • โœ… Reusable proofs: Generate one proof, use for multiple verifiers (loans, leases, credit)
  • โœ… No document fraud: Cryptographic proofs can't be forged or tampered with
  • โœ… Instant verification: Get approved in seconds instead of waiting 3-5 days

Why it matters: Traditional income verification requires sharing exact salary details with banks, landlords, and lenders. This creates privacy risks, identity theft exposure, and loss of control over sensitive data. zkSalaria gives you cryptographic income proofs that protect your privacy while meeting verifier requirements.


For Companies ๐Ÿข

What you get:

  • โœ… Complete privacy: All company balances and payment amounts encrypted on-chain
  • โœ… Zero data breach liability: Employee data never leaves their control
  • โœ… Automated recurring payroll: Set up weekly/bi-weekly/monthly salary payments
  • โœ… Compliance-friendly: Encrypted payment history for audit purposes
  • โœ… No verification burden: Employees handle their own income proofs

Why it matters: Payroll data breaches cost companies millions in lawsuits, regulatory fines, and reputation damage. zkSalaria eliminates this risk by keeping all financial data encrypted on-chain. Companies can run payroll privately while enabling employees to verify income independently.


For Verifiers (Banks, Landlords, Lenders) ๐Ÿฆ

What you get:

  • โœ… 99% cost reduction: Instant cryptographic verification vs. 3-5 days manual review
  • โœ… No document fraud: Mathematical proofs can't be forged like paystubs/W-2s
  • โœ… Instant results: Verify income eligibility in real-time via smart contract
  • โœ… Zero liability: No sensitive data to store, no breach risk
  • โœ… Flexible requirements: 4 proof types for different use cases

Why it matters: Manual income verification is slow (3-5 days), expensive (staff costs), and risky (document fraud). zkSalaria provides instant, cryptographically certain verification with zero fraud risk and minimal cost.


For Auditors (Licensed CPAs, Big 4 Firms) ๐Ÿ”

What you get:

  • โœ… New revenue stream: Earn fees for verifying ZKML proofs (~60-70% of proof value)
  • โœ… Automated workflow: Verify proofs in ~30 seconds (vs. 30 minutes manual review)
  • โœ… Remote work: Software-based verification from anywhere
  • โœ… Reputation marketplace: Build on-chain reputation score (0-1000 scale)
  • โœ… High throughput: Process 60-120 proofs per hour with EZKL automation

Why it matters: Traditional income verification is manual, time-consuming, and low-margin. zkSalaria creates a new verification marketplace where auditors provide cryptographic attestations, earn reputation-based fees, and scale through automation. High-reputation auditors command premium fees and higher volume.

Auditor Incentives:

  • Direct fees: Earn 60-70% of proof lifecycle value
  • Reputation multiplier: Higher reputation = premium fees
  • Market dynamics: Compete on speed, quality, and specialization
  • Future evolution: Transition to value-added services as verification becomes trustless

๐Ÿ”‘ How It Works (3-Step Flow)

STEP 1: Company Pays Employee (Private & Encrypted)

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Company  โ”‚ Deposits funds โ†’ zkSalaria Contract
โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”˜
     โ”‚ Pays $7,500/month (ENCRYPTED)
     โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Blockchain       โ”‚ Stores:
โ”‚ (Midnight)       โ”‚ - Company balance: ENCRYPTED โœ…
โ”‚                  โ”‚ - Employee balance: ENCRYPTED โœ…
โ”‚                  โ”‚ - Payment amount: ENCRYPTED โœ…
โ”‚                  โ”‚ - Payment history: ENCRYPTED (12 months) โœ…
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Key Privacy: All amounts encrypted. Nobody (not even validators) can see exact salaries.


STEP 2: Employee Generates ZKML Income Proof (Off-Chain)

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Employee โ”‚ Fetches encrypted payment history
โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”˜
     โ”‚ Decrypts locally (data never leaves machine)
     โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ EZKL ZKML Model  โ”‚ Runs on employee's machine
โ”‚ (ONNX Neural Net)โ”‚ Generates ZK proof in ~0.5 seconds
โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
     โ”‚
     โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Income Proof Generated     โ”‚
โ”‚ Type 1: Threshold          โ”‚ "I earn โ‰ฅ $4,000/month"
โ”‚ Type 2: Range              โ”‚ "I earn $8K-$10K/month"
โ”‚ Type 3: Average            โ”‚ "Avg income โ‰ฅ $11K/month"
โ”‚ Type 4: Credit Score       โ”‚ "Payment score โ‰ฅ 600"
โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
     โ”‚
     โ”‚ Sends to Auditor
     โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Auditor      โ”‚ Validates EZKL proof
โ”‚ (Deloitte)   โ”‚ Signs attestation
โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
     โ”‚
     โ–ผ

STEP 3: Smart Contract Validates & Stores Proof (On-Chain)

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Employee โ”‚ Submits proof + auditor signature
โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”˜
     โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ zkSalaria Contract      โ”‚ Validates:
โ”‚ (Midnight Blockchain)   โ”‚ โœ“ Auditor is trusted (whitelist)
โ”‚                         โ”‚ โœ“ History commitment matches blockchain
โ”‚                         โ”‚ โœ“ Proof type valid (1-4)
โ”‚                         โ”‚ โœ“ No replay attack
โ”‚                         โ”‚
โ”‚                         โ”‚ Updates auditor reputation:
โ”‚                         โ”‚ - total_verifications++
โ”‚                         โ”‚ - score = (โœ“/total) ร— 1000
โ”‚                         โ”‚
โ”‚                         โ”‚ Stores proof โœ…
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
          โ”‚
          โ”‚ Later: Bank verifies
          โ–ผ
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚ Bank       โ”‚ Calls: verifyIncomeProof()
    โ”‚            โ”‚ Returns: โœ… TRUE (threshold met)
    โ”‚            โ”‚
    โ”‚            โ”‚ Bank NEVER sees exact salary!
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ” Security Model (4 Protection Layers)

1๏ธโƒฃ History Commitment Binding โœ…

Prevents fake payment data

// Smart contract verifies:
computed_commitment = hash(on-chain_payment_history)
if (proof.history_commitment != computed_commitment) {
  return false; // REJECTED - Employee tried to use fake data!
}

2๏ธโƒฃ Auditor Reputation System โœ…

Incentivizes honest behavior

  • Starts at 1000/1000 (perfect score)
  • Each verification updates: score = (successful / total) ร— 1000
  • High reputation = more clients = more revenue
  • Bad auditors lose reputation and market access

3๏ธโƒฃ Legal Accountability โœ…

Licensed professionals with liability

  • Auditors are licensed CPAs/firms (stored: license #, name, type)
  • Can be sued for fraud
  • Professional licenses can be revoked
  • Real-world legal consequences

4๏ธโƒฃ Whitelisting & Deactivation โœ…

Admin control over auditor access

  • Only whitelisted auditors can verify proofs
  • Misbehaving auditors can be deactivated instantly
  • Company/governance controls who can verify

โš–๏ธ Security Trade-offs: What IS and ISN'T Cryptographically Enforced

โœ… Cryptographically Protected (Strong Guarantees)

Payment Data Integrity:

  • โœ… History commitment binding - Employee CANNOT use fake payment data
  • โœ… On-chain verification - Proof must match actual blockchain payment history
  • โœ… Tamper-proof - Cryptographic hash prevents data manipulation

This is the MOST critical protection - prevents the highest-risk fraud vector (fake salary claims).


โš ๏ธ Not Cryptographically Enforced (Mitigated by Incentives)

Auditor Verification Enforcement:

  • โš ๏ธ Gap: Auditor could theoretically sign without checking EZKL proof validity
  • โš ๏ธ No on-chain verification - Contract trusts auditor's signature (doesn't verify proof math on-chain)

Why This Gap Exists:

  • Midnight blockchain doesn't yet support pairing functions (BLS12-381, KZG verification)
  • On-chain EZKL verification requires cryptographic primitives not available in Compact

Why This Is Acceptable for MVP:

  1. Reputation System (Economic Incentive)

    • Lazy auditor gets caught via sample audits, disputes, pattern analysis
    • Reputation score drops โ†’ Less clients โ†’ Less revenue
    • Market forces punish dishonest behavior
  2. Legal Accountability (Real-world Consequences)

    • Licensed CPAs have professional liability insurance
    • Can be sued for negligence/fraud ($millions in damages)
    • Criminal prosecution for intentional fraud
    • Professional licenses revoked (career-ending)
  3. Admin Controls (Governance Layer)

    • Misbehaving auditors deactivated immediately
    • Community governance enforces quality standards
    • Random sample audits catch lazy verifiers
  4. History Commitment Still Protects (Cryptographic Fallback)

    • Even if auditor doesn't verify proof, they can't fake payment data
    • Employee must use real blockchain history
    • Most fraud vectors still prevented

Risk Assessment:

Worst case scenario: Auditor signs invalid proof
- Employee still can't fake payment amounts (history commitment prevents this)
- Auditor faces reputation loss, legal liability, deactivation
- Probability: LOW (strong disincentives)
- Impact: MEDIUM (proof may not meet threshold, but no fake data)
- Overall Risk: ACCEPTABLE for MVP

๐Ÿ”ฎ Future: Fully Trustless Verification

When Midnight adds cryptographic primitives:

  • โœ… BLS12-381 pairing operations
  • โœ… KZG commitment verification
  • โœ… On-chain SNARK verifiers

Then:

Employee โ†’ EZKL Proof โ†’ Smart Contract Verifier โ†’ โœ… Cryptographically Verified
                              โ†‘
                  (No auditor needed - pure math!)

Benefits:

  • โœ… Auditor CANNOT skip verification (on-chain enforcement)
  • โœ… Zero trust assumptions (fully cryptographic)
  • โœ… Auditors evolve to value-added services (compliance, model validation)

Timeline: See Evolution Roadmap


๐Ÿ“Š System Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Frontend (React + Material-UI)                                 โ”‚
โ”‚ - Company dashboard, employee portal, auditor selection        โ”‚
โ”‚ Status: Work in Progress                                       โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                             โ”‚
                             โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ API Layer (TypeScript + RxJS)                                  โ”‚
โ”‚ - Type-safe contract wrapper, reactive state management        โ”‚
โ”‚ Coverage: 20/20 circuits (100%)                                โ”‚
โ”‚ Status: โœ… COMPLETED                                           โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                             โ”‚
                             โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Smart Contracts (Compact Language)                             โ”‚
โ”‚ - 13 active circuits, encrypted ledger, multi-party privacy    โ”‚
โ”‚ Tests: 120 passing + 10 skipped                                โ”‚
โ”‚ Status: โœ… COMPLETED                                           โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                             โ”‚
                             โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Blockchain (Midnight Network)                                  โ”‚
โ”‚ - Privacy-preserving blockchain with zero-knowledge proofs     โ”‚
โ”‚ Status: โœ… TESTNET DEPLOYED                                    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ ZKML Layer (EZKL + Python) - PARALLEL EXECUTION                โ”‚
โ”‚ - 4 ONNX models, ~0.5s proof generation, ~20ms verification    โ”‚
โ”‚ Tests: 23 E2E tests with real EZKL proofs                      โ”‚
โ”‚ Status: โœ… COMPLETED                                           โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿš€ Quick Start

# Install dependencies
npm install

# Compile contracts
npm run compile

# Run tests (130 tests)
npm test

# Start UI (local network)
npm run payroll-ui:local

Open http://localhost:5173 in Chrome with Lace Wallet set to "Undeployed" network.


๐Ÿ“‹ 13 Active Circuits

Basic Payroll Operations (5 circuits)

  1. deposit_company_funds - Company deposits tokens for payroll
  2. add_employee - Onboard employee with employment record
  3. pay_employee - Single payment with encrypted amount
  4. withdraw_employee_salary - Employee withdraws earned salary
  5. mint_tokens - Test helper for token creation

Recurring Payment System (5 circuits)

  1. create_recurring_payment - Setup automated salary (weekly/bi-weekly/monthly)
  2. process_recurring_payment - Execute scheduled payment
  3. pause_recurring_payment - Temporarily suspend
  4. resume_recurring_payment - Reactivate paused payment
  5. edit_recurring_payment - Modify amount/schedule

ZKML Income Proof System (3 circuits)

  1. register_trusted_verifier - Whitelist auditor with metadata (name, license, type)
  2. submit_income_proof - Employee submits ZK proof with auditor signature
  3. verify_income_proof - Verifier validates proof meets requirements

๐ŸŽฏ 4 Income Proof Types

Type Description Use Case Example
1. THRESHOLD Prove income โ‰ฅ amount Loan approval "I earn โ‰ฅ $4,000/month"
2. RANGE Prove income in range [min, max] Credit products "I earn $8K-$10K/month"
3. AVERAGE Prove avg income โ‰ฅ amount (12 months) Lease agreements "Avg income โ‰ฅ $11K/month"
4. CREDIT SCORE Prove ML-calculated score โ‰ฅ threshold Creditworthiness "Payment score โ‰ฅ 600"

All proofs generated in ~0.5 seconds using EZKL


๐Ÿงฉ Modular ZKML Architecture - No Contract Redeployment Needed

๐Ÿš€ Key Innovation: Infinite Proof Types Without Smart Contract Changes

Unlike traditional systems, zkSalaria can add unlimited new ML models without redeploying smart contracts.

How It Works:

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ ZKML Models (Off-Chain) - Can be added anytime             โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ โœ“ income_above_threshold.onnx                               โ”‚
โ”‚ โœ“ income_range.onnx                                         โ”‚
โ”‚ โœ“ average_income.onnx                                       โ”‚
โ”‚ โœ“ credit_score.onnx                                         โ”‚
โ”‚ โœ“ pay_bias_detector.onnx           โ† Add without deploymentโ”‚
โ”‚ โœ“ fraud_detection.onnx              โ† Add without deploymentโ”‚
โ”‚ โœ“ income_stability.onnx             โ† Add without deploymentโ”‚
โ”‚ โœ“ [any future model].onnx           โ† Add without deploymentโ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                        โ†“
            (EZKL generates ZK proof)
                        โ†“
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Smart Contract (On-Chain) - Never needs redeployment       โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ โœ“ Validates proof structure (generic)                       โ”‚
โ”‚ โœ“ Checks auditor signature                                  โ”‚
โ”‚ โœ“ Verifies history commitment                               โ”‚
โ”‚ โœ“ Stores proof metadata                                     โ”‚
โ”‚                                                              โ”‚
โ”‚ Contract is MODEL-AGNOSTIC! โœ…                              โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Why This Matters:

  • โœ… No upgrade risk: Smart contract stays immutable and secure
  • โœ… Fast innovation: Deploy new models in hours, not months
  • โœ… Lower costs: No gas fees for contract redeployment
  • โœ… Backward compatible: Old proofs still work with new models
  • โœ… Auditor specialization: Different auditors can support different model types

๐Ÿ”ฌ Future ML Models (No Contract Changes Required)

Pay Equity & Fairness

Model: pay_bias_detector.onnx

  • Use case: Employee proves "I'm paid fairly compared to peers with similar experience"
  • Input: Employee's salary, years of experience, job role, industry benchmarks
  • Output: ZK proof that compensation is within ยฑ15% of fair market value
  • Beneficiary: Employees fighting discrimination, companies proving fair pay practices

Example:

Alice (5 years experience, Software Engineer):
Proof: "My salary is within fair range for my role/experience"
Bank/Court sees: โœ… TRUE (compensation is fair)
Bank/Court NEVER sees: Exact salary ($95,000)

Fraud Detection & Risk Assessment

Model: fraud_detection.onnx

  • Use case: Verifier proves "This income pattern shows no fraud indicators"
  • Input: 12 months payment history, timing patterns, amount variance
  • Output: ZK proof that fraud score < 0.1 (no suspicious patterns)
  • Beneficiary: Lenders avoiding fraudulent loan applications

Fraud Signals Detected:

  • Sudden income spikes before loan application
  • Round-number payments (e.g., exactly $5,000 every month)
  • Irregular payment timing
  • Inconsistent employer patterns

Example:

Bob applies for mortgage:
Proof: "My income has fraud_score < 0.1"
Lender sees: โœ… TRUE (income pattern is legitimate)
Lender NEVER sees: Individual payment dates or amounts

Income Stability Prediction

Model: income_stability.onnx

  • Use case: Landlord proves "Tenant's income is stable for next 12 months"
  • Input: Payment history, trend analysis, seasonal adjustments
  • Output: ZK proof that income_stability_score โ‰ฅ 0.85
  • Beneficiary: Landlords assessing long-term rental risk

Stability Factors:

  • Income trend (increasing/decreasing/flat)
  • Payment consistency (variance < 10%)
  • Employment duration
  • Seasonal income patterns (freelancers, gig workers)

Example:

Carol (freelancer, variable income):
Proof: "My income stability score โ‰ฅ 0.85"
Landlord sees: โœ… TRUE (income is stable despite fluctuations)
Landlord NEVER sees: Exact monthly amounts or client details

Tax Bracket Verification

Model: tax_bracket_verifier.onnx

  • Use case: Prove "I'm in the 22% federal tax bracket" for tax planning
  • Input: Annual income, deductions, filing status
  • Output: ZK proof of tax bracket without revealing exact income
  • Beneficiary: Financial planners, tax optimization services

Example:

David earns $89,000 (22% bracket):
Proof: "I'm in 22% tax bracket"
Financial advisor sees: โœ… Tax bracket confirmed
Financial advisor NEVER sees: Exact income ($89,000)

Debt-to-Income Ratio

Model: debt_to_income.onnx

  • Use case: Mortgage lender proves "DTI ratio < 43%" without seeing debts or income
  • Input: Monthly income, existing debt payments (provided privately)
  • Output: ZK proof that DTI < 43%
  • Beneficiary: Lenders evaluating mortgage applications

Example:

Emma applies for $400K mortgage:
Proof: "My DTI ratio < 43%"
Lender sees: โœ… TRUE (qualifies for mortgage)
Lender NEVER sees: Exact income or debt amounts

Employment Gap Detection

Model: employment_continuity.onnx

  • Use case: Prove "No employment gaps > 3 months in last 2 years"
  • Input: Payment history timestamps, employment records
  • Output: ZK proof of continuous employment
  • Beneficiary: Employers during hiring, immigration applications

Example:

Frank (job applicant):
Proof: "No employment gaps > 3 months"
Employer sees: โœ… TRUE (continuous work history)
Employer NEVER sees: Previous employer names or exact dates

Savings Capacity Prediction

Model: savings_capacity.onnx

  • Use case: Investment advisor proves "Client can save โ‰ฅ $1,000/month"
  • Input: Income history, estimated living expenses (optional private input)
  • Output: ZK proof of savings capacity
  • Beneficiary: Financial advisors, retirement planning services

Example:

Grace (retirement planning):
Proof: "I can save โ‰ฅ $1,000/month for retirement"
Advisor sees: โœ… TRUE (can afford retirement plan)
Advisor NEVER sees: Exact income or current savings

Multi-Employer Income Aggregation

Model: multi_employer_aggregator.onnx

  • Use case: Gig worker proves "Combined income from all jobs โ‰ฅ $5,000/month"
  • Input: Payment histories from multiple employers/platforms
  • Output: ZK proof of aggregate income
  • Beneficiary: Gig workers with multiple income streams

Example:

Hannah (Uber + DoorDash + Upwork):
Proof: "Combined income โ‰ฅ $5,000/month"
Lender sees: โœ… TRUE (meets income requirement)
Lender NEVER sees: Individual platform earnings or employer count

Seasonal Income Adjustment

Model: seasonal_income_normalizer.onnx

  • Use case: Seasonal worker proves "Annualized income โ‰ฅ $60,000"
  • Input: Seasonal payment patterns, work months per year
  • Output: ZK proof of normalized annual income
  • Beneficiary: Teachers, construction workers, seasonal employees

Example:

Ian (teacher, 9-month salary):
Proof: "Annualized income โ‰ฅ $60,000"
Lender sees: โœ… TRUE (meets annual threshold)
Lender NEVER sees: Monthly salary or work schedule

๐ŸŽจ How to Add a New Model (3 Steps)

1. Train ONNX Model (Off-Chain)

# zkml/payroll/models/pay_bias_detector.py
import onnx
model = train_ml_model(training_data)
onnx.save(model, "pay_bias_detector.onnx")

2. Generate EZKL Proof Keys (Off-Chain)

cd zkml/payroll
python generate_all_models.py --model pay_bias_detector
# Creates: pay_bias_detector_pk.key, pay_bias_detector_vk.key

3. Deploy via API (No Smart Contract Changes!)

// Employees can immediately use new model
const proof = await generateIncomeProof({
  proofType: 5, // NEW: Pay bias detection
  threshold: 0.85,
  paymentHistory: employeePayments
});

// Auditor validates and signs
await auditor.validateAndSign(proof);

// Submit to SAME smart contract (no redeployment!)
await contract.submit_income_proof(proof);

That's it! New proof type available to all users without touching the smart contract.


๐Ÿ’ก Why This Architecture is Revolutionary

Traditional Smart Contract Systems:

New feature โ†’ Redeploy contract โ†’ Audit code โ†’ Migrate data โ†’ Risk of bugs
Timeline: 3-6 months
Cost: $50,000 - $500,000 (audit + gas fees)

zkSalaria Modular System:

New ONNX model โ†’ Train & deploy โ†’ Users can immediately use
Timeline: 1-3 days
Cost: $0 (no contract changes)

Benefits for Ecosystem:

  • ๐Ÿข Companies: Add custom models for specific industries
  • ๐Ÿ‘จโ€๐Ÿ’ผ Employees: More proof types = more use cases
  • ๐Ÿฆ Verifiers: Choose proof types that match requirements
  • ๐Ÿ” Auditors: Specialize in specific model types (fraud, bias, etc.)
  • ๐ŸŒ Network: Faster innovation without governance overhead

๐Ÿ—๏ธ Project Structure

zkSalaria/
โ”œโ”€โ”€ payroll-contract/     # Smart contracts (Compact) - 13 circuits
โ”œโ”€โ”€ payroll-commons/      # Shared types and utilities
โ”œโ”€โ”€ payroll-api/          # TypeScript API layer (100% coverage)
โ”œโ”€โ”€ payroll-ui/           # React frontend (Material-UI)
โ”œโ”€โ”€ zkml/                 # ZKML proof generation (EZKL)
โ”‚   โ””โ”€โ”€ payroll/          # 4 ONNX income proof models
โ”œโ”€โ”€ zkml-verifier/        # ZKML verification service
โ””โ”€โ”€ docs/                 # Documentation
    โ”œโ”€โ”€ technical/        # Implementation specs
    โ””โ”€โ”€ design/           # UI wireframes

๐Ÿงช Testing

# Run all tests (130 tests)
npm test

# Contract tests only
cd payroll-contract && npm test

# API tests
cd payroll-api && npm test

# ZKML tests (requires Python env)
cd zkml/payroll && python test_proof_generation.py

Test Coverage:

  • 44 calendar utility tests
  • 61 multi-party payroll tests
  • 23 ZKML integration tests (E2E with real EZKL proofs)
  • 10 batch payment tests (skipped - testnet performance)

๐ŸŽฌ Demo Scenario

Alice needs a $10,000 loan. Bank requires proof of income โ‰ฅ $4,000/month.

Traditional Way (3-5 days)

  1. Alice requests paystubs from company HR
  2. HR emails paystubs (security risk!)
  3. Alice uploads to bank portal
  4. Bank manually reviews documents
  5. Alice's exact salary ($7,500) exposed
  6. โฑ๏ธ 3-5 day wait

zkSalaria Way (~30 seconds)

  1. Alice fetches encrypted payment history from blockchain
  2. Alice generates ZKML proof locally: "I earn โ‰ฅ $4,000/month"
  3. Auditor (Deloitte) validates proof and signs (30 sec)
  4. Alice submits proof to zkSalaria contract
  5. Bank calls verifyIncomeProof() โ†’ โœ… TRUE
  6. Alice's exact salary ($7,500) stays private
  7. โšก Instant approval

Privacy win: Alice got loan approval without revealing she earns $7,500/month.


๐Ÿ’ฐ Business Model & Auditor Marketplace

Three-Sided Marketplace

Employees โ†”๏ธ Auditors โ†”๏ธ Verifiers

Fee Distribution:

  • Auditor: ~60-70% (verification work)
  • Protocol: ~25-30% (infrastructure)
  • Staking Rewards: ~5-10% (future)

Auditor Earning Potential:

  • Throughput: 60-120 proofs/hour (~30 sec each)
  • Automation: EZKL handles proof validation
  • Reputation multiplier: High reputation = premium fees
  • Market competition: Quality, speed, specialization

Why Auditors Participate:

  • New revenue stream from emerging market
  • Remote, software-based work
  • Build reputation in decentralized ecosystem
  • Scale through automation (vs. manual review)

See detailed business model โ†’


๐Ÿ”ฎ Future: Evolution to Trustless Verification

Current (MVP): Auditor-Based

Employee โ†’ EZKL Proof โ†’ Auditor Verification โ†’ Contract
                             โ†‘
                    (Trust assumption)

Why auditors now: Midnight doesn't yet support pairing functions for on-chain EZKL verification.

Future: Hybrid Model

Trustless Tier: Basic proofs (Types 1-3) verified on-chain
Premium Tier: Advanced proofs + compliance audits by CPAs

When Midnight adds cryptographic primitives:

  • โœ… BLS12-381 pairing operations
  • โœ… KZG commitment verification
  • โœ… Recursive SNARK verification

Auditors evolve to:

  • Compliance & regulatory auditing
  • ML model validation & certification
  • Dispute resolution & forensics
  • Enterprise integration services

See full evolution roadmap โ†’


๐Ÿ† Competitive Advantages

vs Traditional Payroll (Gusto, ADP)

  • โœ… Privacy: Amounts encrypted on-chain vs. plaintext databases
  • โœ… Income proofs: Cryptographic vs. manual document verification
  • โœ… No breach risk: No central database to hack

vs Other Blockchain Payroll

  • โœ… ZKML integration: 4 proof types, not just basic ZK
  • โœ… Production-ready: 130 tests passing, real EZKL proofs
  • โœ… Auditor marketplace: Reputation system + economic incentives

vs Manual Income Verification

  • โœ… Instant: ~30 seconds vs. 3-5 days
  • โœ… No fraud: Cryptographic proofs can't be forged
  • โœ… 99% cost reduction: Automated vs. manual review

๐Ÿ“Š Current Status (November 2025)

โœ… Completed:

  • Smart contracts (13 circuits, 130 tests)
  • API layer (100% circuit coverage, 41 tests)
  • ZKML integration (4 proof types, 23 E2E tests)
  • Auditor verification system with reputation tracking
  • Encrypted payment history system
  • Recurring payment automation

๐Ÿ”„ In Progress:

  • UI development (company dashboard, employee portal)
  • Auditor selection interface
  • Demo preparation

โธ๏ธ Future:

  • Mainnet deployment
  • Production auditor onboarding
  • Advanced ML models (fraud detection, income prediction)

๐Ÿ“š Documentation

External Resources:


๐Ÿ› ๏ธ Development

# Development mode with hot reload
npm run dev:local

# Compile contracts after changes
npm run compile

# Type checking
npm run typecheck

# Build all packages
npm run build

Available Scripts

Command Description
npm run compile Compile Compact contracts
npm run payroll-ui:local Start UI on local network
npm run payroll-ui:testnet Start UI on testnet
npm run dev:local Development with hot reload
npm test Run all tests
npm run typecheck Type check all packages
npm run build Build all packages

๐ŸŽฏ Target Market

Primary:

  • Crypto-native companies paying employees in tokens
  • Privacy-conscious employees (Web3, crypto industry)
  • DeFi lending protocols requiring income verification
  • Licensed auditing firms (Big 4, regional CPAs)

Secondary:

  • Traditional companies exploring blockchain payroll
  • Banks/landlords wanting cryptographic verification
  • International workers with cross-border income

๐Ÿ“„ License

Apache License 2.0 - see LICENSE file for details.


๐Ÿ™ Acknowledgments

  • Midnight Network for privacy-preserving blockchain infrastructure
  • Input Output Global for the Midnight ecosystem
  • EZKL for zero-knowledge machine learning framework
  • The ZK cryptography community for advancing privacy technology

๐Ÿค Contributing

This is a hackathon project demonstrating privacy-preserving payroll with ZKML. Contributions welcome!

Priority areas:

  • UI/UX development (React components)
  • Additional ZKML proof types
  • Documentation and examples
  • Integration testing

Built for Midnight Finance Track Hackathon

Privacy-first payroll meets zero-knowledge machine learning

๐ŸŽฌ Watch Demo | ๐Ÿ“Š View Pitch Deck | ๐Ÿ“– Read Full Documentation

About

zkSalaria is a privacy-preserving payroll and income proof system that turns income verification into a marketplace.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors