A Comprehensive View on DApps

By sheinix on ALTCOIN MAGAZINE

sheinix
Published in
11 min readNov 27, 2019

--

You can find my original post on the bitprime blog here.

Nowadays, almost everyone can identify what an app is. To clarify, here’s a formal definition:

“an app is a piece of software that runs in a hardware platform. It can run in whatever environment; the most common being in mobile, thus commonly known as mobile apps”.

The introduction of mobile apps was genuinely revolutionary; it created a whole new industry and made the world more productive and connected. Mobile apps are one of the great “stages” of the technological revolution that we’ve experienced over the years.

From the above figure, we can see how significant tech trends shape the world. The image shows roughly the time in history when these technologies were introduced or gained popularity.

In the ’80s and ’90s, there was the introduction of the personal computer by Apple and IBM. Microsoft followed the revolution with its software. Then, at the end of the ’90s and the beginning of the ’00s, the Internet took off. There was a flourish of different websites and technologies developed during this time. The Internet went from the static “HTML” site to Web 2.0, where you could interact with the website.

Moving forward, the introduction of Smartphones started a new technological revolution. Especially so in 2007, when the iPhone was released. It was so disruptive that different professions evolved, and business models had to accommodate for future possibilities of this technology. Social Media appeared in the picture when MySpace, Bebo, Facebook, Twitter, and Instagram started to gain popularity and broad adoption. This development also created new business models around user data and interactions on these platforms.

What’s essential to understand looking back at these stages, is that each builds on the previous stage’s success. We would never have had broad adoption of the Internet if we didn’t have personal computers first, nor would social media have had the success it has without mobile apps.

What’s Next?

There are a lot of technological trends that could be the next big thing. We have the Internet of Things (IoT), Machine Learning, Robotics, and AI, to name a few. But there’s one that has tremendous power, one that could have the most disruptive impact on our society since the Internet, and possibly even more. I believe we are on the verge of a new technological revolution. Blockchain technology has been brewing in the background for a decade. It’s getting ready to change the world as we know it, and DApps may play an essential role in this. What are DApps? Let’s find out!

What are DApps?

A DApp is a piece of software that runs mostly or entirely in a decentralised environment.

A common misconception is that a DApp is merely a Smart Contract running on a Blockchain, which is not entirely true. The architecture of each DApp varies a lot depending on use-case and decisions made by the engineering team building the DApp. Nevertheless, a typical DApp is usually run on a web-based front end with a mix of a centralised server and a Blockchain backend powered by Smart Contracts.

Why a DApp?

The main reason why you’d want to run a DApp is that it runs on the Blockchain. The business logic controlled by a Smart Contract that runs on the blockchain. Therefore the backend will be fully distributed, meaning that it will have no downtime and will continue to be available as long as the platform still operates. Compare this with traditional centralised backends where apps are subject to the availability of the hosting server.

Another reason you’d run a Dapp is that when a Dapp is running in a public blockchain like Ethereum, there is complete transparency with every transaction recorded in the blockchain. Also, everyone can see and verify that the DApp is working as expected. However, not all DApps run on public blockchains, some of them run on a private blockchain where only certain people can see the transactions on that blockchain.

We know that with Smart Contract, we can decentralise the transactions and logic of a program, but DApps offer more than that. They can decentralise other aspects, such as storage, messaging, naming, etc.

DApp Architecture

DApp architecture refers to the components of a decentralised application and how they interact with each other. Let’s look at how a DApp differs from a regular centralised app with some examples.

Here are the most common components of a typical web application, and below is how DApps work on each of them:

  • Frontend software (e.g. the User Interface on the browser of a web app)
  • Backend software (e.g. the server hosting the web app)
  • Data storage (e.g. the server where all files and data are stored, it can be the same as the backend software)
  • Message communications (e.g. the processes for communicating between components, users, and other apps)
  • Naming resolution (e.g. traditional DNS)

Frontend Software

The frontend of a DApp (or a simple app) refers to the client-side technologies used to interface between the user and the smart contract backend. The frontend is the most similar aspect between a centralised and a decentralised app. Standard web technologies such as HTML, CSS, and JavaScript are the most popular frontend software used in DApps nowadays. This interoperability allows web developers to use familiar tools, frameworks, and libraries when building Dapps. Although it’s not impossible to create a mobile DApp (there are a few resources to help create them), it’s not common to find mobile Dapps due to the lack of mobile clients that can connect to a blockchain network. The web3.js JavaScript library is one of the most common tools for interacting with Smart Contracts in Ethereum from a web-based frontend.

Backend Software

Traditionally, the backend software is the server-side of a web application. It’s where all requests from clients are processed and returned in the form of a network response. It is usually centralised, meaning a single point of process and storage for all requests of all clients. On a DApp, you can think of Smart Contracts as the backend, although that would be oversimplifying things. Running Smart Contract transactions (especially in Ethereum) is expensive and needs a lot of computational power; therefore there’s an incentive to have some of that computational power “off-chain” (outside of the blockchain). When we do a thorough analysis of how most DApps are architected on the backend, we will find that only a few of them are “fully” decentralised. Most of them have Smart Contracts, but also have a centralised component on their backend, usually a server that processes the parts of the execution that don’t need to be decentralised or “on-chain”.

Another consideration is the size of the DApp. A large monolithic Smart Contract can be costly to execute, so most DApps will have a set of smaller Smart Contracts with different functionalities that they can call on to complete specific transactions. This method is excellent software development practice, as smaller Smart Contracts are easier to maintain, execute and read.

Data Storage Software

Data storage refers to the physical or virtual servers storing the data of an app. In Ethereum the cost of gas and the low block gas limit makes “on-chain” storage unsuitable. Hence, most DApps use “off-chain” storage services; this means storing most of the big data outside the Blockchain, with only the relevant information from a transaction on the Blockchain. The data storage can be centralised (like a typical cloud service) or decentralised, stored on a peer-to-peer (P2P) platform. Ethereum has a native P2P storage platform called Swarm, but there are other powerful storage platforms such as IPFS.

Swarm

Swarm is a content-addressable P2P storage system created by the Ethereum foundation. A P2P storage system is a network of nodes that act as storage in a decentralised way. All files replicate in each node, which makes them more secure and reliable. In Swarm, you can access each file by referring to its hash. Swarms also allow you to access websites from a decentralised P2P system, instead of a traditional centralised web server.

IPFS

IPFS stands for “Interplanetary File System”, and is another P2P content-addressable storage. Similar to Swarm, all files are hashed and distributed throughout a network of nodes and accessible via their hash. IPFS aims to replace the HTTP protocol for delivering web applications. It does this by changing the paradigm and replacing the old centralised web server with a network of nodes, where any node can retrieve the information to serve a client.

Message Communications

The message communications part of every App is crucial. It is the set of processes and protocols that allows an app to communicate between internal components. This communication can be for different instances of the same application (e.g. same mobile app on different devices exchanging messages), or across different users. In a typical app, you achieve this by having a centralised server which takes all requests, processes them, and sends out the response to each client. In a DApp environment, it is possible to use P2P messaging protocols to decentralise this aspect. One of the most popular P2P messaging protocols for DApps is Whisper, which is part of the Ethereum Foundation’s Go-Ethereum suite of tools.

Naming Resolution

In a network, each node has a unique IP address, which is the address that other computers need to point to if they want to request or send information to that specific node. The naming resolution refers to the system that resolves those unique IP addresses into a human-readable name, which is the name that we type in the browser to access a web page or application. Each website name on the internet has an associated IP address, and on the Internet, the “Domain Name System” (DNS) achieves the same.

On Ethereum, there’s an “Ethereum Naming System” (ENS) which solves the same problem, but in a decentralised way. The ENS was launched on Star Wars Day, May 4th, 2017, and it’s a DApp itself, powered by a set of Smart Contracts in Ethereum.
As stated on the ENS web page:

“ENS eliminates the need to copy or type long addresses. With ENS, you’ll be able to send money to your friend at ‘aardvark.eth’ instead of ‘0x4cbe58c50480…’, interact with your favorite contract at ‘mycontract.eth’, or visit a Swarm-hosted site at ‘swarmsite.eth’.”

Current State of the DApps

The development and adoption of DApps are growing, although usage is not as high as in previous years. We have seen a correlation between the market price of crypto and the number of users, developers, and investors getting involved in DApps. Nevertheless, the evolution of DApps keeps getting better and better.

In the following graphic, we can see the number of new DApps per month which has been slowing down since December 2018 but is still above 1000 new DApps per month.

source: https://www.stateofthedapps.com/

In the following graphic, we can see the top 5 Ethereum DApps.

source: https://www.stateofthedapps.com/

This image shows that Games, Security and Finance are the most popular use cases for DApps on Ethereum. The number one DApp on Ethereum at the moment of writing this article is MakerDAO, which is a DApp for decentralised lending.

DApps Trends — DeFi

One of the biggest trends in crypto, for November 2019, is “Decentralised Finance” (DeFi). Of all the different use cases that DApps cover, it seems decentralised finance (borrowing and lending) is where we see the most users and transactions.

The traditional finance sector is highly centralised. Controlled by a few institutions which dictate who can or can’t have access to financial services. For example, a typical financial institution will have to comply with Know Your Customer (KYC) norms, and if someone doesn’t have all the required documents for KYC, cannot access financial services. This situation may not be the case in most developed countries, but in certain countries, there are a lot of people who don’t have access to financial services.

DeFi is at a very early stage but has disruptive potential. It could replace many of the legacy systems in finance. DeFi platforms could enable people from different countries, with various financial statuses, or other traditional parameters, to access to a wide range of financial services. It is genuinely game-changing for an industry that has been traditionally controlled for thousands of years by centralised established institutions.

There are quite a few platforms that offer decentralised lending and borrowing, let’s look at the leading platform, MakerDAO, to show how it works as a successful DApp in the Ethereum blockchain.

Example: MakerDAO

MakerDAO is a DApp that offers a decentralised borrowing service. It has a native stable coin called DAI. The DAI stablecoin has a 1:1 value ratio with the US Dollar, and Ether backs it. DAI is the coin that we get when we borrow from MakerDAO. Let’s look at an example to understand how it works:

Sarah wants to borrow money using MarkerDAO; therefore, she has to deposit ETH on the MakerDAO Smart Contract. This deposit will create a Collateralized Debt Position (CDP), meaning that now, she can borrow (create debt) against the ETH that she deposited (the ETH is the collateral). There is a collateralization ratio against Sarah’s deposit, usually 150%. So, if Sarah banked 1 ETH at $100 US Dollars, this will allow her to borrow up to approximately 66 DAI ($100/1.5). However, if the price of Ether drops below $100, Sarah’s CDP will be forcefully closed, unless she puts more ETH. Sarah could take out less DAI in the first place, which would always ensure that there’s enough capital locked against the money borrowed. Sarah will eventually need to pay back the DAI, the Ether price could be the same, less or more, and this will affect how much she will payback as the collateral is in ETH. She might pay less if the ETH price went up. This scenario is a simple example, but it is useful to understand the power of a DApp.

The Future of DApps

The future looks amazingly positive for DApps. The financial sector is being disrupted with DeFi, along with many other industries. As an example of how far DeFi can go, think about lending and borrowing as a protocol on the Internet, similar to TCP/IP for network communications.

We will keep seeing new projects built on Blockchain for different industries. The Gaming sector is adopting cryptocurrencies and building DApps at a fast pace and is expected to keep growing as better technology becomes available.

Other industries that we are likely to see significant changes in our energy distribution, governance, voting, supply chain, identity, and authentication.

The tokenised economy refers to an economy in which unique identifiers on the blockchain represent assets. The tokenised economy is where DApp and blockchain development is heading.

As Blockchain technology and DApps becomes more popular, we will start seeing more users on these decentralised platforms. It is vital to provide a good user experience and spread knowledge about these platforms, so the general public will have the confidence to jump into this new paradigm.

--

--

sheinix
The Capital

Software Developer 👨‍💻 from #ARG 🇦🇷 living in #NZ 🇳🇿. Crazy about #Blockchain and #Bitcoin. #iOSDev & #Youtuber (Spanish): bit.ly/2O2xI7Y