How to add OFAC screening to a DeFi frontend
Screen wallet addresses in the frontend before a user can interact with smart contracts, so blocked counterparties never reach your protocol.
TL;DR
TL;DR: Add a wallet screening call before the connect or transaction step, block flagged addresses, and explain the block to the user clearly.
Where to place the check
Run the check when a wallet connects and again before a transaction is signed. Because smart contracts cannot reach external sanctions data on their own, the frontend is the natural place to enforce the rule. OFAC's SDN List includes crypto wallets, so screen the address itself.
What a blocked interaction looks like
If the screening call returns flagged, stop the user before they approve or sign. Show a clear message that the address is blocked and do not let the transaction proceed. A clean result lets the flow continue normally.
Implementation tips
Use one HTTP call under 100 ms to keep the connect and transaction UX fast, and fail closed if the service is unreachable. SanctionsAI provides a screening API that checks 947 OFAC-listed wallets and 19,218 SDN names, with tools like sanctions_check and risk_score, plus a free tier of 5 checks per day and no key required.