Gas Cost Study

Multi-Provider Flash Loan Gas Analysis

First Real-World Test: Success! ✅

On Nov 25, 2025, we executed the first multi-provider flash loan on Sepolia testnet:

Transaction: 0xbe11b344027b38df7a85ad022e43d0aa2b775bd31890f722143944027db5d723

Result: 0.08 ETH borrowed from 2 providers, fees distributed proportionally

How It Worked

Provider 1 (0x3CD6...c191)

  • • Contributed: 0.05110553 WETH
  • • Received back: 0.05111575 WETH
  • • Profit: 0.00001022 WETH (0.02% of their share)

Provider 2 (0x5CAF...0fd3)

  • • Contributed: 0.02889447 WETH
  • • Received back: 0.02890025 WETH
  • • Profit: 0.00000578 WETH (0.02% of their share)

✓ Key Success: Fees were distributed proportionally to each provider's contribution, exactly as designed. The router pulled from multiple wallets, unwrapped to ETH for the borrower, then wrapped the repayment and distributed it back with fees.

⛽ Gas Cost Breakdown

Operations in This Transaction

OperationEst. GasNotes
2× WETH transferFrom (providers → router)~100k50k each
1× WETH unwrap (WETH → ETH)~25ktoNative=true
Demo execution (counter + proof)~70kNot typical
1× WETH wrap (repayment ETH → WETH)~30ktoNative=true
2× WETH transfer (router → providers)~90k45k each with fees
Router overhead & verification~30kFlash loan logic
Total (this demo tx)~345kIncluding demo overhead
Real flash loan (no demo)~275k2 providers, toNative

💡 WETH-Only Optimization

If the borrower accepts WETH directly (toNative=false), you save ~55k gas by skipping unwrap/wrap:

  • WETH-only, 2 providers: ~220k gas
  • WETH-only, 1 provider: ~120k gas
  • Recommendation: Smaller loans should use WETH to minimize gas overhead

Scaling: Gas vs Number of Providers

ProvidersGas (toNative)Gas (WETH-only)Notes
1~175k~120kComparable to Aave
2~275k~220k+100k per provider
3~375k~320k+100k per provider
5~575k~520kHigh fragmentation

Formula: Gas ≈ 175k + 100k × (N-1) for toNative, or 120k + 100k × (N-1) for WETH-only, where N = number of providers.

💰 Cost Comparison (Mainnet)

Assuming: Gas price = 20 gwei, ETH = $3,500

ScenarioGasCost (USD)Best For
Aave V3 Flash Loan150-200k$10.50-$14Single source
FlashBank (1 provider, WETH)~120k$8.40Small WETH loans
FlashBank (1 provider, toNative)~175k$12.25Small ETH loans
FlashBank (2 providers, WETH)~220k$15.40Medium WETH loans
FlashBank (2 providers, toNative)~275k$19.25Medium ETH loans
FlashBank (5 providers, toNative)~575k$40.25Large/fragmented loans

When Does Multi-Provider Cost Matter?

FlashBank has a 0.03% fee advantage over Aave (0.02% vs 0.05%). The extra gas from multiple providers becomes prohibitive when:

  • • Small loans (<$10k) from many providers
  • • The gas overhead exceeds the fee savings
  • • High-frequency small arbitrage with tight margins

Optimizations & Strategies

1. Single-Provider Fast Path (Upcoming)

If the loan amount is under a threshold (e.g., 10 ETH) and can be fulfilled by a single provider, the router will automatically select that provider to minimize gas costs.

This optimization encourages small providers while keeping gas efficient for small loans.

2. WETH-Only Mode

For borrowers who can work with WETH directly (most MEV/arb bots), set toNative=falseto save ~55k gas by skipping unwrap/wrap operations.

router.flashLoan(wethAddress, amount, false, data);

3. Provider Incentives

We want to encourage anyone to provide liquidity, so we won't implement aggressive provider minimization. However, borrowers benefit from having a few large providers rather than many small ones.

4. Fee vs Gas Trade-off

At 20 gwei gas and current ETH prices, the 0.03% fee advantage over Aave breaks even at:

  • • ~$65k loan size (2 providers, toNative)
  • • ~$130k loan size (3 providers, toNative)
  • • Smaller for WETH-only mode

🎯 Recommendations for Borrowers

FlashBank is Better When:

  • • Large loans (>$100k) where fee savings dominate
  • • You value custody guarantees for providers
  • • You can accept WETH directly (toNative=false)
  • • You need more liquidity than Aave has available
  • • Gas prices are low (<15 gwei)

Use Aave Instead When:

  • • Small loans (<$10k) from many providers
  • • Gas prices are very high (>50 gwei)
  • • High-frequency trading with tight margins
  • • You need multi-asset flash loans in one call
  • • Absolute minimum gas is critical