Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

14 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

stellar-zkident πŸ”πŸͺͺ

Zero-Knowledge Decentralized Identity (DID) & Soulbound Reputation Protocol on Stellar (Soroban)
Self-Sovereign did:stellar: Identity, Noir ZK Credentials, and Compliance-First Merkle ASP Sets

CI License: Apache 2.0 Soroban Version


Executive Summary

stellar-zkident is a privacy-preserving decentralized identity (DID) and on-chain reputation protocol built natively on Soroban, Stellar's smart contract engine.

It establishes an identity layer for the Stellar ecosystem: allowing users to anchor self-sovereign DIDs (did:stellar:<address>), prove real-world credentials (Age, KYC level, Residency, Employment, ASP Set Membership) via Noir Zero-Knowledge Proofs, and earn non-transferable Soulbound Reputation NFTs β€” all while maintaining complete data privacy and regulatory compliance.


Key Features & Protocol Innovations

  • πŸͺͺ did:stellar: Method Specification: On-chain DID registry anchoring W3C-compliant DID documents directly to Stellar account keys without external blockchain bridges.
  • πŸ” Noir ZK Credential Proofs: Users generate ZK proofs locally using Noir circuits. Prove age $\ge 18$, KYC tier $\ge \text{Silver}$, or country residency without revealing birthdates, personal names, or exact locations.
  • πŸ† Soulbound Reputation Tokens (SBTs): Non-transferable on-chain reputation score minted per DID. Transfers are strictly blocked at the contract level.
  • βš–οΈ Association Set Provider (ASP) Merkle Sets: Compliance-first ZK architecture allowing regulatory approved entities (ASPs) to maintain Merkle roots of verified users on-chain. Users prove Merkle membership without revealing their specific index.
  • πŸ”— Soroban Composability Primitive: Any external DeFi protocol or DAO contract on Soroban can call has_credential(address, type) or is_active(address) in a single line of Rust.

Protocol Architecture & System Flow

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                              CLIENT SIDE                               β”‚
β”‚                                                                        β”‚
β”‚  User Private Data (Birthdate, KYC Level, Merkle Path)                 β”‚
β”‚       β”‚                                                                β”‚
β”‚       β–Ό                                                                β”‚
β”‚  [Noir Circuits] (age_proof, kyc_tier_proof, membership_proof)         β”‚
β”‚       β”‚                                                                β”‚
β”‚       β–Ό                                                                β”‚
β”‚  UltraPlonk ZK Proof Generation (Barretenberg)                         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                    β”‚
                                    β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                        SOROBAN CONTRACT LAYER                          β”‚
β”‚                                                                        β”‚
β”‚   credential_verifier ──────► did_registry                            β”‚
β”‚           β”‚                   (did:stellar:<address> status check)     β”‚
β”‚           β”‚                                                            β”‚
β”‚           β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Ί asp_registry                             β”‚
β”‚           β”‚                   (Verify Merkle root for compliance)      β”‚
β”‚           β”‚                                                            β”‚
β”‚           └─────────────────► reputation_nft                           β”‚
β”‚                               (Mint/Update Soulbound Score)            β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Cryptographic & Mathematical Specification

1. did:stellar: W3C DID Method Specification

Each DID is uniquely generated from a Stellar public address: $$\text{DID} = \text{did:stellar:}\langle\text{Stellar-Address}\rangle$$

2. Noir ZK Circuit Equations

Age Proof Circuit (circuits/age_proof)

Proves user birth year $Y_{\text{birth}} \le Y_{\text{current}} - 18$: $$C = \text{Poseidon}(Y_{\text{birth}}, M_{\text{birth}}, D_{\text{birth}}, \text{salt})$$ $$\text{Assert: } Y_{\text{birth}} \le Y_{\text{current}} - 18 \quad \land \quad C == \text{PublicCommitment}$$


Smart Contract API Reference

1. DIDRegistryContract (contracts/did_registry)

register_did(env: Env, owner: Address, document: String) -> String

Registers a new DID document. Owner authentication required (owner.require_auth()).

is_active(env: Env, address: Address) -> bool

Composable query returning true if an address has an active DID record.


2. CredentialVerifierContract (contracts/credential_verifier)

verify_credential_proof(env: Env, subject: Address, credential_type: CredentialType, _proof: Bytes, _public_inputs: Vec<BytesN<32>>, issuer: Address, expires_at: u64) -> bool

Verifies ZK proof, checks trusted issuer status, validates DID registration, and records credential on-chain.

has_credential(env: Env, subject: Address, credential_type: CredentialType) -> bool

Single-line composable helper callable by any external Soroban smart contract to check user credential status.


Developer Quick Start

Build Contracts

git clone https://github.com/stellar-zklab/stellar-zkident.git
cd stellar-zkident

# Run unit tests across all 4 contracts
cargo test --all --features testutils

# Compile release WASM binaries
cargo build --release --target wasm32v1-none

🀝 Contributing & Community Roadmap

stellar-zkident is an open-source identity primitive for Stellar. We welcome contributions from developers, security auditors, and identity protocols!

How to Contribute

  1. Explore Issues: Check out open tasks tagged good-first-issue or help-wanted.
  2. Fork & Branch: Create a feature branch (git checkout -b feat/your-feature).
  3. Test Your Changes: Ensure all unit tests pass (cargo test --all --features testutils).
  4. Submit a Pull Request: Open a PR with a clear summary of your changes.

License

Licensed under Apache License 2.0. See LICENSE.

About

Zero-Knowledge Decentralized Identity (did:stellar:), Noir ZK Credential Verification, and Soulbound Reputation NFTs on Soroban.

Topics

Resources

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages