Screen wallets before deposits to prevent tainted funds from entering your privacy protocol on Solana.
Privacy protocols on Solana - mixers, privacy pools, confidential transfer
programs - face a unique challenge: they need to prevent sanctioned or stolen
funds from entering the protocol while preserving user privacy for legitimate
users. If tainted funds flow through your protocol, it taints the entire pool
and exposes your project to regulatory risk.Range’s Address Risk Score provides a
straightforward solution: screen the depositor’s wallet before accepting funds.
Block high-risk wallets at the door - before they can contaminate the pool.
Privacy and compliance are not mutually exclusive. Screening depositors (not
tracking what happens inside the pool) lets you maintain privacy guarantees for
legitimate users while blocking bad actors.
User wants to deposit │ ▼┌──────────────────────────┐│ Screen depositor wallet ││ (Address Risk Score) ││ ││ riskScore 1–10 ││ Includes sanctions + ││ ML + proximity analysis │└──────────────────────────┘ │ ├── Score ≥ 7 ──────► REJECT deposit │ Show reason │ ├── Score 4–6 ──────► FLAG for review │ Optional: require │ additional verification │ └── Score 1–3 ──────► ALLOW deposit Proceed normally
Address Risk Score already includes sanctions and blacklist screening. You do
not need a separate sanctions check - OFAC-flagged and stablecoin-blacklisted
addresses are factored into the risk score.
Before accepting a deposit, check the wallet’s risk score. This single API call
covers malicious proximity, ML-based behavioral analysis, sanctions, and
blacklist screening.
For protocol-level enforcement that can’t be bypassed by calling the program
directly, use the
Onchain Risk Verifier. This verifies
risk scores inside your Solana program using Switchboard oracles:
Copy
// In your deposit instruction handler:let risk_score = verified_feed.value(); // 0–100 scale (original 0–10 × 10)// Reject deposits from high-risk walletsif risk_score >= 70 { return Err(ErrorCode::HighRiskDepositor.into());}// Proceed with deposit logic
On-chain enforcement is stronger than off-chain screening alone. Users can
bypass your frontend, but they can’t bypass your program’s instruction logic.
For maximum protection, use both: off-chain screening for UX (show the user
why they’re blocked) and on-chain verification as the enforcement layer.
Alternative: Signed message attestation. Instead of using Switchboard
oracles, you can implement a lighter-weight pattern where your backend signs
an attestation message containing the screened wallet address and a timestamp.
The Solana program then uses Ed25519 signature verification (via the Ed25519
precompile) and instruction introspection to confirm: (1) the message was
signed by your trusted attestation key, (2) the depositor matches the approved
address in the message, and (3) the timestamp is fresh. This approach trades
the decentralized oracle model for a simpler trusted-backend pattern.
The right threshold depends on your protocol’s risk tolerance and regulatory
posture:
Threshold
Rejects
Trade-off
Score ≥ 8
Only directly malicious or 1-hop addresses
Permissive - blocks clear threats, allows most users
Score ≥ 7
Addresses within 2 hops of malicious actors
Balanced - recommended starting point
Score ≥ 6
Addresses within 2 hops (with multiple malicious connections)
Strict - fewer false negatives, more false positives
Score ≥ 4
Addresses within 3 hops
Very strict - suitable for regulated environments
Setting the threshold too low (e.g., ≥ 3) will reject a significant number of
legitimate users. Many clean addresses are naturally within 4–5 hops of
flagged addresses through shared exchange or program interactions. Start with
≥ 7 and adjust based on your data.
Some addresses that interact with your protocol will be system programs, token
programs, or exchange hot wallets. These will have an attribution field in the
response - use it to fast-path known entities:
Copy
if (riskData.attribution) { // Verified non-malicious entity - skip further checks console.log(`Known entity: ${riskData.attribution.name_tag}`); return { decision: 'allow' };}
If you’re processing high deposit volume, see
Rate Limits & Plans for scaling options.
For on-chain enforcement via Switchboard oracles, rate limits apply to the
oracle quote requests, not the on-chain verification.