Base
هل أنت مستعد لاستدعاء هذا في الإنتاج؟
الخطة المجانية تغطي المشاريع الشخصية. الدفع حسب الاستخدام يتوسع دون بطاقة.
Base
الخطة المجانية تغطي المشاريع الشخصية. الدفع حسب الاستخدام يتوسع دون بطاقة.
eth_estimateGas simulates a transaction against current Base state and returns the amount of gas it would need to execute on-chain, without actually submitting it. Base is Coinbase's OP Stack rollup where ETH pays for gas, so the figure you get back is the L2 execution gas you must cover when the transaction lands. Send the request to https://base.therpc.io/YOUR_API_KEY (chain ID 8453) and the node runs the call, adds a small safety buffer, and hands back a hex gas estimate you can plug into the transaction's gas limit.
to and passing the deploy bytecode as data.eth_feeHistory.| # | الاسم | النوع | مطلوب | الوصف |
|---|---|---|---|---|
| 1 | transaction | object | نعم | Transaction object. `to` is required for calls; omit `to` for contract deployments. Optional: `from`, `gas`, `gasPrice`/`maxFeePerGas`/`maxPriorityFeePerGas`, `value`, `data`. |
| 2 | blockTag | string | لا | Block state to simulate against. Defaults to `latest`.الافتراضي: latest |
| النوع | الوصف |
|---|---|
| string | Hex-encoded gas estimate. The node typically adds a small safety buffer above the raw simulation result. |
Try it live in the Base playground.
| الكود | الرسالة | السبب |
|---|---|---|
3 | execution reverted | The simulated transaction reverted; the estimate cannot be produced. |
-32000 | gas required exceeds allowance | Estimated gas exceeded the block gas limit or the supplied gas cap. |
-32602 | invalid argument | Malformed transaction object. |
3 or -32000) instead of a gas figure, so handle that path explicitly.المعاملات
Transaction object. `to` is required for calls; omit `to` for contract deployments. Optional: `from`, `gas`, `gasPrice`/`maxFeePerGas`/`maxPriorityFeePerGas`, `value`, `data`.
"latest" | "pending" | hex block number