This is just a hypothetical scenario. Let's suppose someone saved million of information in blockchain with huge gas consumption so far.

As for reading data in ethereum smart-contract cost no gas. Despite the fact that fetching information from blockchain is not an easy job that's why we have different protocols for that. Is it free to fetch millions of data from the block-chain?

Are there any hidden costs?

I created a scenario and saved 100s of information in an array of struct and it didn't cost a single gas but is it the same for millions of records?

  • Reading data doesn't cost gas. Saving it in storage will cost you however much your storage costs, which has nothing to do with Ethereum. – goodvibration Jul 30 '20 at 5:16

Data storage in the blockchain always costs gas. Data reading also costs gas if it is performed in a transaction (typically when the same transaction stores and reads data).

You always use a node to access the blockchain and the node has all of the blockchain data. Therefore you can read the data directly from the node without sending any transaction (called, a bit confusingly, a call or local call) for free. That way you retrieve the data from the node and the only entity which you might be abusing is the node - the blockchain as a whole doesn't even know about the read.

So, yes, it is free to fetch millions of records from your own(?) node.

  • Thanks. Talking about the scalability of blockchain. How severe it is in terms of performance when we try to extract data out of blockchain in that number(in millions lets say)? – NinjaMAN Jul 30 '20 at 6:34
  • You should not consider scalability in that sense with Ethereum. Whatever transaction you send you have to pay for the gas and the transaction has to fit within the block gas limit. Otherwise you don't need to worry about scalability for your own needs. Consider gas costs as the only important scalability concept, for your own needs. – Lauri Peltonen Jul 30 '20 at 6:37
  • Ok. Does that affect the performance while trying to read that much of the information outside the contract? How fast can it serve? – NinjaMAN Jul 30 '20 at 6:41
  • It can serve as fast as the node can provide - depends on the node's performance. It doesn't affect the blockchain in any sense, but if you try to send transactions through the same node at the same time it may affect the node's performance. Anyway, if you have further questions please post a new question - discussions in comments are discouraged – Lauri Peltonen Jul 30 '20 at 6:42

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.