3

I'm building a small Dapp which is structured like so:

Every user who wishes to use the contract deploys a copy of the code. Individual contracts contain a small amount of information. Users can also 'follow' contracts deployed by other people to get information when those contracts change state.

To implement this 'follow' functionality, I think it will be necessary to store a list of addresses on the client machine. I'm curious what the best practice is for doing this. So far it seems that HTML5 local storage is the best way to do this, but I'm not sure whether this is considered best practice, or if there are other ways of doing it.

1

The best way to do this is to build your Dapp using either the MEAN stack (MongoDB, Express.js, Angular.js and Node.js: great book here. With the MVC (model-view-controller) approach, you would structure your Dapp with a server file, then directories containing the contracts, models, views, controllers and environmental variables. Here's a good repository of Dapp examples.

Also Meteor in conjunction with Mongo would be ideal.

You can create Mongo schemas for users (if you Dapp has it) or any other data structure you need, to store non-sensitive info while also linking to the contract for whatever functionality you want to implement.

0

One of the best practise would be to have your data stored in some kind of storage like database ( mysql,mongodb) etc or even file system. But to have these in place you need a server, which would help all your request going through it and managing the contract code. HTML5 Localstorage is not going to help here.

So your request flow to execution would look like below

User/browser request=>Server=>abi data(contract) from db=>response rendered by browser executing contract code.

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.