Here are my files on github, https://github.com/ArtieLadie/gas_limit

https://github.com/ArtieLadie/gas_limit/blob/master/deploy.js sets gas limit here,

async function deployContract(web3, contract, sender) {
    let Voter = new web3.eth.Contract(contract.abi);
    let bytecode = '0x' + contract.evm.bytecode.object;
    let gasEstimate = await web3.eth.estimateGas({data: bytecode});

This is the account I am using to deploy contract. It has 18 ether.


When I deploy contract, I get error,

Failed to deploy contract: Error: Returned error: insufficient funds for gas * price + value

I tried starting geth with

sudo geth attach /home/solidity/.ethereum/rinkeby/geth.ipc — targetgaslimit 2000000

but still no luck :-(

If it helps ....

1st Terminal

enter image description here

2nd Terminal

enter image description here

3rd Terminal

enter image description here

  • Maybe try using a gas limit higher than just the gasEstimate. (gasEstimate + 100000) – Steven V Nov 24 '19 at 23:53
  • tried let gasEstimate = await web3.eth.estimateGas({data: bytecode}) + 100000;, no luck :-( – Marium Nov 25 '19 at 0:41
  • can you spare any rinkeby eth? 0x926f8E72CE94491Cafba874b4affD40C3b05a5e3 (the social media verification faucet --) – Steven V Nov 25 '19 at 2:14
  • I'm not understanding ..... – Marium Nov 25 '19 at 2:23
  • 1
    @Marium How much is the gas estimate returned? What is the gas price used? To estimate gas for deployment is better to use await Voter.deploy({ data: bytecode }) .estimateGas() – Ismael Nov 25 '19 at 4:00

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.