Reference
Contracts reference
The Solidity surface in @shh/contracts: the two pools, the on-chain Poseidon Merkle tree, the association-set provider, the bridge contracts, and the generated Groth16 verifiers.
@shh/contracts is a Hardhat (TypeScript) project. Verifiers are generated from the circuits and never hand-edited; everything else is purpose-written and tested against the SDK.
Pools & tree
PrivacyPool.sol- Fixed-denomination pool with ASP-gated withdrawals.
deposit(commitment)andwithdraw(proof, roots, nullifierHash, recipient, relayer, fee, refund). ShieldedPool.sol- UTXO commitments and join-split via
transact. ComputespublicAmountfrom the external amount and fee, emits encrypted outputs. MerkleTreeWithHistory.sol- On-chain incremental Poseidon tree with a ring buffer of recent roots;
isKnownRootaccepts the current or a recent historical root.
Compliance
AssociationSetProvider.sol- Publishes the
associationRootthe Privacy Pool checks against. IAssociationSetProvider.sol- The interface the pool consumes — decoupling pool logic from a specific ASP implementation.
Bridges
bridge/L1ShieldedBridge.sol- The Base-side lock that messages the L3 via the OP portal.
bridge/L2ShieldedBridge.sol- The L3-side finalizer;
finalizeShieldedDepositaccepts only the aliased L1 bridge address. libraries/AddressAliasHelper.sol- OP-style L1→L2 address aliasing used to authenticate deposits.
Verifiers (generated)
verifiers/PoolWithdrawVerifier.sol- Groth16 verifier exported from
poolWithdraw.circom. verifiers/Transaction2x2Verifier.sol- Groth16 verifier exported from the 2-in/2-out transaction circuit.
Interfaces & mocks
interfaces/—IHasher,IVerifiers,IOptimismPortal,IL2StandardBridge,IAssociationSetProvider.mocks/—MockOptimismPortal,MockL2StandardBridgefor unit-testing the bridge without a live OP stack.
Build & test
pnpm contracts:build # hardhat compile
pnpm contracts:test # 10/10 — both pools, double-spend, ASP gating,
# bidirectional bridge, front-running
pnpm deploy:local # deploy the core to the local node