I put a keccak hashing inside pure function, it works and return me the result.It also works in a for loop. I studied that hashing the data and loop consumes consider amount of gas. Do we need to provide ether for that??. But pure function invocation doesn't go as a transaction right... ??


pure functions do consume gas if they are being called on-chain.

If you are calling the pure function off-chain (e.g. for the frontend of your website), there is no associated cost. If you are calling the pure function on-chain as a part of a transaction, it will consume gas.

| improve this answer | |
  • 1
    "if they are being called on-chain" - from a function which is not pure or view! – goodvibration Feb 27 at 20:00
  • @shane Thats what my question is about.. Why the off-chain call doesn't cost gas?. EVM has to do the computation, Irrespective of the origin right?. – Naveen Kumar Feb 28 at 5:47
  • @goodvibration It will cost gas if it is not pure or view. That's what my question also. Anyway computation done by EVM is same on both cases. – Naveen Kumar Mar 3 at 9:49

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.