BlockSafe
BlockSafe is a Web3 browser extension that scans smart contracts, dApps, and sites in real-time, giving risk scores and alerts to help users avoid scams and make secure blockchain transactions.
Created on 6th April 2025
•
BlockSafe
BlockSafe is a Web3 browser extension that scans smart contracts, dApps, and sites in real-time, giving risk scores and alerts to help users avoid scams and make secure blockchain transactions.
The problem BlockSafe solves
BlockSafe tackles several major problems in the Web3 space, where security threats are increasingly common due to the decentralized and anonymous nature of blockchain.
- Scam Smart Contracts
Many users unknowingly interact with malicious smart contracts that appear legitimate. These contracts can drain wallets, steal tokens, or grant attackers control over assets. Without technical knowledge, it's hard for users to understand what a contract truly does before signing it.
BlockSafe solves this by analyzing contract behavior and providing risk scores and warnings in real-time, helping users avoid fraudulent transactions.
- Phishing Websites
Web3 users are frequently lured to fake websites that mimic real platforms like OpenSea or MetaMask. These phishing sites trick users into entering seed phrases or signing harmful transactions.
BlockSafe detects these fake domains, checks them against blacklists and ML models, and alerts users before they fall victim.
- Malicious dApps
Some decentralized applications are designed to exploit user trust by performing unauthorized actions once connected to a wallet.
BlockSafe inspects dApp metadata and backend behavior, warning users if the app has suspicious activity or a bad reputation score.
- Lack of Real-Time Protection
Most current wallet tools do not provide live analysis of transactions. Users sign blindly.
BlockSafe offers real-time scanning of both websites and transactions, allowing users to make informed decisions instantly.
- No Unified Security Interface
Security tools in Web3 are often fragmented. BlockSafe acts as a one-stop solution, integrating threat detection, warnings, and education into a single, user-friendly browser extension.
Challenges we ran into
Bug/Hurdle Faced: Wallet Connection Interference with Web3 Providers
While building BlockSafe, one major hurdle we encountered was a conflict between our browser extension and existing Web3 providers (like MetaMask or WalletConnect). These wallet extensions inject their own window.ethereum object into websites, and our extension needed to also access transaction data from this object without disrupting or conflicting with other extensions.
The Problem:
When we attempted to intercept and scan transactions in real-time using content scripts, we faced issues like:
Breaking wallet connections to dApps.
Interfering with MetaMask’s injected scripts, leading to failed transactions or console errors.
Unexpected behavior when users had multiple wallets/extensions installed.
Root Cause:
Our content script was trying to hook into window.ethereum too early or in a way that replaced certain properties used by other extensions. This caused clashing references, leading to unpredictable results when users interacted with dApps.
The Fix:
To solve this, we implemented a proxy pattern using Object.defineProperty to wrap the window.ethereum.request method without replacing the entire object. This allowed us to:
Monitor and log key transactions, especially eth_sendTransaction and eth_sign.
Pass the original request to MetaMask without tampering with the behavior.
Avoid conflicts with other wallet extensions.
const originalRequest = window.ethereum.request;
window.ethereum.request = async function (args) {
if (args.method === 'eth_sendTransaction') {
// Trigger BlockSafe scan here
scanTransaction(args.params[0]);
}
return originalRequest.call(this, args);
};
Outcome:
With this approach, we were able to seamlessly scan and flag suspicious transactions in real-time, while maintaining full compatibility with existing wallets and dApps.
This bug not only tested our debugging skills but also taught us a lot about browser extension isolatio
Tracks Applied (1)
