I know we cannot use Smart contract to be used as large database. But my client is asking for proof. Can you guys provide any link that will support this.
2 Answers
What you know might be wrong. There is nothing stopping you from using smart contracts as a large database.
But, if you want to store large amounts of data on blockchain, it will require a large amount of gas. And for each gas, if your are providing 20 gwei
as gas price, then you may be required to pay large amount of ether as fees of transactions.
However, this too can be avoided if there are miners which are mining transactions which have significantly low gas price or even zero gas price. In such case, you may use smart contracts as a large database for free. But you may not always rely on getting your 0 gas price
transaction mined.
-
Unlike database we can't retrieve maps. So how can it be a replacement for database? In general we can use smart contract for computations.– e.kCommented Apr 23, 2018 at 11:56
-
You can make getters and setters for map, so you can retrieve from map. There are some limitations in number of variables, but it's not impossible to use smart contract as database.– AyushyaCommented Apr 23, 2018 at 15:30
Zero gas price transactions get sometimes mined, sometimes not. There is zero incentive for miners to include them so they obviously are not prioritized very high.
So, in reality, if you want to get your transaction through you have to pay. You can find some calculations easily online; here's some discussion: How can I estimate price of data storage? and https://www.reddit.com/r/ethereum/comments/6rj8ks/current_storage_costs_and_limits/
-
How is Zero gas transaction possible? Some times I get out of gas exception.– e.kCommented Apr 23, 2018 at 11:55
-
Not zero gas, but zero gas price. So you basically wouldn't pay anything for the transaction, no matter how much gas you use. Commented Apr 23, 2018 at 11:55
-
I happen to write 3 multi dimension maps. Sometimes even in those case it throws out of gas. I tried to set more and more gas but at one certain point it shows limit exceeds– e.kCommented Apr 23, 2018 at 12:00
-
Yes there is a gas maximum limit. It basically means you can't send that big transactions. You either have to somehow make it into smaller transactions or change how you store data. Commented Apr 23, 2018 at 12:02