{"uid":"cap_ucdsRlu2WZLUOoIcmKlYA","slug":"onesource-ethereum-gas-estimator-78de69c8","name":"OneSource Ethereum Gas Estimator","description":"Estimate the gas a transaction will consume via eth_estimateGas before signing it","url":"https://api.onesource.io/api/chain/estimate-gas","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"to":{"type":"string","pattern":"^0x[a-fA-F0-9]{40}$"},"data":{"type":"string","pattern":"^0x[a-fA-F0-9]+$"},"from":{"type":"string","pattern":"^0x[a-fA-F0-9]{40}$"},"value":{"type":"string","pattern":"^0x[a-fA-F0-9]+$"}}},"responseSchema":{"type":"json","example":{"data":{"gas":"0x5208"},"meta":{"endpoint":"/api/chain/estimate-gas","cost_usdc":"0.001","request_id":"00000000abcdef01","payment_chain":"base","payment_token":"USDC"}}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.004","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"settled","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.004/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.004","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.004","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_KfJ9XXrpxG5SsulLyMuQS","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.004","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Estimates the gas required to execute an Ethereum transaction given recipient, calldata, sender, and optional value","exampleAgentPrompt":"How much gas will it take to call this contract — sending from 0xAbCd1234...5678 to 0x1234AbCd...EFGH with calldata 0xa9059cbb000000000000000000000000... and zero ETH value?","exampleUseCases":[{"title":"Pre-broadcast gas budgeting for token transfers","prompt":"Before I send 1000 USDC from my wallet to my friend's address, can you estimate how much gas that'll cost so I know what fee to expect?"},{"title":"Smart contract interaction cost validation","prompt":"I want to mint an NFT from this contract but I'm not sure if I have enough ETH for gas — can you estimate the gas needed for the mint function call with my wallet address and the contract data?"},{"title":"Multi-transaction fee planning for swaps","prompt":"I'm planning to swap tokens across a DEX — can you estimate the gas for the swap transaction so I can factor that into whether the trade is worth it profit-wise?"}],"resultDescription":"Returns a JSON object with a 'gas_estimate' field containing the estimated gas units as a hex string (e.g. {\"gas_estimate\": \"0x5208\"}), representing how much gas the described transaction would consume on Ethereum mainnet.","failureModes":["Invalid Ethereum address format for 'to' or 'from' returns a 400 error","Malformed calldata hex string causes a validation error","Contract reverts during simulation returns an error indicating execution would fail","Network congestion or node unavailability may cause timeouts","Insufficient funds simulation may return an execution error","Missing required 'to' field returns a bad request error"],"whenToPreferThis":"Use this endpoint when you need to estimate gas for an Ethereum transaction before broadcasting it — especially when building AI agent workflows that must calculate fees, validate feasibility, or budget on-chain interactions without requiring an API key. Prefer this over direct node RPC when you want a pay-per-call model via USDC on Base (x402) without managing infrastructure.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-13T12:34:06.227Z","isFirstParty":false}