1

Scenario : Lets say I have DApp on ethereum which has two parties or two types of users , User A will update his status (uptime or storage or ip address...etc). User B will be able to browse a marketplace of all these users(A) with their status.

  1. There will be thousands of users and thousands of updates per hour , so it will cost a lot of gas for setting values and storage usage for these values , How to solve this issue ? should I use centralized databases here that I have control of ? or should I use a smart contract that will write to external databases ? what is the best practice for this issue ?

  2. If I concern for the speed of the status updates ,then using smart contract is not a good solution because every update for a status means triggeing a transaction so it needs mining which depends on how much fees you pay ....am I right ?

marked as duplicate by Ismael, Richard Horrocks, rstormsf, Jesse Busman, flygoing Dec 28 '17 at 2:08

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Currently is not on your best interest to store large amount of data in a smart contract in the blockchain. CryptoKitties clogged the network for several weeks with lots of transactions and small amount of data. A common approach is to use a store like IPFS and a smart contract to handle updates in batches. – Ismael Dec 26 '17 at 4:10
1

If you end needing storing lot of data in smart contract, it means you don't understand what it is made for.

Storing data in a smart contract is crazy expensive in gas because you change the EVM state "a lot".

If you really have to store data, do it in a database or you can use decentralized storage (IFPS, Swarm for exampe).

Note: If I understand well, you are trying to make a marketplace. What is the point doing it on blockchain? In your case, only transaction should be stored on the blockchain. In consequence, blockchain should be used only as a "tool" for your product, instead of using it as your core tech. (in my opinion)

Edit; to answer your questions:

  • 1: Yes, making tons of tx will cost you ton of gas, so ton of ether. You could use a private chain or (as said above), reconsider the purpose of blockchain for your product.
  • 2: Yes, blockchain is slow. arround 13 to 17 seconds for a block to be mined (or 2/3 seconds for a fresh private/permissionned chain). So arround this time for a tx to be processed (if you have "normal" gas price). You wanna be processed faster? Pay more!
  • so the best solution for real time updates will be in external database ? – legend10 Dec 26 '17 at 12:46
  • Yesm in my opinion – Florian Castelain Dec 27 '17 at 6:56

Not the answer you're looking for? Browse other questions tagged or ask your own question.