2

I have a private ethereum network and using Geth, to speed things up, I want to modify how the gas estimation is done.

Using RPC call for eth_estimateGas is too slow when it comes to multiple concurrent operations. I see this is done in function EstimateGas from internal/ethapi/api.go:

func (ec *Client) EstimateGas(ctx context.Context, msg ethereum.CallMsg) (uint64, error)

This executes in memory, without affecting the blockchain and calculates how much gas was used, usually differing by 20-30% from the actual gas used.

Is there a way to build a function, perhaps directly in EVM, to call it from other Go sources, that basically use the same code as a miner does when it calculates the exact gas needed?

It may not be possible to come to the exact amount (due to other block conditions, when the transaction is performed), but at least I need to have an estimation close to the real value by not using a RPC call.

Any help is highly appreciated.

CristiC
  • 22,068
  • 12
  • 57
  • 89
  • For the down-voter - can you detail your action? For the off-topic close voter - this is a Go language related question, even if this is for Ethereum Geth app. So why is it off-topic? – CristiC Jun 22 '18 at 12:44

0 Answers0