Comprehensive gas usage analysis for deployment and operations
Generated: 2026-01-21
Network: Hardhat Local / Base Mainnet Estimates
Compiler: Solidity 0.8.28
| Scenario | Payees | Shares Distribution | Gas Required | ETH Cost (1.875 gwei) | USD Cost ($3000/ETH) |
|---|---|---|---|---|---|
| Minimal | 2 | 50/50 | 848,140 | 0.00159 ETH | $4.77 |
| Standard | 3 | 50/30/20 | 894,629 | 0.00168 ETH | $5.03 |
| Extended | 5 | 20/20/20/20/20 | 987,607 | 0.00185 ETH | $5.56 |
Base Contract Deployment: ~800,000 gas
Per Additional Payee: ~46,000 gas
Formula: Total Gas ≈ 800,000 + (Number of Payees × 46,000)
| Operation | Gas Required | Cost (1.875 gwei) | Notes |
|---|---|---|---|
| Receive ETH | 22,663 | 0.000042 ETH | Anyone sending ETH to contract |
| Release Payment | 84,168 | 0.000158 ETH | Payee withdrawing their share |
| View Functions | 0 | FREE | All read-only operations |
These functions cost 0 gas as they only read state:
totalShares()- Get total sharesshares(address)- Get shares for a payeetotalReleased()- Get total ETH releasedreleased(address)- Get amount released to a payeepayee(uint256)- Get payee address by index
Assuming different gas price scenarios on Base:
| Gas Price | ETH Cost | USD Cost ($3000/ETH) | USD Cost ($3500/ETH) |
|---|---|---|---|
| 0.001 gwei (Low) | 0.00000089 ETH | $0.003 | $0.003 |
| 0.01 gwei (Normal) | 0.0000089 ETH | $0.027 | $0.031 |
| 0.1 gwei (High) | 0.000089 ETH | $0.27 | $0.31 |
| 1 gwei (Very High) | 0.00089 ETH | $2.68 | $3.13 |
Note: Base typically has very low gas prices (often < 0.01 gwei), making deployment extremely affordable.
Scenario: Monthly payroll for 3 team members
| Operation | Frequency | Gas per Operation | Total Gas/Year | Cost/Year (0.01 gwei) |
|---|---|---|---|---|
| Receive Payment | 12/year | 22,663 | 271,956 | $0.008 |
| Release Payment | 36/year (3 payees × 12) | 84,168 | 3,030,048 | $0.091 |
| Total | - | - | 3,302,004 | $0.099 |
Annual cost: Less than $0.10 at typical Base gas prices! 🎉
The SplitStream contract implements several gas optimization strategies:
- Uses
uint256(native EVM word size) - Caches values in memory during calculations
- No unnecessary storage writes
release()operates on single payee (O(1))- No iteration over all payees
- Constant gas cost regardless of total payees
- OpenZeppelin's optimized
Address.sendValue() - Battle-tested implementations
- Minimal overhead
- Payees pay their own withdrawal gas
- Sender only pays for receiving ETH (~22k gas)
- No failed transfer cascades
- Indexed parameters for efficient filtering
- Minimal event data
- Only essential information logged
Contract Creation: ~600,000 gas
Constructor Execution: ~200,000 gas
├─ Array Length Checks: ~2,000 gas
├─ Loop Iteration (3x): ~150,000 gas
│ ├─ Address Validation: ~5,000 gas/payee
│ ├─ Shares Validation: ~3,000 gas/payee
│ ├─ Duplicate Check: ~8,000 gas/payee
│ ├─ Array Push: ~20,000 gas/payee
│ └─ Mapping Updates: ~14,000 gas/payee
└─ Total Shares Update: ~48,000 gas
Code Deployment: ~94,000 gas
─────────────────────────────────────────
Total: ~894,629 gas
Function Entry: ~21,000 gas
Shares Check: ~2,400 gas
Balance Read: ~2,100 gas
Payment Calculation: ~1,500 gas
Payment Validation: ~2,000 gas
State Updates:
├─ _released[account]: ~20,000 gas
└─ _totalReleased: ~5,000 gas
ETH Transfer (sendValue): ~25,000 gas
Event Emission: ~5,168 gas
─────────────────────────────────────────
Total: ~84,168 gas
Function Entry: ~21,000 gas
Event Emission: ~1,663 gas
─────────────────────────────────────────
Total: ~22,663 gas
-
Deploy During Low Traffic
- Monitor Base network gas prices
- Deploy when gas < 0.01 gwei
- Can save 50-90% on deployment costs
-
Optimize Payee Count
- Each additional payee adds ~46,000 gas
- Consider if all payees are necessary
- Can deploy multiple smaller contracts if needed
-
Batch Deployments
- If deploying multiple contracts, do it in one session
- Amortize transaction overhead
-
Batch Withdrawals
- Wait for larger amounts before withdrawing
- Gas cost is fixed (~84k gas) regardless of amount
- Withdrawing 0.1 ETH costs same as 10 ETH
-
Monitor Gas Prices
- Use tools like BaseScan to check current gas prices
- Wait for low-traffic periods
- Set appropriate gas limits
-
Use View Functions
- Check balances before withdrawing (free)
- Verify shares allocation (free)
- Plan withdrawals efficiently
| Network | Typical Gas Price | ETH Cost | USD Cost ($3000/ETH) |
|---|---|---|---|
| Base | 0.01 gwei | 0.0000089 ETH | $0.027 ✅ |
| Ethereum Mainnet | 30 gwei | 0.0268 ETH | $80.40 |
| Optimism | 0.001 gwei | 0.00000089 ETH | $0.003 |
| Arbitrum | 0.1 gwei | 0.000089 ETH | $0.27 |
| Polygon | 50 gwei | 0.0447 ETH | $134.10 |
Base is extremely cost-effective for deployment and operations! 🚀
Traditional Approach (Manual ETH transfers to 3 payees monthly):
- Gas per transfer: ~21,000 gas
- Monthly cost (3 transfers): 63,000 gas
- Annual cost: 756,000 gas
- Annual USD cost: ~$0.023 (at 0.01 gwei)
SplitStream Approach:
- Receive payment: 22,663 gas
- 3 releases: 252,504 gas
- Monthly total: 275,167 gas
- Annual cost: 3,302,004 gas
- Annual USD cost: ~$0.099 (at 0.01 gwei)
Trade-off: Slightly higher gas costs, but:
- ✅ Automated proportional splitting
- ✅ Trustless operation
- ✅ Transparent on-chain records
- ✅ No manual calculation errors
- ✅ Payees control withdrawal timing
-
Budget Allocation
- Deployment: $1-5 (with buffer for gas spikes)
- Monthly operations: < $0.01
- Annual operations: < $0.10
-
Gas Price Monitoring
- Set up alerts for gas price changes
- Use BaseScan API for real-time monitoring
- Deploy when gas < 0.01 gwei
-
Testing First
- Deploy to Base Sepolia testnet first (free)
- Verify all operations work correctly
- Then deploy to mainnet
-
Documentation
- Share gas costs with payees
- Explain withdrawal process
- Provide gas price resources
To generate this report yourself:
# Run the gas estimation script
node node_modules/hardhat/internal/cli/cli.js run scripts/estimate-gas.js --network hardhat
# Or with npx (if PowerShell execution policy allows)
npx hardhat run scripts/estimate-gas.js --network hardhat- Gas estimates are based on Hardhat local network simulation
- Actual costs may vary by ±10% depending on network conditions
- Base gas prices are typically very low (< 0.01 gwei)
- View functions are always free (read-only operations)
- Deployment is a one-time cost
- Operation costs scale linearly with usage
The SplitStream Protocol is extremely gas-efficient on Base:
- Deployment: < $1 at typical gas prices
- Annual Operations: < $0.10 for monthly payroll
- Per Transaction: Fractions of a cent
The contract is optimized for minimal gas usage while maintaining security and functionality. The pull payment pattern ensures that senders pay minimal gas, while payees control their own withdrawal timing and costs.
Last Updated: 2026-01-21
Contract Version: 1.0.0
Solidity Version: 0.8.28