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

2

u/Expensive-Elk-7287 Jul 17 '22

is it really possible to make that kind of application with JavaScript, HTML and CSS? i mean where is PHP, MySQL?

1

u/rafalsk Jul 17 '22

Great question.

Let me answer. It is not only possible it is already a reality.

Head over to https://test.gridnet.org to see some of these in action. Their corresponding source codes are available at our GiitHub repository right over here.

Now, let us be more specific on how it is possible.

The article is quite solid on that I believe, but to bring things into perspective.

There are nodes maintaining the decentralized network. They run a decentralized state-machine. Same as Ethereum.

Now, each node is capable of delivering, to a web-browser a JavaScript sub-system, through the embedded web-server, which makes all of the functionalities wrapped around nicely accessible JavaScript (ECMA 6 based) APIs. Everything object and event-driven.

As for data storage. There is no need for MySQL as nodes maintain a decentralized file system of their own.

In fact it is a two-tier system.

First is the full-redundancy storage, directly on the decentralized state-machine (implemented as a Merkle Patricia Trie, with all the integrity and consistency guarantees).

The second type of storage, is a crypto incentivized modification of Torrent protocol (including its Web-Torrent variance).

There is no need for PHP as nodes execute #GridScript.

Should you have additional questions please do not ever hesitate to ask!

12

u/Annh1234 Jul 17 '22

Your 100% wrong.

The reality is that your replacing servers with "nodes" which are servers you basically have no control on.

You can put as many copies you want on those servers, you have no guarantee that you won't lose your data. So your redundancy on "free stuff" means nothing. And at the end of the day it's basically the same as torrents, where new stuff is available but old stuff usually not.

Plus you still have the DNS service, ARP/IP service and so on which is 100% centralized, and sometime has to pay for.

Also, since you only serve HTML/CSS/JS you can put your stuff on some CDN, pay for the bandwidth and achieve 100% of what your trying to do without all the BS.

And you could do this stuff since the 1990s...

These days, you can pay for stuff like CloudFlare workers that run your code on their edge servers and serve your content from a "non centralized" place. But still any one entity can take it all down.

And for your solution to work, everyone participating needs to dish out way way more money than they would need of they rent a server somewhere.

0

u/rafalsk Jul 17 '22

Thank you so much for your comment.

I have put lots of effort to understand what you were getting at, to no avail for the most of it, let us go through every point that you've mentioned, together, shall we?

"Your 100% wrong."

I am sorry to be hearing that let us hope that we arrive at a common viewpoint through a constructive conversation, I can promise you my patience.

"The reality is that your replacing servers with "nodes" which are servers you basically have no control on."

The world around is is beautiful, I believe. Within of your brain there are billions of neurons firing each and every minute. Sometimes, when you connect many elements, the end result just might surpass your expectations.

The beauty of decentralization relies on the fact that you do not need control over particular nodes. Kindly read up on how Bitcoin manages to introduce a probabilistic work-around for the Byzantine Dilemma.

"You can put as many copies you want on those servers, you have no guarantee that you won't lose your data"

You never have a guarantee. You have no guarantee that Earth wouldn't be consumed by a block-hole an hour from now.

It all boils down to incentives. In GRIDNET OS, data storage is incentivized. The more you pay for storage the more likely you are not to loose your data, in case of private data. OR, in terms of public data - the better the content, the more people willing to download it, the more people paying for having parts of the files delivers, the more peers willing to host these files. It is called an open economy.

"So your redundancy on "free stuff" means nothing."

Could you please rephrase?

"And at the end of the day it's basically the same as torrents, "

it is not. We have crypto-incentivized storage and crypto-incentivized data exchange.

"Plus you still have the DNS service, ARP/IP service and so on which is 100% centralized, and sometime has to pay for."

You would be glad to know that we implement a system-intrinsic DNS service. What is more had you visited our main-website you would have discovered that nodes are accessible solely by IP addresses one may discover through a static Magnet URL. Now that eliminated the need for DNS entirely, as for getting in touch with nodes maintaining the network.

Our system intrinsic Web-browser UI dApp takes use of the in-house decentralized DNS service.

"Also, since you only serve HTML/CSS/JS you can put your stuff on some CDN"

JavaScript wraps the underlying decentralization aspects and makes all of the APIS easily accessible. It gives you access to the decentralized state-machine. Not to a centralized CDN or server. So you've missed the point.

"These days, you can pay for stuff like CloudFlare"

CloudFlare is a centralized company.

"And for your solution to work, everyone participating needs to dish out way way more money than they would need of they rent a server somewhere."

Kindly define everyone? You pay for full redundancy storage according to open market price conditions. Same for incentivized crypto-storage. You pay for what you use. It's as simple as that.

5

u/Annh1234 Jul 17 '22

Let me explain:

If you don't want your data "controlled" by any one company, upload your site to some CDN with other CDN companies as backups, and eventually falling back to your server/laptop/pc.

That way, you pay for the bandwidth used, your data is in N+1 places (thousand of servers), uptime is 99.9999% pretty much (one CDN goes down, another can take over, and they tend to use different backbones for the internet), and you can be sure your site won't go down because some kids' mom got mad and unplugged his basement PC.

------------------

Also, even if your data is copied to say 100% of the devices online, so it's hosting is 100% decentralized, the way you get this data is via your local ISP, which is controlled by your local government, and can be monitored controlled as they see fit.

Example: download some torrent movies, and you get letters from your ISP about doing illegal stuff.

In other words, you have no way to access this decentralized data without a centralized method.

------------------

If you REALLY want serverless, decentralized data storage, then play around with storing it in the network cables. Not really scalable, every tech provider will hate you/try to scrape you off the net, but that's the only way to "hide stuff" online and make sure only your software can access that data.

1

u/rafalsk Jul 18 '22

some CDN

do you know of a CDN which is not operated by a 'company'?

There is a tremendous difference between 'distributed' and 'decentralized'.

Bitcoin is decentralized. CDNs may be 'distributed' but under 'centralized' governance.

Torrent may be decentralized.

That way, you pay for the bandwidth used, your data is in N+1 places (thousand of servers), uptime is 99.9999% pretty much

GRIDNET OS offers such a decentralized CDN service.

In other words, you have no way to access this decentralized data without a centralized method.

Kindly do note that we do not promote any illegal activities, yet still, we employ Onion Routing together with an internal decentralized DNS service.

If you REALLY want serverless, decentralized data storage, then play around with storing it in the network cables.

There is no need for that.

2

u/Annh1234 Jul 18 '22

Ya... What you say makes no sense... Seems like you think everything with a company is bad.

When in reality, a company is just something so you can pay your taxes legally if you make more than a certain amount.

The difference between distributed and decentralized is in the implementation.

For example: You can have a master/slave MySQL setup that is distributed like normally, and you can set it up to take into consideration split brain occurences so it's decentralized.

That's is why I suggested multiple CDN networks so you get the picture.

Even Thor network works the same. Each node keeps a list of top x nodes it can connect to, and every now and they take votes on what nodes to use and what nodes to discard.

In other words, it centralizes the data so users get the same thing no matter what node they connect to.

1

u/rafalsk Jul 18 '22

One needs decentralized consensus no matter how you connect the MySQL instances or Cloud flare CDNs, the CEO could modify content of your code,website etc hosted on these with one call.