1

How do you calculate how much gas to use in a send_transaction?

Amount: 0x670479cb5385800, // (decimal: 463949500000000000 wei 0.4639495 eth)

Gas price: 0x6ddd00 // (decimal: 7200000 wei)

Gas: 0x15F90 // (decimal: 90000)

What I did was the gas price I use for base is 10.

Then I know the send_transaction RPC makes the gas default to 90,000 and returns the difference. So I set my gas to 90,000.

To get my gas price I did 90,000 * 10. Then I multiplied by 8 (idk just a magic number) to get the gas price value I have. What did I do wrong?

I keep getting error:

code: -32000, message: 'insufficient funds for gas * price + value' } }

What am I doing wrong?

  • 1
    Your address must have at least (value + maxgas*gasprice) amount of ether in it. It looks like yours doesn't. – Raghav Sood Oct 23 '18 at 2:14
  • So if maxGas*gasPrice is 900,000 and original value was 0.5 ETH then the parameters for the send_transaction should have value = 500000000000000000 - 900,000 and gasprice = 900,000 ? – mocode10 Oct 23 '18 at 2:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.