Real-time bridge security monitoring tool that analyzes TVL changes, tracks large withdrawals, and generates comprehensive safety scores (0-100) to detect exploits and help users avoid compromised bridges. Monitors Stargate, Wormhole/Portal, Across, Hop, and major cross-chain bridges using on-chain data and multi-dimensional risk assessment.
Real-time bridge security monitoring tool that analyzes TVL changes, tracks large withdrawals, and generates comprehensive safety scores (0-100) to detect exploits and help users avoid compromised bridges. Monitors Stargate, Wormhole/Portal, Across, Hop, and major cross-chain bridges using on-chain data and multi-dimensional risk assessment.
[{"name":"bridge_id","type":"string","required":true,"description":"Bridge protocol to analyze (stargate, portal, across, hop, synapse)","example":"stargate"},{"name":"chain","type":"string","required":false,"default":"ethereum","description":"Blockchain network (ethereum, arbitrum, optimism, polygon, base)","example":"ethereum"},{"name":"time_window_hours","type":"integer","required":false,"default":24,"description":"Time window for TVL comparison in hours","example":24},{"name":"blocks_to_scan","type":"integer","required":false,"default":1000,"description":"Number of recent blocks to scan for withdrawals","example":1000},{"name":"detailed","type":"boolean","required":false,"default":false,"description":"Include detailed analysis breakdown in response","example":true}]
difficulty
intermediate
estimated_time
10-30 seconds per analysis
Bridge Security Watchdog
Overview
The Bridge Security Watchdog is a critical safety tool that monitors Lock-and-Mint bridge protocols (Stargate, Wormhole/Portal, Across, Hop) for large or suspicious withdrawals before users interact with them. By combining TVL monitoring, withdrawal pattern detection, and historical stability analysis, it provides actionable safety scores (0-100) to help users avoid compromised bridges.
What Makes This Unique
Unlike simple TVL trackers, this skill actively watches for exploit indicators:
Real-time TVL drain detection: Spots sudden liquidity drops that may indicate exploits
Large withdrawal monitoring: Tracks unusual token movements from bridge contracts
Pattern recognition: Identifies rapid withdrawal sequences characteristic of exploits
Multi-dimensional scoring: Combines TVL, withdrawals, history, and volume for comprehensive safety assessment
Problem Solved
Bridge exploits have resulted in billions in losses (Wormhole: $326M, Nomad: $190M, Ronin: $625M). Users need pre-transaction safety checks before committing funds to bridges. This skill provides:
Pre-Bridge Safety Check: "Is this bridge safe to use RIGHT NOW?"
Exploit Detection: Identifies bridges actively being drained
Comparative Analysis: "Which bridge is safest for my transfer?"
Risk Quantification: Clear 0-100 safety scores with actionable recommendations
Core Features
1. TVL Monitoring (bridge_tvl_monitor.py)
Monitors Total Value Locked changes across bridge protocols using DefiLlama API.
Capabilities:
Real-time TVL tracking across all major bridges
Chain-by-chain TVL breakdown
Historical comparison (24h default, configurable)
Alert generation for TVL drops (>2%, >5%, >10%, >20%)
Identifies withdrawals to non-CEX addresses (higher risk)
Detects rapid withdrawal patterns
Distinguishes between normal activity and potential exploits
Detection Patterns:
Withdrawal Thresholds:
- $1M+ to non-CEX: MEDIUM ALERT
- $5M+ anywhere: HIGH ALERT
- $10M+ anywhere: CRITICAL ALERT
- 3+ large transfers in short time: RAPID WITHDRAWAL ALERT
Known Addresses:
Tracks 14+ major CEX addresses (Binance, Coinbase, Kraken)
Withdrawals to CEXs treated as lower risk
Withdrawals to unknown addresses flagged for review
Usage:
from scripts.withdrawal_detector import WithdrawalDetector
detector = WithdrawalDetector()
# Monitor Stargate on Ethereum
result = detector.monitor_bridge(
bridge_id="stargate",
chain="ethereum",
blocks_to_scan=1000
)
print(f"Alerts: {result['monitoring_summary']['alerts_triggered']}")
print(f"Total Volume: ${result['monitoring_summary']['total_volume_usd']:,.0f}")
# Check specific alertsfor alert in result['alerts']:
print(f"{alert['severity']}: ${alert['amount_usd']:,.0f}{alert['token']}")
3. Safety Scorer (bridge_safety_scorer.py)
Main orchestrator that combines all analyses to generate comprehensive safety scores.
90-100: SAFE ✅
→ "Bridge is safe to use"
70-89: LOW RISK ✅
→ "Safe with normal precautions"
50-69: MEDIUM RISK ⚡
→ "Use with caution, reduce amounts"
30-49: HIGH RISK ⚠️
→ "Avoid if possible"
0-29: CRITICAL 🚨
→ "DO NOT USE"
Usage:
from scripts.bridge_safety_scorer import BridgeSafetyScorer
scorer = BridgeSafetyScorer()
# Analyze single bridge
result = scorer.calculate_safety_score(
bridge_id="stargate",
chain="ethereum",
detailed=True
)
print(f"Safety Score: {result['safety_score']}/100")
print(f"Risk Level: {result['risk_level']}")
print(f"Recommendation: {result['recommendation']}")
# Compare multiple bridges
comparison = scorer.compare_bridges(
["stargate", "across", "hop"],
chain="ethereum"
)
for rank in comparison['rankings']:
print(f"{rank['rank']}. {rank['bridge']}: {rank['safety_score']}/100")
Supported Bridges & Chains
Monitored Bridge Protocols
Bridge
Type
Chains Supported
TVL Tracking
Withdrawal Monitoring
Stargate
LayerZero
ETH, ARB, OP, POLY, BASE
✅
✅
Portal (Wormhole)
Lock & Mint
ETH, ARB, OP, POLY, SOL
✅
✅
Across
Optimistic
ETH, ARB, OP, POLY, BASE
✅
✅
Hop Protocol
Optimistic
ETH, ARB, OP, POLY
✅
✅
Synapse
Liquidity Network
ETH, ARB, OP, POLY, BSC
✅
✅
Multichain
SMPC
Multi-chain
✅
⚠️ (Deprecated)
Chain Support
Chain
RPC Endpoint
Block Explorer
Contract Monitoring
Ethereum
0xrpc.io/eth
Etherscan
✅ Full
Arbitrum
arb1.arbitrum.io/rpc
Arbiscan
✅ Full
Optimism
mainnet.optimism.io
Optimistic Etherscan
✅ Full
Polygon
polygon-rpc.com
Polygonscan
✅ Full
Base
mainnet.base.org
Basescan
✅ Full
BSC
bsc-dataseed.bnbchain.org
BscScan
✅ Full
API Dependencies
DefiLlama API (Free, No Key Required)
Endpoints Used:
GET https://bridges.llama.fi/bridges
→ List all bridge protocols (alternative endpoint)
GET https://api.llama.fi/protocol/{bridge_id}
→ Get bridge TVL history and chain breakdown
→ Primary endpoint used in production
GET https://api.llama.fi/protocols
→ Get protocol list data
No fallback data - fails gracefully with error messages
Blockchain RPC (Free Public Endpoints)
Used For:
On-chain Transfer event scanning
Token balance queries
Transaction data retrieval
Error Handling:
Returns empty results when RPC fails
Graceful failure with clear error messages
No dummy/fallback data - production-grade error handling
Configuration
Environment Variables (Optional)
# Optional: Paid RPC for higher rate limitsexport ALCHEMY_API_KEY="your_key"export INFURA_API_KEY="your_key"export QUICKNODE_ENDPOINT="your_endpoint"# Optional: Explorer API keys for enhanced dataexport ETHERSCAN_API_KEY="your_key"export ARBISCAN_API_KEY="your_key"