Explaining a Dapp on Ethereum
Dapps are the final, and arguably most difficult, concept to really wrap your head around when it comes to imagining a distributed technology future. I can vaguely remember my first questions when scrolling down the ethereum.org webpage for the first time, “Distributed… application? Ok, distributed how? I create a part of an application and am supposed to find the other part in this system? I only build one part and distribute the other parts to other people? How do I find everything I need if an application is just… scattered everywhere? ….RUN AWAY!!”
I thought about it for a few days and struggled to figure this thing out. I look back now and laugh at my misperception. The label Dapp or distributed application is a bit misleading I think because to me it implied the application itself, the pieces that made up the application were dispersed apart from each other in some way, maybe it’s just me. The term, however, describes an application that is distributed TO everyone in the network.. a distributed.. application. DUH!
Now that I have that out of the way we’ll take a few steps back to talk about applications, then introduce distributed applications in that context, and talk about some known and possible use cases for a distributed application.
Applications
Applications are ubiquitous today. They’ve morphed through different terms, some I may not be aware of, but my earliest term for them was games. Games, computer games, programs, applications, web applications, apps, web apps and …. Dapps. At a low level they’re all the same thing, bytecode that defines executable computer programs. Each application is designed and written with logical processes to perform some task automatically by a computer. This article is written using a web app hosted on a server the folks at Medium have pointed their web address to. Now, I’m not sure how many readers here even comprehend this concept so I’m going to take a minute to walk through that because understanding application delivery is important when thinking about Dapps.
Prior to the internet there were simply computer programs installed on your computer. There were no connections to any other computer so everything was installed right there, we call it ‘locally.’ Even with the creation of the internet you still ran a local program, your web browser, that interpreted messages sent from another computer, typically a server, another name for a computer specifically meant to send/receive messages to and from other computers. Your computer used those messages to display data in a certain way using your browser.
Web 2.0 came along when we started performing more computer processes off of the local computer and doing them in the servers, those other computers I mentioned, which had the programs installed. These became known as web applications. These web applications enabled anyone who connected to the server via the internet to send data, then the server would process the data exactly how it was programmed. The computer programs were no longer just local. Rather than use your own text editor to build an HTML file, for instance, and create your own webpage, you could now send your data to Facebook’s web application and it would build the webpage for you.
Things got even better for us when multi-player mobile games became available. You could now install Clash of Clans on your phone locally, play it, and send your game data to the server that was connected to all of the other Clash of Clans in the network. Now that the program was local AND connected, this game server just needed to verify that your Clash of Clans was operating by a set of certain rules. The server analyzed the data your phone sent, and you could use your phone to handle the gaming processes. This my friend, is version 0.5 of a distributed application.
Dapps 1.0
The aspect that changes when going from a networked phone app to a Dapp is that the central server, like the Clash of Clans server, goes away. “How is that possible?!” you ask. If you’re not familiar with the basic concepts of a distributed network, you really need to wrap your head around how these trustless systems operate with just data. I suggest reading and comprehending this and this then come back.
Knowing that distributed networks like Bitcoin and Ethereum essentially take a single truth of state database and give everyone a copy, we should easily be able to see where the Dapp finds its place. Since applications are a string of bytecode that define an executable program, they are really just another set of data. Well, a shared database can store data; all we need is a machine that knows how to find and run this bytecode. The Ethereum network has this machine installed and it’s called the Ethereum Virtual Machine (EVM).
When an application, aka string of bytecode, aka a smart contract, is ‘deployed’ or sent to the network, it receives an address in the shared database. When we want to call this application, or smart contract, we tell the EVM the address of the bytecode along with the data we’re sending as inputs. So what’s the novelty exactly? Since this bytecode is stored in the shared database, aka shared ledger, everyone on the network has an exact copy of the application. This means that we no longer need to trust that a Clash of Clans server will execute the correct code that verifies our data. Just like everyone, or every node, on the network can validate we have the same information, we can now validate we’re executing the exact same program on that information…. boom, *mic drop*… way to go Vitalik… WOW.
Uses of a Dapp
Since we can all enjoy the same high level space of understanding now, let’s talk briefly about why Dapps are important and some use cases, then you should free your mind and innovate your own use cases.
Is it really necessary to have all of the logic and shared data installed on a every computer for something like Clash of Clans? Probably not. There’s not much at stake there except for some pride.. and maybe some gold you bought. But what about when you want to trade $5,000 worth of Ether for another token? Or what if you have some record of ownership in the Ethereum database and need a safe way to transfer it? How about giving a currency asset directly to someone over a period of time?
All of these kinds of things can benefit from sharing the same operating logic among every participant. Typically when we are moving something of value to another account, location, or form we rely on trusted third parties, like the bank’s computer applications and database. If every participant, however, verifiably shares the same exact computer logic, or distributed application, then we can know that any utilization of this computer program will act upon your asset data the exact same way for everyone in the network. We achieve what is becoming widely known as a trustless system.
Come discuss the future with us at Majoolr! Our Discord channel is open for questions, comments, and concerns and we look forward to hearing from you. Also, if the Ethereum subreddit brought you here be sure to go back and let us know what you think.