evm_estimate_gas
Estimate gas for EVM transactions with a 20% safety buffer to predict costs and avoid out-of-gas failures before signing.
Instructions
Estimate gas required for a transaction with automatic 20% safety buffer.
Simulates transaction execution to determine gas consumption. Returns estimated gas limit with built-in safety buffer to prevent out-of-gas failures.
CRITICAL RULES:
Estimation simulates execution without committing to blockchain
Includes 20% safety buffer above raw estimate
May fail if transaction would revert (shows reason)
Gas estimate varies based on contract state and input data
"from" address must have sufficient balance if checking value transfers
PARAMETERS:
chain: EVM chain for gas estimation (required)
Gas costs are chain-specific
Same transaction uses different gas on different chains
Example: Contract call may cost 200k gas on Ethereum, 150k on Polygon
from: Sender address (optional but recommended)
Required for checking balance requirements
Affects gas calculation for some contracts
Use zero address (0x0000...0000) if unknown
to: Target address (required)
Contract address for contract calls
EOA address for simple transfers
Format: 0x followed by 40 hex characters
value: Amount to send in ether (optional)
For native currency transfers
Example: "0.1" for 0.1 ETH/POL/etc.
Leave empty for zero-value transactions
data: Transaction data (optional)
Hex-encoded function call data for contracts
Empty for simple transfers
Format: 0x + hex string
EXAMPLES: ✅ Estimate simple transfer: {chain: "polygon", to: "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb", value: "0.1"}
✅ Estimate contract call: {chain: "ethereum", from: "0x...", to: "0x...", data: "0xa9059cbb..."}
✅ Check deployment gas: {chain: "bsc", to: "0x0000000000000000000000000000000000000000", data: "0x608060..."}
❌ Invalid - missing recipient: {chain: "polygon", value: "1.0"} // No "to" address
❌ Invalid - wrong data format: {chain: "ethereum", to: "0x...", data: "abc123"} // Missing 0x prefix
SUPPORTED EVM CHAINS (7 networks): • ethereum (Sepolia) - EIP-1559 enabled, ~12s blocks, moderate gas costs • polygon (Amoy) - Low fees, fast finality (~2s), layer 2 • avalanche (Fuji C-Chain) - Sub-second finality, dynamic fees • bsc (BNB Testnet) - 3s blocks, low gas costs, Binance ecosystem • arbitrum (Sepolia) - Optimistic rollup, low fees, Ethereum security • base (Sepolia) - Coinbase layer 2, EIP-1559, low fees • worldchain (World Sepolia) - World Network testnet, EIP-1559
CRITICAL GAS CONSIDERATIONS:
Ethereum: High gas costs, use gas oracle for timing
Polygon/BSC: Very low gas, safe for frequent transactions
Arbitrum/Base: L2 optimizations, ~10-50x cheaper than Ethereum
Avalanche: Dynamic fees, can spike during congestion
Always check gas price before executing transactions
TESTNET TOKENS: All chains use testnet tokens with NO REAL VALUE. Faucets available for all supported networks.
OUTPUT STRUCTURE: • success: Boolean indicating estimation success • chain: Chain used for estimation • estimatedGas: Raw gas estimate (units) • gasLimit: Recommended gas limit (with 20% buffer) • estimatedCost: Approximate cost in native currency • gasPrice: Current gas price used for cost calculation • executionTime: Time taken in milliseconds
COMMON MISTAKES:
Not including "from" when balance checks matter
Using estimated gas without safety buffer (use gasLimit instead)
Estimating with stale state (contract state may change)
Forgetting gas estimates can fail if transaction would revert
Not accounting for gas price in total cost calculation
USE CASES:
Calculate transaction costs before signing
Verify contract interactions will succeed
Determine optimal gas limits for transactions
Compare gas costs across different contract methods
Budget for transaction batches
GAS ESTIMATION TIPS:
Add 20-30% buffer to raw estimates for safety
Re-estimate before submitting if state has changed
Higher gas limit doesn't cost more (only gas used is charged)
Failed estimates often indicate transaction will revert
Contract calls use more gas than simple transfers
Running on Linux.
LINUX-SPECIFIC NOTES:
Package manager: apt (Ubuntu/Debian), yum (RHEL/CentOS), or pacman (Arch)
Python 3 is typically 'python3' command
GNU tools are standard
Use 'xdg-open' command to open files/applications
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"chain": "<chain>",
"to": "<to>"
},
"name": "evm_estimate_gas"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | Yes | Recipient address (0x... - 42 characters) | |
| data | No | Transaction data (optional, 0x... hex string) | |
| from | No | Sender address (optional but recommended, 0x...) | |
| chain | Yes | EVM chain to estimate gas on | |
| value | No | Amount to send in ether (optional, e.g., "0.1") |