Full Stack Decentralized Apps

La Fountain
Zero Equals False
Published in
4 min readJun 20, 2019
Photo by Thought Catalog on Unsplash

Building a full-stack decentralized app (DAPP) was a bit challenging for me at first. Although there were many resources available online, blockchain is very new and very different. Therefore the online resources are not always accurate with versioning, syntax changes and API features. All the moving parts can become difficult to track and manage. In the following series of blogs, I will attempt to teach you how to build a full-stack DAPP from beginning to end. I will discuss the different technologies involved and I will provide a few different ways to use the technologies.

It all began on October 31, 2008. On that date, Satoshi Nakamoto released the “white paper”, that described a technological system. The system was a peer to peer network system designed to allow payments without a financial intermediary. A combination of events occured following the release of tthe paper that led to the creation of the original bitcoin system in 2009. Bitcoin was designed to record transactions in a ledger and nothing more and used a tool called “blockchain” to ensure validity and security.

Bitcoin experienced huge success, which led to thoughts of how the blockchain technology could be used for real life applications. On October 2013 another “white paper” was published on Ethereum and introduced the idea of a Smart Contract. A smart contract is code that lives in the Ethereum Blockchain. These contracts can do things like have a person or another contract send things to it. Contracts are the core of the Ethereum network.

The Ethereum Blockchain is a network of computers(nodes). Traditionally users connect to the internet or one common server. However, with the development of Ethereum, instead of everyone connecting to one internet, a person connects to another person's computer. Thus, there is not one single point of entry, nor one single point of failure. The blockchain is a database that stores a record of every transaction that has ever taken place(ledger) and the contract capture/store the transactions/data.

In summary a smart contract is the code that lives in the Ethereum Blockchain and represents the backend of the full-stack DAPP app. Let’s take a look.

In this section, I will diagram the stack and define the technologies used to build the stack. In addition, I compare the current web development stack to the blockchain stack.

Typical Http Process

A typical http process, from left to right, involves a user inputing data into a user interface. Usually, an API or Library is used to convert input data into a format necessary to be sent to the server. The server uses some kind of API(or in MVC — controller) to write the data to the database. Based on the initial user input request, the database may return a response. The response is filtered via API (or controller) and formatted, then sent to the server to be served on the user interface.

BlockChain FullStack Process

The Ethereum process is significantly different than the traditional http. To begin with, when a smart contract is written using solidity programming language. The solidity compiler compiles the contract into Bytecode and an ABI. Bytecode is the contract written in machine language that is deployed to the Ethereum network. While Abi is a javascript interface of the smart contract’s functions, data and other pertinent information used by the developer within the application. From left to right, the user inputs information into the user interface, attempting to change data on the smart contract. In order to access the data or ABI, Web3 is used. Web3 is middleware used that allows the developer programmatic access to a deployed contract on the blockchain.

If the smart contract’s execution is based on the occurrence of real-world events. The developer will need to create an oracle. The Ethereum network was designed for validity, security and transparency. In addition, the network is decentralized, depending on connections to other computers as oppose to the internet. Therefore, the smart contract does not have anyway of knowing if the event occurred in real life and knowledge of the real world event is necessary to complete a transaction. Therefore, if it necessary for the smart contract to interact with data from the real world, an oracle is created by the developer. An oracle is an agent that finds and verifies real-world occurrences and submits this information to a blockchain to be used by smart contracts.

The only way a user can change data on the network is to use their private key. In order to gain access to the user’s keys, a technology called Metamask is used to connect the user to the Ethereum network. Metamask is a chrome extension that allows people access to the Ethereum network. Metamask will sign transactions with the users private key and then send the transaction to the Ethereum network.

In conclusion this is a brief overview of the Ethereum network process and the technologies used to build a full-stack DAPP. In the next article, we will begin to write a full-stack lottery DAPP. See you later.

--

--