I use ethereum platform for develop dapp. And I need to store some draft data out of blockchain before push it to network . In this case can I use smart contracts or store draft data in db or store it in localStorage . Which solution is good ? Or there is something else solution for such case ?
1 Answers
If you are using a public Ethereum, then storing draft data on a smart contract will be expensive (since that means storing it on the blockchain). If this is a private Ethereum, then it depends on whether the draft data should be available only on the node where it was created or on all or some of the network nodes too. Keep in mind that to reduce the size of data stored directly on the blockchain, you can use either a decentralized file system (IPFS, Ethereum swarm) for distributed data storage or cloud storage with only links to the data itself being transferred to the blockchain.
While the draft data can only be accessed by the site where it is created, the choice between a database and file storage is essentially a matter of taste and personal preference. The size of the data — tens of bytes or megabytes — and the capabilities of the available database management systems can also be affected.

- 1,219
- 1
- 7
- 9
-
thanks for answer @MadJackall . I have one more question . I need to send some http Request from smart contract , and as far as I know in Ethereum we couldn't send any request to out of chain , but we can use oraclize _query for this . But this is payable and eht discounts from smart contract account , right ? Request number may be huge . I think that we need alternatively write service that make this api calls and then call smart contract function with already getting data . Is this approach good ? – Nigar Atakishiyeva Jan 30 '21 at 20:14
-
To give good advice, you need a description of the entire process that you are trying to implement and the requirements for it. – Mad Jackal Jan 31 '21 at 07:05
-
I need to develop marketplace dapp.The problem is in login process.We have microservice for auth logic.And in current state when user login then call smart contract login function which send httpRequest (oraclize_query) to our auth microservice, handle response and detect user is registered in our service or not . But I think this approach isn't good logically.I think we can this api call in frontend side with react and handle response ,I mean do this out of smart contract . And use smart contract only for like storeProducts getProducts operations.I'm new , can you help me @MadJackall please? – Nigar Atakishiyeva Jan 31 '21 at 08:06
-
I think that if authorization is not directly related to the blockchain account, then it is better to perform it through a web service directly, without using the blockchain as a proxy element. – Mad Jackal Jan 31 '21 at 12:15