Web3JS - Front or backend - web3js

I have a question about web3js.
If my site will load data directly from blockchain (MetaMask) without loading them into the database, and immediately through js bring them to the site then:
1. If a large number of events (1-10 kk) then analyze them on the side of the browser is a bad idea? Need to record everything in the database and the user to publish the analyzed information from the database?
2. When a user enters the site, then in fact his browser parses the information out of the blockchain (if using MetaMask)? Not my server. And I do not care how many connections go through web3js at the same time
What the best?
1. Get all data with web3js and show them on site.
2. Or get all data and writing to database, then use ajax for dinamic show data?

Related

What is the most suitable way to save user's actions in react webpage (SPA)?

I'm building a SPA site in React (using redux).
To my site, any user can connect through Google or Facebook.
Each user who logs in to the site receives a personal user_id.
For each user, the system needs to keep a history of documents created by this same user (like the recent docs in Word).
I need to create functionality that whenever the user is logged in he will be able to see a history of the five documents he has created/updated.
In addition, the latest documents will load even after disconnecting and reconnecting to the system.
To load the history into the system I am thinking of using a dedicated index in ElasticSearch.
My question is which way would be suitable the most to use when the user is already logged in and creates several documents one after the other -
Should I need to save everything within the index in ES or is there a smart way to save and update the information locally without producing a lot of calls to DB?
I want that in the end there will be only 2 DB calls that are made in total - one call to load the information on login and one call to update the information when the user logs out. Any other create and update docs will save locally on the client side until leaving the site.

How to architect a flutter app that submits lot of form data to backend API

I am currently building a Flutter App for both iOS and Android and the purpose of the app is to collect data from user via lots of forms and then submit it to a backend endpoint.
I need to consider number of things:
User completes half of the form(s) and wants to save locally but submit it later
User submits the form but gets network error so data should not be lost
user submits successfully. at this point data should be either deleted from local storage or be kept and later should get sync with backend db.
Technical points
I may need to use local db. What's the best approach for it?
Maintain global state until data is either stored or sent
I would like to reach out to stack overflow community where collegues may have run into similar situation and can give me some ideas/hints on how best I can architect the app. And What are the libraries / pub packages I can use.
I need to use Flutter only.
for storing the to be submitted data you might be looking for the shared preferences plugin. this lets you store data locally on the phone and lets you edit and delete this when the sync has been completed.

How to deal with web forms with lots of data?

I am curious to know about the real-world solution for dealing with forms that have large amount of data/fields or a wizard like interface (may be using AngularJS kind of GUI framework), especially if we want to take care of a scenario where the data persistence on back-end fails.
My questions are:
Is the form data saved in session, in the interim, (or may be on Browser itself using the JS libraries) till the user saves the final "Save" button?
Or is the data saved each time (i.e. on the user traversing from one screen to another using "Previous" or "next" buttons) on to a back-end database?
What happens if the form data has to be sent to an external web-service (instead of a database) and the call fails (due to timeout or any error)?
There is a strong chance that we will lose all the user entered data (unless we save it in a local database and re-try the web-service call later).
Do any of the caching f/w have any role to play here (including any AngularJS caching f/w)?
Thanks for sharing your knowledge.

Save data from firebase real time database to android local database (SQLite)

I wanted to save all my data from firebase database into a local database in (JSON format only) for my application to access it when not connected to internet. It consists even images in it along with string form of data.
Firebase allots very less space for offline mode saving data into the application hence can't use it.
I want data to be first saved in my local database and then to be retrieved into the recyclerView of my application.
Moreover I want to save login details as well as other user specific details required to keep the application function without internet into particular user's login.
Searched for answers but no reliable or step by step guide I encountered.
Are these things possible? What should I do ? Please guide.

Connect to ejabberd server and application server

I have an ejabberd server and I am trying to build a chat module in my Angular/NodeJS app.
Currenlty, my Angular app connects directly to the chat server. Assume my roster has 100 contacts comprising of online and offline contacts. I need to map all the 100 contacts with the users in my application server to get more details like companyId, email, contact, etc.
Do I have to loop through each contact and call an API to the application server? Wouldn't that put a lot of load on the frontend? Is there a better way of achieving this?
Apologies if my question is silly. I am new to XMPP.
There are several way´s of doing this.
You could go and fetch every single user from your API, cache them so the next you don´t have to fetch all the data, but that´s not the optimal solution.
The other solution would be to get all contacts with one single call by passing all id´s to your node application. Then the node app can fetch all needed data from your database and pass it back with one Request and not 100.
With more or less the same problem I used a jabber search getting up all the users and stored on client for the entire session.
My requsite it's "all users can chat with all other users" (about 100 users on server),
if your is not, I suggest you to create a custom IQ and let server cache the Jabber search (updating after each user registration) and reply with only required datas in a single call, async.

Resources