Skip to content

adefemiesther1-debug/ShieldRoll

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

🛡️ ShieldRoll: Privacy-Preserving Global Payroll on Stellar

A privacy-preserving payroll distribution system powered by Stellar, Soroban, and Zero-Knowledge Proofs (Groth16). This system allows employers to deposit bulk sums of USDC and distribute them to employees without revealing individual salaries or linking withdrawals to the source deposit.

🚀 Overview

In a traditional transparent blockchain, payroll distributions reveal sensitive employee salary data. This project solves that by using Circom circuits to generate ZK-SNARKs that prove:

  1. Summation Integrity: The sum of all private salaries equals the public bulk deposit.
  2. Commitment Authenticity: Each salary is correctly hashed and included in a Merkle Tree root.
  3. Double-Spend Protection: Each "note" can only be withdrawn once via a cryptographic Nullifier.

🏗️ Core Components

1. ZK Circuits (/circuits)

  • payroll.circom: The "Employer" circuit. It proves that a list of private salaries ${s_1, s_2, ..., s_n}$ sums up to a public $Total$ and generates a Merkle root of commitments.
  • withdraw.circom: The "Employee" circuit. It proves that the user knows the preimage of a commitment in the tree and generates a unique nullifier to claim their USDC.

2. Soroban Smart Contract (/contract)

  • BN254 Optimization: Leveraging Stellar Protocol 25's native pairing_check host functions for gas-efficient proof verification.
  • Nullifier Set: An on-chain registry that prevents any note from being double-claimed.
  • Stellar Asset Integration: Fully compatible with USDC and other SEP-24/SAC tokens.

3. Client-Side Proof Generator (/client)

  • CSV Processing: Automatically parses employee records.
  • Poseidon Hashing: Generates ZK-friendly commitments.
  • Proof Generation: Uses SnarkJS to generate Groth16 proofs for the Stellar network.

🛠️ Getting Started

Prerequisites

Installation

git clone <this-repo>
cd stellar-privacy-payroll
npm install

Circuit Compilation & Setup

# Compile the summation circuit
circom circuits/payroll.circom --wasm --r1cs -o ./build

# Run trusted setup (Powers of Tau) - simplification
snarkjs groth16 setup build/payroll.r1cs ptau/powersOfTau28_hez_final_15.ptau payroll_final.zkey

Running the Payroll

  1. Fill client/salaries.csv with 100 employee salaries.
  2. Run npx ts-node client/proof_gen.ts to generate the bulk deposit proof.
  3. Submit the proof and the root to the Soroban contract via deposit.
  4. Employees can then use their individual secrets to withdraw privately.

🔐 Security & Privacy

  • Anonymity Set: Withdrawals are 1-of-100 anonymous within the Merkle root.
  • Resistance: Proofs are bound to the recipient address to prevent front-running/hijacking.
  • Integrity: Mathematical constraints ensure the employer cannot deposit less than the promised salaries.

📜 License

MIT

About

ShieldRoll is a decentralized payroll orchestration engine built on the Stellar Network using Soroban smart contracts and Zero-Knowledge Proofs (zk-SNARKs). It allows organizations to execute bulk global payments while keeping individual salary amounts confidential from the public ledger.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors