Since query or constant functions are just executed on single node there is no dependency on gas or gas limit. I am performing Quicksort in query/constant method. EVM can sort an array of length up to 50000. The function returns zero if array size increases.
Asked
Active
Viewed 466 times
1 Answers
-1
Every operation executed by the blockchain costs gas. The theoretical max number of operations that can be executed is thus the max gas/block.
Otherwise, the whole blockchain could be spammed (and eventually killed) with while(true){} function calls.
Constant functions (the ones that are not modifying the state), can be executed on demand, on your local node and then it wouldn't cost any gas. But if you call that function from a transaction, it will cost gas.
Tudor Constantin
- 2,625
- 1
- 9
- 15
Every operation executed by the blockchain costs gas. The theoretical max number of operations that can be executed is thus the max gas/block.This is not true for constant functions. – Subhod I Feb 15 '18 at 14:04eth_callallows free reading of contract data. Most libraries that use RPC have functionality like this. See https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_call. It's read only, so of course any state changes it causes wont be permanent. – natewelch_ Feb 15 '18 at 15:42