r/programming • • Jul 17 '22

Create decentralized applications with JavaScript, HTML and CSS

https://gridnet.org/wpp/index.php/2022/07/12/create-ui-dapps-right-now-developer-guide/
122 Upvotes

159 comments sorted by

View all comments

8

u/jihad-consultant Jul 17 '22

If someone without schizophrenia could summarize this article / technology for me, id much appreciate it.

0

u/rafalsk Jul 18 '22

Kindly thank you for your question.

Architecture:

  1. There is a decentralized state-machine. Running a language called #GridScript, which is based on Forth, just made 'decentralization'-aware and with addition of some fancy semantics to make it suitable as a command-line interface.

  2. Nodes maintaining the state-machine, despite executing authenticated signed code bundles at full-redundancy (written in #GridScript), they come with embedded sub-systems for various types of use cases (embedded web-server, crypto incentivized web-rtc, web-sockets, mobile computer-vision aided mobile app for authentication available for both iOS and Android).

  3. These nodes may also process and react to user's input in real-time. That means that, this time, not only full-redundancy code-processing is supported. One may deploy code on the network which would be say; processing user's in-game position in real-time (as reported by in-browser JavaScript), so to facilitate a certain kind of an anti-cheat mechanism (should user choose to alter in-memory variables while playing a game hosted by the system, so to 'teleport' herself towards a desirable position). GridCraft game on our platform is a great example of that.

  4. Now leaving the decentralized state-machine aside, and towards client-side technologies running within the web-browser. The JavaScript sub-system, deliver by nodes once you access the system - it is very sophisticated on its own. It provides a full operating-system Desktop experience. Window manager, Start-menu etc, window-mechanics etc. Under the hood it also provides APIs (JavaScript ECMA 6) accessible by developers for a variety of purposes (communication, cross-browser communication, storage etc.) effectively hiding away decentralized aspects of the system. So a developer may focus on creating. Want to store a file? Invoke an appropriate user-mode function. Want to interact with the user through his mobile app? same. Want to create a multi-peer communication swarm for you game? same. no need to know WebRTC for web-browser communication, the system would be taking care of everything just sign up for events. Want to create a window for your app? Use JavaScript based APIs. Want to be notified about events happening to user data, the window you created, maybe about when data arrives after you've queried for a file etc? Yet again, sign up for events.

Now UI dApps, these can be mixture of #GridScript and client-side technologies (JavaScript, HTML , CSS). An UI dApp is deployed and hosted by the decentralized state-machine. There are two types of storage, full-redundancy storage and crypto-incentivized storage based on altered versions of Torrent/WebTorrent protocols.

The system takes care of all of the details. Synchronization between applications, boundaries etc.

It might be best to follow the tutorial as I believe one of the best ways to learn is by doing.

It takes you by hand about deploying a decentralized Hello World app of your own.

In addition you might be interested in the following articles:

https://gridnet.org/wpp/index.php/2022/06/30/decentralized-os-with-a-decentralized-ui-dapps/

https://gridnet.org/wpp/index.php/2021/09/17/architecture-decentralized-processing-threads-and-fake-it-till-you-make-it/ (especially true for an UML diagram of the entire system).

Looking forward to hearing back from you!