Master gas optimization techniques for DeFi transactions including timing, batching, and Layer 2 strategies.
## ROLE
You are a gas optimization specialist who has saved millions in gas fees through strategic transaction timing and execution methods.
## CONTEXT
I want to minimize gas costs for my DeFi activities.
## MY ACTIVITY PROFILE
- Primary activities: ${{ACTIVITIES}}
- Monthly transaction count: ${{TX_COUNT}}
- Average tx value: ${{AVG_VALUE}}
- Current monthly gas spend: ${{GAS_SPEND}}
- Chains used: ${{CHAINS}}
## TASK
Create a gas optimization playbook:
**1. CURRENT GAS ANALYSIS**
| Activity | Avg Gas Used | Current Cost | % of Total |
|----------|-------------|--------------|------------|
Total monthly gas: $[amount]
Gas as % of portfolio activity: [%]
**2. TIMING OPTIMIZATION**
**Best times to transact:**
| Day | Lowest Gas Period | Avg Gwei | Savings vs Peak |
|-----|------------------|----------|-----------------|
| Monday | | | |
| Tuesday | | | |
| [etc.] | | | |
**Tools for timing:**
- Gas trackers
- Alert services
- Automated timing tools
**3. TRANSACTION BATCHING**
Combine transactions:
| Batch Opportunity | Individual Cost | Batched Cost | Savings |
|-------------------|-----------------|--------------|---------|
**4. LAYER 2 MIGRATION**
| Activity | L1 Cost | L2 Cost | Savings | Tradeoffs |
|----------|---------|---------|---------|-----------|
Migration guide:
1. [Step]
2. [Step]
**5. PROTOCOL-SPECIFIC OPTIMIZATIONS**
Gas-efficient alternatives:
| Current Protocol | Gas-Efficient Alternative | Savings |
|-----------------|--------------------------|---------|
**6. AGGREGATOR STRATEGIES**
Using aggregators for gas savings:
- DEX aggregators (1inch, Paraswap)
- Route optimization
- Gas token strategies
**7. ADVANCED TECHNIQUES**
- Flashbots for fair pricing
- EIP-1559 optimization
- Nonce management
- Contract interaction batching
**8. IMPLEMENTATION PRIORITY**
| Optimization | Effort | Savings | Priority |
|--------------|--------|---------|----------|
| | Low/Med/High | $/month | 1-10 |
**9. MONITORING & TRACKING**
- Gas tracking spreadsheet
- Monthly review process
- Optimization metrics
**10. EXPECTED RESULTS**
- Current monthly gas: ${{GAS_SPEND}}
- Optimized monthly gas: $[estimated]
- Annual savings: $[estimated]Or press ⌘C to copy
Replace these placeholders with your own content before using the prompt.
[{ACTIVITIES][{TX_COUNT][{AVG_VALUE][{GAS_SPEND][{CHAINS]