1

I am working on an application that stores and retrieves personal data on/from the ethereum blockchain. Just working on this to improve my Solidity and SC expertise and get comfortable with the environment.

Situation: I am using remix to code my Solidity contracts. I run a ganache-cli on localhost that functions as the private eth blockchain. Using node.js/express, I have build an application that is hosted on localhost at a different address. There is one particular function that creates a profile, taking in 6 parameters (of which 5 strings). Executing this function from within Remix works fine, executing this function from the dApp sends a "run out of gas error". If I set a function that only takes 3/6 parameters, it works like it should; if I add one more the "run out gas"-error shows up.

I have tried manually setting the gas limit of the ganache-cli to something high (24 million) and done the same when deploying it using Remix. Still, I can't get it to work.

Does anybody have any idea what could be the issue here? Thanks in advance.

0

Do you set gas for the transaction?

Starting ganache-cli you pass the block gas limit which is the maximum a transaction can use.

But libraries like web3.js has a default of 90k gas, to use more you have to explicitely set the gas in the transaction.

  • Yes, I actually did set it using -l flag. Did not seem to change anything. I ended up running it on Rinkeby using MetaMask and no problems occurred strange. – Valentijn van den Hout Oct 24 '18 at 16:31
  • Passing the -l flag will set the block gas limit, but you can set the gas limit for the transaction passing an extra parameter: myContract.methods.myMethod(123).send({from: '0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe', gas: 1000000}). Some libraries like web3.js has a default parameter of 90k which might not be enough. – Ismael Oct 24 '18 at 16:36
  • Neat! Good to know. Will check out that functionality. In the end I deployed it on Rinkeby and used metamask and everything worked. It was some inherit problem with ganache I think. – Valentijn van den Hout Oct 30 '18 at 11:29

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.