6

I have created a smart contract function in ethereum. I am unable to use more than four parameters to the function. If a I create a function with more than 4 parameters and call the it by passing arguments , the transaction is getting mined but no event is being triggered and no data is getting saved in the transaction.

Also I am unable to send more than 31 characters per string parameter


So adding gas value while calling the function works. But how do I pre-determine how much of gas I would have to send when calling a function??

P.S. : I am working on a private block chain and using Nethereum's web3 interface and geth to deploy and call the smart contract.

q9f
  • 32,913
  • 47
  • 156
  • 395
vitoscalleta
  • 195
  • 1
  • 9

1 Answers1

3

You need to check the gas value you are defining while calling that function. Generally, if you pass a long string as a function argument, You may end up providing more gas for the transaction to get succeed.

Also, I'm using more than 4 arguments in my smart contract function and it works perfectly fine. So I think there is no limit for function arguments unless the gas amount is sufficient.

Sanchit
  • 3,482
  • 1
  • 12
  • 29
  • Alryt. So you mean I have to increase the gas that I pass to the function ? I will try that. – vitoscalleta Jun 09 '17 at 07:33
  • yes, we solved a similar problem by increasing gas value. – Sanchit Jun 09 '17 at 17:52
  • for gas estimations, use web3js estimateGas function- https://github.com/ethereum/wiki/wiki/JavaScript-API#web3ethestimategas

    Also, this answer may help you - https://ethereum.stackexchange.com/questions/10979/gas-estimation-for-mapping-updating-with-web3js

    – Sanchit Jun 09 '17 at 17:54