Introduction to the Ethereum DApps

Rafael Zavala | August 29, 2022

Blockchain has gained quite a bit of fame for being the technology behind Bitcoin. However, beyond cryptocurrencies, it is a technology that is quite applicable to endless applications. One of the main advantages of blockchain has to do with solutions related to security, transparency, and traceability that it provides.

To learn more about the Ethereum Blockchain, the documentation section at Ethereum.org provides a complete overview Let’s define a few terms, specifically in the context of Ethereum, that might be helpful while reading this article.

Blockchain: It is the sequence of all blocks that have been committed to the Ethereum network over the course of the entire history of the network. Each block contains a reference to the previous block, which helps maintain ordering across all blocks (and thus over the precise history).

Ether (ETH): It is the native cryptocurrency of Ethereum. Users pay ETH to other users to have their code execution requests fulfilled.

Ethereum Virtual Machine (EVM): It is the global virtual computer whose state every participant on the Ethereum network stores and agrees on. Any participant can request the execution of arbitrary code on the EVM; code execution changes the state of the EVM.

Nodes: The real-life machines which are storing the EVM state. Nodes communicate with each other to propagate information about the EVM state and new state changes. Any user can also request the execution of code by broadcasting a code execution request from a node. The Ethereum network itself is the aggregate of all Ethereum nodes and their communications.

Account: Where ETH is stored. Users can initialize accounts, deposit ETH into the accounts, and transfer ETH from their accounts to other users. Accounts and account balances are stored in a big table in the EVM; they are a part of the overall EVM state.

Transactions: A "transaction request" is the formal term for a request for code execution on the EVM, and a "transaction" is a fulfilled transaction request and the associated change in the EVM state. Any user can broadcast a transaction request to the network from a node. For the transaction request to affect the agreed-upon EVM state, it must be validated, executed, and "committed to the network" by another node. Execution of any code causes a state change in the EVM; upon commitment, this state change is broadcast to all nodes in the network.

Smart Contract: A reusable snippet of code (a program) that a developer publishes into EVM state. Anyone can request that the smart contract code be executed by making a transaction request.

Decentralized App (DApp): A DApp has its backend code running on a decentralized peer-to-peer network. Contrast this with an app where the backend code is running on centralized servers. A DApp can have frontend code and user interfaces written in any language (just like an app) to make calls to its backend.

The Ethereum Blockchain and how it works

In the Ethereum universe, there is a single, canonical computer (called the Ethereum Virtual Machine, or EVM) whose state everyone on the Ethereum network agrees on. Everyone who participates in the Ethereum network (every Ethereum node) keeps a copy of the state of this computer. Additionally, any participant can broadcast a request for this computer to perform arbitrary computation. Whenever such a request is broadcast, other participants on the network verify, validate, and carry out ("execute") the computation. This execution causes a state change in the EVM, which is committed and propagated throughout the entire network.

Requests for computation are called transaction requests; the record of all transactions and the EVM's present state gets stored on the blockchain, which in turn is stored and agreed upon by all nodes.

Cryptographic mechanisms ensure that once transactions are verified as valid and added to the blockchain, they can't be tampered with later. The same mechanisms also ensure that all transactions are signed and executed with appropriate "permissions" (no one should be able to send digital assets from Alice's account, except for Alice herself).

Ethereum currently uses a proof-of-work consensus mechanism. This means that anyone who wants to add new blocks to the chain must solve a difficult puzzle that requires a lot of computing power. Solving the puzzle "proves" that you have done the "work" by using computational resources. Doing this is known as mining. Mining is typically brute force trial and error, but successfully adding a block is rewarded in ether (ETH).

New blocks are broadcast to the nodes in the network, checked and verified, thus updating the state of the blockchain for everyone.

To summarize, when you send ETH to someone, the transaction must be added to the block which will get mined. The updated state is then shared with the entire network.

A smart contract is code that lives on the Ethereum blockchain and runs exactly as programmed. Once smart contracts are deployed on the network you can't change them. DApps can be decentralized because they are controlled by the logic written into the contract, not an individual or company. This also means you need to design your contracts very carefully and test them thoroughly.

Decentralized Apps

Let’s dig deeper into what “decentralized” means and the primary difference when compared to the “centralized apps”. Decentralized means that this app has its backend running on a decentralized peer-to-peer network. So, the main difference with the most known centralized apps or simply apps is that the typical apps have a central server where every call is made.

Working with DApps has its benefits such like: privacy, resistance to censorship, complete data integrity and trustless computation or verifiable behavior. Although, it has some drawbacks such as more maintenance, performance overhead, network congestion and it might be harder to build user-friendly experiences in a truly secure fashion.

There are different categories of DApps. Thse categories are based on the underlying blockchain model that is leveraged:

  • Type 1: These DApps have their own blockchain. For example: Bitcoin or other cryptocurrencies that have their own blockchain.
  • Type 2: This category of DApps leverages the blockchain of Type 1 apps. These decentralized apps are protocols and have tokens necessary for their functioning. The Omni Protocol is the best example of a Type 2 application. Omni is a distributed trading platform developed on top of the Bitcoin blockchain as a ‘layer’ to facilitate ‘peerless, trustless, and effortless’ exchange of assets or value between parties without involving middlemen.
  • Type 3: Type 3 dApps use the protocol of the Type 2 application. The SAFE Network (Secure Access for Everyone) is an example of a Type 3 DApp. It is a decentralized data storage and communications network that replaces data centers and servers with the additional computing resources of its users. It is an autonomous data network that enables the creation of censorship-resistant websites and applications. It leverages the Omni Protocol for issuing SafeCoins that are then used to allow for its functional aspects.

Key takeaways

  1. A decentralized application is an app that uses blockchain for its backend side
  2. Creating a new DApp has a lot of benefits, but it can have a lot of drawbacks mainly on the maintenance of the Smart Contract
  3. There are a lot of ways to implement a DApp, though this article is focused on Ethereum DApps
  4. Ethereum Smart Contracts are recognized for ensuring security and enabling true decentralization, but it is not the best when there is need for scalability. So, the development of your new application must be primarily driven by your need. In cases that security outweighs the need for scalability then Ethereum is your best choice

About Encora

Fast-growing tech companies partner with Encora to outsource product development and drive growth. Contact us to learn more about our software engineering capabilities.

Insight Content

Categories

Share this Post

Featured Insights

Fill Out Later