Sol.College

Full lesson

SolsticeProtocol

Zero-knowledge identity verification on Solana - Privacy-preserving authentication using Aadhaar infrastructure

What it does

From the project README:

[](https://explorer.solana.com/address/8jrTVUyvHrL5WTWyDoa6PTJRhh3MwbvLZXeGT81YjJjz?cluster=devnet) [](LICENSE) []()
Original
Solstice-Protocol/SolsticeProtocol
SuperStack fork
Blockchains/SolsticeProtocol @ ed7ec27
Stars
2
Last push (original)
2026-07-27
Languages
JavaScript, Rust, TypeScript, PLpgSQL, Circom
Detected stack
Anchorweb3.js
Categories
Wallets & Identity
Licence
MIT

Architecture

31 source files. By extension: .js ×17, .ts ×7, .rs ×7.

Top-level directorySource files
backend15
contracts13
circuits3

On-chain programs: contracts/programs/contracts

Dapp: devnet deploy pending

⏳ Devnet deploy pending — goes live when the devnet wallet is topped up. This fork's own dapp is not deployed yet, so there is no program address or transaction to show. It is queued in dapp-queue.txt; once devnet SOL is available it is deployed, exercised with real devnet transactions, and this section switches to the live dapp at /dapps/solsticeprotocol/. Until then, the lesson and step-by-step guide below are complete, and you can run it locally with the commands below.

Key code, explained

Excerpts chosen automatically where the code uses the most Solana concepts, pinned to the fork's commit.

Solstice-Protocol/SolsticeProtocol · contracts/programs/contracts/src/instructions.rs L109–131 @ ed7ec27 · MIT · original
    pub identity: Account<'info, Identity>,        #[account(mut)]    pub user: Signer<'info>,        pub system_program: Program<'info, System>,} /// Close authentication session#[derive(Accounts)]pub struct CloseSession<'info> {    #[account(        mut,        close = user,        seeds = [b"session", user.key().as_ref(), &session.session_id],        bump = session.bump,        has_one = user @ crate::errors::ErrorCode::UnauthorizedAccess    )]    pub session: Account<'info, Session>,        #[account(mut)]    pub user: Signer<'info>,}
  1. Line 112 pub user: Signer<'info>,: Requires this account to have signed the transaction.
  2. Line 122 close = user,: Closes the account at the end of the instruction and refunds its lamports.
  3. Line 123 seeds = [b"session", user.key().as_ref(), &session.session_id],: Declares the PDA seeds. Anchor re-derives the address and rejects the account if it doesn't match.
  4. Line 124 bump = session.bump,: Uses the bump seed, the extra byte that pushes the derived address off the ed25519 curve.
  5. Line 125 has_one = user @ crate::errors::ErrorCode::UnauthorizedAccess: Checks that a stored pubkey field matches the passed account.
Solstice-Protocol/SolsticeProtocol · contracts/programs/contracts/src/lib.rs L121–144 @ ed7ec27 · MIT · original
        identity.is_verified = false;        identity.attributes_verified = 0;                msg!("Identity revoked for user: {:?}", ctx.accounts.user.key());        Ok(())    }     /// Create authentication session    pub fn create_session(        ctx: Context<CreateSession>,        session_id: [u8; 32],        expiry: i64,    ) -> Result<()> {        let session = &mut ctx.accounts.session;        let identity = &ctx.accounts.identity;        require!(identity.is_verified, ErrorCode::IdentityNotFound);        session.user = ctx.accounts.user.key();        session.session_id = session_id;        session.created_at = Clock::get()?.unix_timestamp;        session.expires_at = expiry;        session.is_active = true;        session.bump = ctx.bumps.session;                msg!("Session created for user: {:?}", ctx.accounts.user.key());
  1. Line 124 msg!("Identity revoked for user: {:?}", ctx.accounts.user.key());: Logs to the program log, which is visible in explorers and the test output.
  2. Line 136 require!(identity.is_verified, ErrorCode::IdentityNotFound);: An explicit validation that aborts the instruction with an error.
  3. Line 139 session.created_at = Clock::get()?.unix_timestamp;: Reads on-chain time from the Clock sysvar.
  4. Line 142 session.bump = ctx.bumps.session;: Uses the bump seed, the extra byte that pushes the derived address off the ed25519 curve.
Solstice-Protocol/SolsticeProtocol · contracts/programs/contracts/src/groth16_verifier.rs L13–36 @ ed7ec27 · MIT · original
/// /// # Returns/// * `Result<bool>` - True if proof is valid, error otherwisepub fn verify_groth16_proof(    proof_bytes: &[u8],    public_inputs_bytes: &[u8],    attribute_type: u8,) -> Result<bool> {    // Select verification key based on attribute type    let vk_struct = match attribute_type {        1 => &AGE_PROOF_VK,        2 => &NATIONALITY_PROOF_VK,        4 => &UNIQUENESS_PROOF_VK,        _ => return Err(error!(crate::errors::ErrorCode::InvalidPublicInputs)),    };     msg!("Verifying Groth16 proof for attribute type: {}", attribute_type);        // Validate input lengths    require!(proof_bytes.len() == 256, crate::errors::ErrorCode::InvalidProof);    require!(!public_inputs_bytes.is_empty(), crate::errors::ErrorCode::InvalidPublicInputs);    require!(public_inputs_bytes.len() % 32 == 0, crate::errors::ErrorCode::InvalidPublicInputs);        let num_inputs = public_inputs_bytes.len() / 32;
  1. Line 29 msg!("Verifying Groth16 proof for attribute type: {}", attribute_type);: Logs to the program log, which is visible in explorers and the test output.
  2. Line 32 require!(proof_bytes.len() == 256, crate::errors::ErrorCode::InvalidProof);: An explicit validation that aborts the instruction with an error.
Solstice-Protocol/SolsticeProtocol · contracts/programs/contracts/src/compression.rs L121–143 @ ed7ec27 · MIT · original
    // nullifier = Poseidon(identity_commitment || secret)    // This matches the circuit implementation: component nullifier = Poseidon(2)        let nullifier = poseidon_hash(&[        identity_commitment,        secret    ])?;        msg!("Generated Poseidon nullifier for Sybil resistance");        Ok(nullifier)} /// Decompress identity data for verification/// This proves ownership of compressed data without revealing the full datapub fn verify_compressed_identity(    _compressed_identity: &CompressedIdentity,    proof: &[u8],) -> Result<bool> {    // Verify that the compressed state matches the Merkle root    // This uses a ZK proof to verify inclusion without revealing the data        require!(proof.len() > 0, crate::errors::ErrorCode::InvalidProof);
  1. Line 129 msg!("Generated Poseidon nullifier for Sybil resistance");: Logs to the program log, which is visible in explorers and the test output.
  2. Line 143 require!(proof.len() > 0, crate::errors::ErrorCode::InvalidProof);: An explicit validation that aborts the instruction with an error.

How to run, build and test

These commands come from the repo's own manifests (package.json scripts, Anchor.toml, Cargo, go.mod, Makefile). Check the README for prerequisites and environment variables.

DirectoryCommandRuns
contractsnpm run lintprettier */*.js "*/**/*{.js,.ts}" --check
backendnpm run devnodemon src/index.js
backendnpm run startnode src/index.js
backendnpm run testecho "Error: no test specified" && exit 1
circuitsnpm run buildmkdir -p build && npm run compile:all && npm run setup:all && npm run export:vkeys
contractsanchor buildcompile programs and generate IDLs
contractsanchor testlocal validator + test suite
contractsanchor run testyarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts

What you could build from it