Lightweight Go SDK for detecting sandwich attacks in BSC transaction bundles
BSC Exorcist provides a simple and efficient way to detect sandwich attack patterns in transaction bundles. This SDK is required for builders submitting bids to 48Club validators, ensuring MEV protection and fair transaction ordering.
Contributions welcome! Help us improve functionality or add support for more protocols.
go get github.com/48Club/bscexorcistimport "github.com/48Club/bscexorcist"
// Detect sandwich attacks in transaction bundle
err := bscexorcist.DetectSandwichForBundle(transactionsLogs)
if err != nil {
// Sandwich attack detected - handle accordingly
log.Printf("Attack detected: %v", err)
}The SDK analyzes DEX swap patterns across transaction bundles to identify sandwich attacks:
Bundle Structure:
┌─────────────┐
│ TX 1: Buy │ ← Attacker front-runs
├─────────────┤
│ TX 2: Buy │ ← Victim transaction
├─────────────┤
│ TX 3: Sell │ ← Attacker back-runs
└─────────────┘
- Buy-Buy-Sell: Front-run and back-run pattern
- Sell-Sell-Buy: Reverse sandwich pattern
- Go 1.21 or higher
- Minimum 3 transactions per bundle
- Transaction logs, separated by each transaction in the bundle
Builders MUST implement sandwich detection before submitting bids:
| Protocol | Status | Event Signatures |
|---|---|---|
| Uniswap V2 | ✅ Supported | 0xd78ad95f... 0x606ecd02... |
| Uniswap V3 | ✅ Supported | 0xc42079f9... 0x19b47279... |
| Uniswap V4 | ✅ Supported | 0x40e9cecb... |
| PancakeSwap V2 | ✅ Supported | Compatible |
| PancakeSwap V3 | ✅ Supported | Compatible |
| PancakeSwap V4 | ✅ Supported | 0x04206ad2... 0x3e8aae37... |
| DODOSwap | ✅ Supported | 0xc2c0245e... |
| FourMeme | ✅ Supported | 0x7db52723... 0x0a5575b3... |
Built with ❤️ for the BSC ecosystem