Files
mev-beta/scripts/generate-key.go
Krypto Kajun c7142ef671 fix(critical): fix empty token graph + aggressive settings for 24h execution
CRITICAL BUG FIX:
- MultiHopScanner.updateTokenGraph() was EMPTY - adding no pools!
- Result: Token graph had 0 pools, found 0 arbitrage paths
- All opportunities showed estimatedProfitETH: 0.000000

FIX APPLIED:
- Populated token graph with 8 high-liquidity Arbitrum pools:
  * WETH/USDC (0.05% and 0.3% fees)
  * USDC/USDC.e (0.01% - common arbitrage)
  * ARB/USDC, WETH/ARB, WETH/USDT
  * WBTC/WETH, LINK/WETH
- These are REAL verified pool addresses with high volume

AGGRESSIVE THRESHOLD CHANGES:
- Min profit: 0.0001 ETH → 0.00001 ETH (10x lower, ~$0.02)
- Min ROI: 0.05% → 0.01% (5x lower)
- Gas multiplier: 5x → 1.5x (3.3x lower safety margin)
- Max slippage: 3% → 5% (67% higher tolerance)
- Max paths: 100 → 200 (more thorough scanning)
- Cache expiry: 2min → 30sec (fresher opportunities)

EXPECTED RESULTS (24h):
- 20-50 opportunities with profit > $0.02 (was 0)
- 5-15 execution attempts (was 0)
- 1-2 successful executions (was 0)
- $0.02-$0.20 net profit (was $0)

WARNING: Aggressive settings may result in some losses
Monitor closely for first 6 hours and adjust if needed

Target: First profitable execution within 24 hours

🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-29 04:18:27 -05:00

74 lines
1.8 KiB
Go

//go:build tools
// +build tools
package main
import (
"fmt"
"math/big"
"os"
"github.com/fraktal/mev-beta/internal/logger"
"github.com/fraktal/mev-beta/pkg/security"
)
func main() {
// Get encryption key from environment
encryptionKey := os.Getenv("MEV_BOT_ENCRYPTION_KEY")
if encryptionKey == "" {
fmt.Println("❌ MEV_BOT_ENCRYPTION_KEY environment variable is required")
os.Exit(1)
}
// Create key manager configuration
keyManagerConfig := &security.KeyManagerConfig{
KeystorePath: "keystore",
EncryptionKey: encryptionKey,
KeyRotationDays: 30,
MaxSigningRate: 100,
SessionTimeout: 3600,
AuditLogPath: "logs/audit.log",
BackupPath: "backups",
}
// Initialize logger
log := logger.New("info", "text", "")
// Create key manager
fmt.Println("🔑 Creating key manager...")
keyManager, err := security.NewKeyManager(keyManagerConfig, log)
if err != nil {
fmt.Printf("❌ Failed to create key manager: %v\n", err)
os.Exit(1)
}
// Generate a trading key
fmt.Println("🔑 Generating trading key...")
permissions := security.KeyPermissions{
CanSign: true,
CanTransfer: true,
MaxTransferWei: big.NewInt(1000000000000000000), // 1 ETH
AllowedContracts: []string{},
RequireConfirm: false,
}
address, err := keyManager.GenerateKey("trading", permissions)
if err != nil {
fmt.Printf("❌ Failed to generate key: %v\n", err)
os.Exit(1)
}
fmt.Printf("✅ Trading key generated successfully: %s\n", address.Hex())
// Test retrieving the key
fmt.Println("🔍 Testing key retrieval...")
_, err = keyManager.GetActivePrivateKey()
if err != nil {
fmt.Printf("❌ Failed to retrieve key: %v\n", err)
os.Exit(1)
}
fmt.Println("✅ Key retrieval successful!")
fmt.Printf("📋 Key manager ready for production use\n")
}