I've thoroughly tested a contract using Ganache, and when calling a method with a value that would trigger one of its require statements, it reverted as expected and returned the error message I defined.

I've deployed the contract to Kovan, and I can send transactions to it just fine, but for anything that would trigger its require statement, I just get the following error:

index.js:89 Error: Transaction ran out of gas. Please provide more gas:

Well, I've given it more gas as I perhaps thought it might cost more to execute some require statements, but that hasn't done anything.

Here's my raw transaction, that I sign using ethereumjs.tx and send via web3.eth.sendSignedTransaction

// Construct the raw transaction.
const rawTx = {
  nonce: web3.utils.toHex(currentNonce),
  gasPrice: web3.utils.toHex(web3.utils.toWei('20', 'gwei')),
  gasLimit: web3.utils.toHex('5000000'),
  to: environment.ethereum.universityVotingContractAddress,
  value: '0x0',
  data: submitInstitutionContractMethod

// Sign the raw transaction.
const tx = new Tx(rawTx, { chain: 'kovan', hardfork: 'petersburg' });
const privateKey = Buffer.from(walletKey.substring(2), 'hex');
const serializedTx = tx.serialize();

// Now we want to send the raw transaction that has been signed with
// the user's private key.
  .sendSignedTransaction('0x' + serializedTx.toString('hex'))
  .on('transactionHash', console.log)
  .on('receipt', console.log)
  .on('confirmation', console.log, console.log)
  .on('error', console.error);


I'm not 100% if the out of gas error is 'wrong', but I have just found after more digging the answer to the part of this question concerning require statements - so, the other part of my question still stands, can an out of gas error sometimes just be plain wrong?

  • Do you have a transaction hash we can inspect? Perhaps there is another error but the client can't determine what is wrong and it shows "out of gas". – Ismael Jul 24 '19 at 18: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.