Estimate Gas Price
Retrieves the current recommended gas price from the blockchain network in hexadecimal WEI format.
Common Properties
- Name - The custom name of the node.
- Color - The custom color of the node.
- Delay Before (sec) - Waits in seconds before executing the node.
- Delay After (sec) - Waits in seconds after executing node.
- Continue On Error - Automation will continue regardless of any error. The default value is false.
If the ContinueOnError property is true, no error is caught when the project is executed, even if a Catch node is used.
Inputs
- Client ID - The client ID from the Create Client node.
Output
- Gas Price (WEI) - The current gas price in hexadecimal format (e.g., "0x0000000000000000000000000000000000000000000000000000000ba43b7400").
How It Works
The Estimate Gas Price node queries the blockchain network for current gas prices. When executed, the node:
- Validates the Client ID
- Queries the network for the current recommended gas price
- Converts the price to hexadecimal format
- Pads with zeros to create a 64-character hex string
- Returns the gas price with "0x" prefix
Requirements
- A valid Client ID from the Create Client node
- Active network connection
- Functioning RPC endpoint
Error Handling
The node will return errors for:
- Empty or invalid Client ID
- Client not found
- Network connection failures
- RPC endpoint unavailable
Gas Price Understanding
Gas Price units:
- Returned in WEI per gas unit
- Commonly measured in GWEI (1 GWEI = 10^9 WEI)
- Higher price = faster confirmation
- Lower price = slower confirmation, cheaper
Conversion:
- 1 GWEI = 1,000,000,000 WEI
- 50 GWEI = 50,000,000,000 WEI = 0x00...ba43b7400
Usage Notes
- Always call this node before sending transactions
- Gas prices fluctuate based on network congestion
- The returned price is a recommendation, not a requirement
- You can adjust the price up or down based on urgency
- Higher prices don't guarantee immediate confirmation
- Very low prices may result in stuck transactions
Example
Getting current gas price:
Inputs:
- Client ID:
7e8f9a0b-1c2d-3e4f-5a6b-7c8d9e0f1a2b
Output:
- Gas Price (WEI):
0x0000000000000000000000000000000000000000000000000000000ba43b7400(50 GWEI)
Converting to GWEI for display:
Use From WEI node:
- Amount:
0x0000000000000000000000000000000000000000000000000000000ba43b7400 - Unit:
gwei - Output:
50.0000
Common Use Cases
Transaction Preparation: Get current gas price before sending transactions.
Cost Estimation: Calculate transaction costs for budgeting.
Price Monitoring: Track gas prices over time for optimization.
Dynamic Pricing: Adjust transaction timing based on gas prices.
User Notifications: Inform users of current network costs.
Gas Strategy: Implement fast/normal/slow transaction options.
Gas Price Strategies
Fast Confirmation: Multiply by 1.2-1.5 for faster processing:
fastGasPrice = currentPrice * 1.3
Normal Speed: Use the returned price as-is.
Economy Mode: Multiply by 0.8-0.9 for slower but cheaper:
slowGasPrice = currentPrice * 0.85
Network-Specific Behavior
Ethereum Mainnet:
- Highly variable (10-200+ GWEI)
- Check gas trackers for optimal timing
- Consider EIP-1559 for better estimation
Layer 2 Networks (Polygon, Arbitrum):
- Generally stable and low
- Less variation throughout the day
- Often under 100 GWEI
BSC:
- Relatively stable
- Usually 3-5 GWEI
- Less congestion than Ethereum
Integration Example
Complete transaction cost calculation:
- Estimate Gas - Get gas limit (e.g., 65,000)
- Estimate Gas Price - Get current price (e.g., 0x...ba43b7400 = 50 GWEI)
- Calculate - Cost = gasLimit × gasPrice
- From WEI - Convert to ETH for display
- Validate - Check wallet has sufficient balance
- Send Transaction - Execute with calculated price
Example calculation:
gasLimit = 65000
gasPrice = 50000000000 // 50 GWEI in WEI
totalCost = gasLimit * gasPrice
// = 3,250,000,000,000 WEI
// = 0.00325 ETH
Price Adjustment Examples
For urgent transactions:
urgentPrice = estimatedPrice * 1.5
For scheduled transactions:
economyPrice = estimatedPrice * 0.8
Maximum price cap:
maxPrice = 100 * 1000000000 // 100 GWEI max
finalPrice = Math.min(estimatedPrice, maxPrice)
Historical Context
Low gas (< 20 GWEI):
- Off-peak hours
- Low network activity
- Good time for non-urgent transactions
Medium gas (20-100 GWEI):
- Normal network activity
- Acceptable for most transactions
- Standard confirmation times
High gas (100-500 GWEI):
- High network congestion
- Consider delaying non-urgent transactions
- Much higher costs
Extreme gas (> 500 GWEI):
- Major events or network stress
- Only for critical transactions
- Very expensive
For cost-sensitive automations, implement a maximum gas price threshold. Skip or delay transactions when gas exceeds your limit.
Gas prices are in WEI. The hex format may look complex, but it's the standard blockchain format. Use From WEI to convert to GWEI for human-readable values.
Best Practices
Always estimate before sending:
- Get current gas price
- Decide on speed (fast/normal/slow)
- Adjust price accordingly
- Calculate total cost
- Verify budget
- Send transaction
Monitor gas price trends:
- Track prices over time
- Identify low-cost windows
- Schedule non-urgent transactions appropriately
Set reasonable limits:
- Don't set extremely high prices
- Don't set extremely low prices
- Use network-appropriate values
Setting gas price too low may result in transactions that never confirm. Setting it too high wastes money. Always start with the estimated price and adjust modestly.