Sol.College

Full lesson

hush

Solana ZK privacy protocol

What it does

From the project README:

Hush is a privacy protocol on Solana, enabling private transactions powered by zero-knowledge proofs.
Original
bidhan-a/hush
SuperStack fork
Blockchains/hush @ e800a43
Stars
1
Last push (original)
2025-06-16
Languages
TypeScript, Rust, JavaScript, Circom, Shell, CSS
Detected stack
AnchorNext.jsweb3.js
Categories
Other
Licence
MIT
Homepage
https://hush-nu.vercel.app

Architecture

43 source files. By extension: .rs ×17, .ts ×13, .tsx ×10, .js ×3.

Top-level directorySource files
ui20
programs17
circuits2
scripts2
migrations1
tests1

On-chain programs: programs/hush

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/hush/. 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.

bidhan-a/hush · programs/hush/src/instructions/create_pool.rs L1–24 @ e800a43 · MIT · original
use anchor_lang::prelude::*; use crate::errors::Error;use crate::state::{ConfigState, PoolState}; #[derive(Accounts)]#[instruction(amount: u64)]pub struct CreatePool<'info> {    #[account(mut)]    pub admin: Signer<'info>,     #[account(        seeds=[b"config"],        bump=config.bump,        constraint=config.admin.key() == admin.key() @ Error::PermissionDenied    )]    pub config: Box<Account<'info, ConfigState>>,     #[account(        init,        payer=admin,        seeds=[b"pool", amount.to_le_bytes().as_ref()],        bump,        space=PoolState::INIT_SPACE + 8
  1. Line 10 pub admin: Signer<'info>,: Requires this account to have signed the transaction.
  2. Line 13 seeds=[b"config"],: Declares the PDA seeds. Anchor re-derives the address and rejects the account if it doesn't match.
  3. Line 14 bump=config.bump,: Uses the bump seed, the extra byte that pushes the derived address off the ed25519 curve.
  4. Line 20 init,: Creates and pays for a new account. Space and payer must be specified.
bidhan-a/hush · programs/hush/src/instructions/initialize.rs L1–23 @ e800a43 · MIT · original
use anchor_lang::prelude::*; use crate::state::ConfigState; #[derive(Accounts)]pub struct Initialize<'info> {    #[account(mut)]    pub admin: Signer<'info>,     #[account(        init,        payer=admin,        seeds=[b"config"],        bump,        space=ConfigState::INIT_SPACE + 8    )]    pub config: Box<Account<'info, ConfigState>>,     #[account(        seeds=[b"treasury"],        bump    )]    pub treasury: SystemAccount<'info>,
  1. Line 8 pub admin: Signer<'info>,: Requires this account to have signed the transaction.
  2. Line 11 init,: Creates and pays for a new account. Space and payer must be specified.
  3. Line 13 seeds=[b"config"],: Declares the PDA seeds. Anchor re-derives the address and rejects the account if it doesn't match.
  4. Line 14 bump,: Uses the bump seed, the extra byte that pushes the derived address off the ed25519 curve.
bidhan-a/hush · programs/hush/src/instructions/deposit.rs L49–71 @ e800a43 · MIT · original
        init,        payer=depositor,        seeds=[b"deposit", pool.key().as_ref(), commitment.as_ref()],        bump,        space=DepositState::INIT_SPACE + 8    )]    pub deposit: Box<Account<'info, DepositState>>,     pub system_program: Program<'info, System>,} impl<'info> Deposit<'info> {    pub fn deposit(        &mut self,        amount: u64,        commitment: [u8; 32],        bumps: &DepositBumps,    ) -> Result<()> {        // Ensure the merkle tree is not full.        require!(            self.pool.next_index < (1 << TREE_HEIGHT),            Error::MerkleTreeFull        );
  1. Line 49 init,: Creates and pays for a new account. Space and payer must be specified.
  2. Line 51 seeds=[b"deposit", pool.key().as_ref(), commitment.as_ref()],: Declares the PDA seeds. Anchor re-derives the address and rejects the account if it doesn't match.
  3. Line 52 bump,: Uses the bump seed, the extra byte that pushes the derived address off the ed25519 curve.
  4. Line 68 require!(: An explicit validation that aborts the instruction with an error.
bidhan-a/hush · programs/hush/src/instructions/withdraw.rs L1–24 @ e800a43 · MIT · original
use anchor_lang::prelude::*; use crate::errors::Error;use crate::helpers::transfer_sol;use crate::state::{ConfigState, PoolState, WithdrawState};use crate::zk::verifier::verify_proof; #[derive(Accounts)]#[instruction(amount: u64, nullifier_hash: [u8; 32])]pub struct Withdraw<'info> {    #[account(mut)]    pub withdrawer: Signer<'info>,     #[account(        seeds=[b"config"],        bump=config.bump,    )]    pub config: Box<Account<'info, ConfigState>>,     #[account(        mut,        seeds=[b"pool", amount.to_le_bytes().as_ref()],        bump=pool.pool_bump,    )]
  1. Line 12 pub withdrawer: Signer<'info>,: Requires this account to have signed the transaction.
  2. Line 15 seeds=[b"config"],: Declares the PDA seeds. Anchor re-derives the address and rejects the account if it doesn't match.
  3. Line 16 bump=config.bump,: Uses the bump seed, the extra byte that pushes the derived address off the ed25519 curve.

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
uinpm run devnext dev --turbopack
uinpm run startnext start
uinpm run buildnext build
uinpm run lintnext lint
.anchor buildcompile programs and generate IDLs
.anchor testlocal validator + test suite
.anchor run testyarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts
.cargo buildRust workspace build
.cargo testRust tests

What you could build from it