eth_estimateGas RPC 方法
To use the eth_estimateGas method on the Avalanche C-Chain, ensure that the end of your URL includes ext/bc/C/rpc.
參數
交易
物件
載入中...
來自
字串
載入中...
至
字串
必填
載入中...
氣體
整數
載入中...
gasPrice
整數
載入中...
值
整數
載入中...
資料
字串
載入中...
區塊編號
字串
載入中...
退貨
數量
字串
載入中...
請求
1curl https://docs-demo.avalanche-mainnet.quiknode.pro \2-X POST \3-H "Content-Type: application/json" \4--data '{5"method": "eth_estimateGas",6"params": [7{8"from": "0x8D97689C9818892B700e27F316cc3E41e17fBeb9",9"to": "0xd3CdA913deB6f67967B99D67aCDFa1712C293601",10"value": "0x186a0"11}12],13"id": 1,14"jsonrpc": "2.0"15}'
1curl https://docs-demo.avalanche-mainnet.quiknode.pro \2-X POST \3-H "Content-Type: application/json" \4--data '{5"method": "eth_estimateGas",6"params": [7{8"from": "0x8D97689C9818892B700e27F316cc3E41e17fBeb9",9"to": "0xd3CdA913deB6f67967B99D67aCDFa1712C293601",10"value": "0x186a0"11}12],13"id": 1,14"jsonrpc": "2.0"15}'
1import { 核心 } from '@quicknode/sdk'23const 核心 = new Core({4endpointUrl: "https://docs-demo.avalanche-mainnet.quiknode.pro",5})67核心.客戶端8.estimateGas({9account,10to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',11value: parseEther('1')12})13.then(res => console.log(res))14
1import { 核心 } from '@quicknode/sdk'23const 核心 = new Core({4endpointUrl: "https://docs-demo.avalanche-mainnet.quiknode.pro",5})67核心.客戶端8.estimateGas({9account,10to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',11value: parseEther('1')12})13.then(res => console.log(res))14
1import { ethers } from "ethers";2(async () => {3const provider = new ethers.JsonRpcProvider(4"https://docs-demo.avalanche-mainnet.quiknode.pro"5);6const estimate = await provider.estimateGas({7from: "0x8D97689C9818892B700e27F316cc3E41e17fBeb9",8to: "0xd3CdA913deB6f67967B99D67aCDFa1712C293601",9value: 1,10});11console.log(estimate);12})();13
1import { ethers } from "ethers";2(async () => {3const provider = new ethers.JsonRpcProvider(4"https://docs-demo.avalanche-mainnet.quiknode.pro"5);6const estimate = await provider.estimateGas({7from: "0x8D97689C9818892B700e27F316cc3E41e17fBeb9",8to: "0xd3CdA913deB6f67967B99D67aCDFa1712C293601",9value: 1,10});11console.log(estimate);12})();13
1出自 web3 import Web3, HTTPProvider2w3 = Web3(HTTPProvider('https://docs-demo.avalanche-mainnet.quiknode.pro'))3estimate = w3.eth.estimate_gas({"from":"0x8D97689C9818892B700e27F316cc3E41e17fBeb9","to":"0xd3CdA913deB6f67967B99D67aCDFa1712C293601","value":"0x186a0"})4print(estimate)
1出自 web3 import Web3, HTTPProvider2w3 = Web3(HTTPProvider('https://docs-demo.avalanche-mainnet.quiknode.pro'))3estimate = w3.eth.estimate_gas({"from":"0x8D97689C9818892B700e27F316cc3E41e17fBeb9","to":"0xd3CdA913deB6f67967B99D67aCDFa1712C293601","value":"0x186a0"})4print(estimate)