Decentralized is the new Serverless
In this series, I will try to demystify this whole new ecosystem. I will share with you my findings on a pretty high level. Don't see this as a complete course or an exhaustive list of technologies, but instead as a good introduction which will help you to understand why and how this architecture could revolutionize the web we currently know.
Main concepts and stakes of a decentralized architecture. What are the biggest challenges that we will face?
- File storage
How to store files (source code, pictures, …) the decentralized way. Data storage seems to be the most mature area as of now and we will have a look at various solutions.
- Blockchain and smart contracts
The most trending buzzwords right now. While their potential is unquestionable for some use cases, let's learn when you should or shouldn't use blockchain depending on your needs. We will focus on Ethereum and EOS.
Once you have file storage and processing, the next step for many web apps is to set up a database. What are the distributed and decentralized options?
What decentralized means?
First things first, let’s make sure we are using the same vocabulary. If you already know the difference, feel free to skip to the next section. Otherwise, here are 3 network topologies and how each of them would react in case of a specific node face an attack:
Centralized / Decentralized
If the system is controlled by a single entity, then it is centralized. In the case of a web app, the clients (web browser, mobile app) communicate with a server to render the app. If the server shuts down, then all clients lose their access to the app. This is what we call a Single Point Of Failure (SPOF). The scalability of the system is also very limited: you can increase the resources of this node by adding more RAM or hard drives (vertical scaling), but you can't add more nodes (horizontal scaling). On the other hand, this kind of system is easy to set up, maintain and evolve because you only need to deploy your system on a single node.
If the system is controlled by many entities, then it is considered as decentralized. It is more resistant: if one master node is turned off, only the client nodes connected to this master node will stop working. The system is still vulnerable to failures and attacks, but the impact is proportional to the number of master nodes impacted. It is also more scalable because you can scale horizontally (add more nodes) and vertically.
When it comes to distributed systems, all nodes are equals and have the same control over the system. One famous example is BitTorrent, a peer-to-peer file sharing protocol. Instead of connecting to a server to retrieve data, you retrieve it from your peers, and you also provide them the data they want if you have it. A distributed system is highly scalable and robust. On the other hand, an evolution of the system can be complicated because it involves many entities.
I am keeping it simple for this article, but the subject can be detailed much more. For instance, Vitalik Buterin, co-founder of Ethereum, distinguish 3 kinds of (de)centralization: architectural, political and logical:
“Decentralization” is one of the words that is used in the cryptoeconomics space the most frequently, and is often even…medium.com
Why does it matter?
Transparency and decentralized governance
This is, in my opinion, the true reason why decentralized systems are trendy right now. With big data, organizations own an incredible quantity of data about you and your personal life. Even if in the case of Google, Amazon or Facebook it is mostly used for advertisement purposes (which can already raise ethical questions), this could quickly go worse if they find an interest into politics, or if some third parties get access to this information (see what happened with Cambridge Analytica). We also know that these companies could be forced to install backdoors in their apps. Data is probably the most valuable thing right now and users are losing trust in these companies and looking for transparency.
The Internet is also already censored in many countries, and decentralization could be a way to bypass censorship by moving the control of the Internet and of users data in the hands of the users themselves and bypass governments and companies.
At last, organization structure can be decentralized. Decentralized Autonomous Organization (DAO) offers a transparent solution for governance. Of course, it still requires humans in the loop for some use cases. To go further, the following article explains what kind of organizations could/should be decentralized:
While decentralized governance is not a panacea solution to every use-case, more of it is needed in a world that is…hackernoon.com
Even though the current internet infrastructures are quite robust, it is made of Single Point Of Failure (SPOF) by design. DNS provider is one, and when Dyn went through a DDOS attack in 2016, it was a big part of the web that went down:
Decentralized and distributed systems still need to take care of security (and probably even more), but if the system is built in a strong and reliable way, it will resist better to an attack than a centralized system because it is not enough to take control of one node, in many cases you would need to take control of the majority of the nodes (learn more about 51% attacks).
Last but not least, scalability is the key now. Companies migrated to the cloud to be able to handle the charge in any circumstance, and are starting to migrate to serverless architecture to only pay for what they are really using. Decentralized and distributed architectures are already able to do that by design. The more users a system has, the more compute resources and storage capacity it will dispose of. The scaling capacity of such systems is natural.
A few promising examples
Textile Photos proposes a decentralized replacement for cloud photo storage and sharing services like Google Photo and Apple Photos. Images are stored on IPFS which will be the topic of the next chapter. Textile Photos is still in beta but the company is already planning to expand to other use cases (we can imagine a Dropbox/Drive replacement working the same way).
Eva aims to disrupt Uber and other ridesharing applications (that themselves disrupted the Taxi business a few years ago) by directly connecting drivers and passengers through the blockchain.
A free online marketplace. No platform fees. No restrictions. Earn cryptocurrency
You get it, OpenBazaar is a decentralized e-commerce platform where anyone can sell and buy. What is interesting though is how they secure the money during the transaction and how they resolve conflicts:
Scammers may try to take advantage of both buyers and sellers online, but OpenBazaar offers a unique feature of Bitcoin that helps prevent fraud: Multisignature escrow. In this e-commerce marketplace buyers and sellers can choose to agree to a mutually trusted third party OpenBazaar user before they start a trade, and then the buyer sends their bitcoin to an escrow account. Those Bitcoin can only be released when two out of the three parties agree where it will be sent. Normally the buyer and seller are the two parties in agreement, but if there is a dispute the third party will come settle the dispute. These third parties offering dispute resolution are selected in an open marketplace.
Everipedia is a wiki-based online encyclopedia. […] The company uses EOS blockchain technology and a cryptocurrency token called IQ to encourage generating information. One of the goals of the company is to stop certain countries from blocking its content by the integration of the blockchain model. Everipedia launched on the EOS blockchain on August 9, 2018.
— Read Everipedia article on Wikipedia (I’m surely going to Hell for this 😈)
Note that only the governance is stored on-chain, while articles are stored on IPFS. The EOS blockchain is a serious concurrent to Ethereum that claims to solve the challenges the latter faces (it is faster, already based on a Proof Of Stake and does not require gas to proceed transactions). It is still much younger, but very well funded. Only time will tell what cryptocurrency wins the smart-contract war.
Finally, is you want to discover new ÐApps (stands for Decentralized Application but with a weird D) or just check if your idea already exists, this website reference about 1800 of them.
Make it simple for the end user
As we will see, using the blockchain requires to have a wallet filled with various cryptocurrencies, and often to pay transaction fees (also called gas). Depending on your project and its users, it can be seen as a pointless setup while some centralized solutions already exist and work well. This is, in my opinion, the biggest challenge because for people to embrace this new paradigm, their user experience should be as easy as before. It has to "just work".
Package it for mobile
This young ecosystem is quickly evolving, but as of now many technologies are designed to work on a desktop or on a browser (sometimes with some extensions), and integrating them in mobile applications can be cumbersome. Mobile already represents a huge part of the web use and is vital to make decentralization happen.
Make it fast and reliable
People have already been using peer-to-peer for a while because it was answering a specific need (freely sharing large files). However, browsing websites using Tor is much slower than directly browsing the web through your favorite browser. This issue has to be solved in the design of the technologies.
No more backend
This point might be my personal utopia. Even though I love lots of backend technologies, I wish they could run a decentralized way, on users devices. This might not be possible for everything in a near future, but I believe this is the path to take whenever it is possible. In January, DADI cloud raised $29 million to build a decentralized cloud system. They have a very ambitious roadmap that would allow getting rid of cloud providers for many use cases.
Reduce the blockchain environmental footprint
Alone, the BitCoin Proof of Work (PoW) system is consuming as much energy as Switzerland. This is obviously not conceivable neither desirable to replace the existing web by such solution. While very critical, this challenge is already being addressed and we will see how in Chapter 3.
Companies must embrace decentralization
Going decentralized is a loss of control over the data and the logic of an application. While open source software is a perfect fit for that, making businesses adopt this new paradigm might be complicated. In some cases, a decentralized concurrent project could force companies to take the same path, but this is going to be a long way.
Find the right "business model"
Today, most of the web tools (cloud providers, third-party APIs, …) are making money to pay its employees and servers with subscriptions or a “pay as you use” model. With decentralization, I see 2 options:
- Everything could be free, and people would contribute to the web by storing data and sharing their processing capability on their devices. Foundations of the web would be open source and companies would contribute to it. Once again, this might be a utopia and people might try to curb their contribution to save resources and bandwidth so it may not be viable on a large scale.
- Usage of resources could be paid via a cryptocurrency. Users would gain tokens when they share their resources and would spend them to use the web. That method would incentive people to contribute and make sure to keep a good reliability of the system.
Ready to start?
Well, I hope you are ready and as excited as me to discover this new world!
Let's go then. Chapter 2 is available here and is about file storage.
This article reflects my comprehension of the topic which can be subjective so discussions are much welcomed in the comments. And give some 👏👏👏 if you appreciated it 😉.
P.S. I know I have been using the words "decentralized" and "decentralization" way too many times in this article (I let you count them), I hope you will forgive me 😬.