Sol.College

Full lesson

solana-mixer-core

A privacy-preserving, fixed-denomination mixer on Solana, implemented in Anchor and verified with Succinct SP1.

What it does

From the project README:

A privacy-preserving, fixed-denomination mixer on Solana, implemented in Anchor and verified with Succinct SP1.
Original
2kcmte/solana-mixer-core
SuperStack fork
Blockchains/solana-mixer-core @ 3f9c5f5
Stars
2
Last push (original)
2025-11-11
Languages
Rust, TypeScript
Detected stack
Anchor
Categories
Infrastructure & Tooling
Licence
MIT

Architecture

12 source files. By extension: .rs ×11, .ts ×1.

Top-level directorySource files
tests7
programs4
migrations1

On-chain programs: programs/solana-mixer

Dapp: deploying

This fork is queued for its own live dapp on Sol.College, with a Devnet/Mainnet switch. It appears here, at /dapps/solana-mixer-core/, once it is deployed and checked on devnet. Until then, 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.

2kcmte/solana-mixer-core · programs/solana-mixer/src/lib.rs L241–264 @ 3f9c5f5 · MIT · original
        require!(            recipient.eq(&ctx.accounts.recipient.key()),            ErrorCode::InvalidInput        );        **state_info.try_borrow_mut_lamports()? -= to_recipient;        **ctx.accounts.recipient.try_borrow_mut_lamports()? += to_recipient;         emit!(WithdrawEvent {            nullifier_hash,            recipient: Pubkey::new_from_array(recipient_bytes),            relayer: Pubkey::new_from_array(relayer_bytes),            fee,            refund,        });        Ok(())    }} #[derive(Accounts)]pub struct Initialize<'info> {    #[account(        init,        seeds = [STATE_SEED],        bump,
  1. Line 241 require!(: An explicit validation that aborts the instruction with an error.
  2. Line 248 emit!(WithdrawEvent {: Emits an Anchor event that clients can parse from the logs.
  3. Line 262 init,: Creates and pays for a new account. Space and payer must be specified.
  4. Line 263 seeds = [STATE_SEED],: Declares the PDA seeds. Anchor re-derives the address and rejects the account if it doesn't match.
  5. Line 264 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
.npm run lintprettier */*.js "*/**/*{.js,.ts}" --check
.anchor buildcompile programs and generate IDLs
.anchor testlocal validator + test suite
.anchor run testcargo test
.cargo buildRust workspace build
.cargo testRust tests

What you could build from it