Skip to content

feat: Zero-Knowledge Anonymous Provider Staking & Shielded Reputation Proofs (#427) - #429

Open
devJaja wants to merge 3 commits into
Nullifier-Systems:mainfrom
devJaja:feat/427-zk-anonymous-provider-staking
Open

feat: Zero-Knowledge Anonymous Provider Staking & Shielded Reputation Proofs (#427)#429
devJaja wants to merge 3 commits into
Nullifier-Systems:mainfrom
devJaja:feat/427-zk-anonymous-provider-staking

Conversation

@devJaja

@devJaja devJaja commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Summary

Implements a zero-knowledge shielded staking pool that allows providers to deposit collateral and verify minimum stake compliance via zk-SNARK proofs, without revealing their public wallet address.

Changes

Database Layer

  • 032_add_shielded_provider_staking.sql: Creates shielded_stake_commitments and shielded_provider_nullifiers tables with indexes

Backend

  • shielded-staking.ts: POST /provider/shielded-stake, POST /provider/shielded-stake/verify, GET status and merkle-root endpoints
  • crypto.ts: Added generateShieldedCommitment() and verifyShieldedCommitment() helpers

Concurrency Safety

  • Uses SELECT FOR UPDATE on nullifiers to prevent race-condition double-spending during concurrent verification requests

Smart Contracts

  • lib.rs: Registered shielded_staking module in the reputation contract

Frontend

  • ShieldedStakingModal.tsx: React component with multi-step flow (generate proof, deposit, verify) using Catppuccin Mocha styling

Tests

  • 9 unit tests covering: valid deposit, duplicate commitment (409), insufficient stake (400), ZK proof verification, nullifier double-spend prevention (409), invalid proof (422), commitment status, merkle root queries

Acceptance Criteria

  • Provider can deposit collateral into shielded pool without revealing public wallet address
  • ZK proof verification prevents nullifier double-spending
  • SELECT FOR UPDATE prevents concurrent race conditions on nullifier insertion
  • Invalid proofs are rejected with 422 status
  • All 57 existing API test files pass (526 tests, 0 new regressions)

Closes #427

… proofs (Nullifier-Systems#427)

- Add shielded_stake_commitments and shielded_provider_nullifiers DB tables
- Implement POST /provider/shielded-stake for depositing into shielded pool
- Implement POST /provider/shielded-stake/verify with nullifier double-spend prevention
- Add GET /provider/shielded-stake/status/:commitmentHash endpoint
- Add GET /provider/shielded-stake/merkle-root endpoint
- Implement SELECT FOR UPDATE to prevent nullifier race conditions
- Add generateShieldedCommitment and verifyShieldedCommitment crypto helpers
- Build ShieldedStakingModal React component with multi-step flow
- Add 9 passing unit tests covering deposit, verify, double-spend, and invalid proof scenarios
- Register shielded staking routes in Fastify app
@vercel

vercel Bot commented Aug 25, 2026

Copy link
Copy Markdown

@devJaja is attempting to deploy a commit to the jotelfootball-tech's projects Team on Vercel.

A member of the Team first needs to authorize it.

@jotel-dev

Copy link
Copy Markdown
Contributor

Hey @devJaja — nice work on the ZK anonymous provider staking & shielded reputation proofs feature! 👏 Contracts CI and node build are both green, but before we can merge there are a couple of things to sort out:

Merge conflicts in apps/api/src/app.ts, locales/en.json, and locales/es.json — can you resolve these against main?
Vercel deploys are failing with "Authorization required to deploy" — can you check the Vercel project permissions/env on your end? Let me know if you need access sorted out on our side.

Ping me once those are resolved and I'll get this reviewed and merged. 🙏

@vercel

vercel Bot commented Aug 26, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
velo Ready Ready Preview Aug 27, 2026 7:14pm
velo-frontend Ready Ready Preview Aug 27, 2026 7:14pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT] Zero-Knowledge Anonymous Provider Staking & Shielded Reputation Proofs

2 participants