A Brief Overview of dApp Development
Decentralized applications (dApps) are becoming increasingly interesting to developers around the world. Unlike traditional applications built on platforms like iOS and Android, dApps connect users and developers directly without the need for a middleman to host and manage the code and user data. Permission is not needed to build a dApp and there is no company or centralized group of people that can change the rules of the platform. Today there are over 1000 dApps built on Ethereum, the leading dApp platform.
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 its frontend code written in any programming language that makes API calls to its backend. Furthermore, its frontend can be hosted on decentralized storage such as IPFS.
As a developer new to dApps, the prospect of getting started can feel daunting. The goal of this piece is to give a broad picture of the current landscape for newcomers.
The Key Difference Between Traditional App Development and dApp Development
The biggest difference between dApp development and traditional app development is the level of rigor by which code must be scrutinized before it’s pushed to production. dApp development is actually more like hardware development than software development in that respect. In hardware development, rigorous testing and prototyping needs to be done before the product is offered to the public. A hardware recall costs lots of money, takes a long time to fix, and tarnishes the reputation of the manufacturer. Likewise, in dApp development, a smart contract can’t be changed once it’s launched on the mainnet. A bug in the smart contract loses users’ funds and tarnishes the reputation of the dApp developers.
Traditional app development, in contrast, tends to emphasize fast iteration cycles as best practice. As a developer, you want to build a minimum viable product, get people testing the product, and release updated versions as quickly as possible. Traditional apps like Facebook have the motto of “move fast and break things,” which isn’t exactly the best motto for dApp development.
Ethereum is Pioneering the dApp Movement
Ethereum was the first major Blockchain-based platform to build a Turing-complete language for writing smart contracts on-blockchain and quickly became adopted as the platform of choice for dApp development. 91 of the top 100 dApps are built on Ethereum, up from 76 more than half a year ago. Ethereum also has 30 times more developers than the next blockchain community.
Programming Languages for dApp Development
Despite the popularity of Solidity, there are many issues with its language design. Several new programming languages under development right now could become alternatives to Solidity for programming smart contracts.
Vyper is an experimental language that is much simpler than Solidity. Vyper increases security, simplicity, and auditability by making code as human-readable as possible and thus making it difficult to write buggy code. As a result, Vyper is far more limited in what it can do. It doesn’t support many features of Solidity, such as modifiers, class inheritance, inline assembly, operator overloading, recursive calling, infinite-length loops, and binary fixed point.
Another potential language for Ethereum is Simplicity, which was proposed last month at the Stanford BPASE Conference. Simplicity addresses four issues of Solidity. First, Simplicity avoids denial of service by computing resource costs of programs. Second, Simplicity avoids running out of gas by using static analysis tools to bound the resource costs. Third, Simplicity avoids hacks by using Coq, a formal verification tool, to prove program correctness. Lastly, Simplicity adds privacy by pruning unused code before it appears on the blockchain.
Given the importance of security in smart contracts, formal verification is a lot more common in dApp development than in traditional app development. Formal verification is the process of checking whether an algorithm satisfies some logical requirements. Using formal verification tools such as Isabelle and Coq, you can prove a code is bug-free just like how mathematicians prove a theorem is true.
Simplicity belongs to the family of functional languages (Haskell, Clojure, Lisp, OCaml, etc.). Functional languages are generally unpopular among developers; in fact none of the top 15 most popular languages on Github are functional languages. Nonetheless, another dApp platform Tezos uses a functional language Liquidity for programming smart contracts. If security becomes a major problem for Ethereum dApps, then functional languages could become more popular in the future.
Developer Tools for dApp Development
There are many Ethereum developer tools for programming smart contracts. Here are a few of the most popular tools:
Parity is an Ethereum client written in the new low-level language Rust. A lot of projects depend on this tool, hence why the Parity Wallet hack caused 514k ETH to be frozen. Truffle provides tools to quickly create, compile, deploy, and test dApps. EthPM is a package manager for Ethereum, Oyente is a static analysis tool for smart contracts, and Remix is an in-browser Solidity editor and compiler.
In addition to developer tools, there are best practices for smart contract security, and services such as Zeppelin to audit smart contracts deployed on the Ethereum testnet. Zeppelin even offers a game Ethernaut to test your smart contract security skills.
A Misconception about Ethereum dApp Development
dApps built on Ethereum actually contain very little smart contract code. In the grand scheme of most dApps, the smart contracts make up a small percentage of the overall codebase and its functionality. Smart contracts are on-chain, meaning that the code directly interacts with the blockchain. In contrast, off-chain code doesn’t directly interact with the blockchain.
In the case of Storj, the smart contracts, which are just 9% of the overall codebase, only exist to provide logic for transactions. There is no code for the storage and encryption of shared files, broadcasting a node, or disc usage rules. The functional codebase that handles the above components is located in a separate repository written in NodeJS. Similarly, in the case of Golem, the smart contracts comprise of only 3% of the codebase, and the codebase that does all of the heavy-lifting is written in Python.
Next Generation dApp Platforms
Tendermint / Cosmos
Tendermint consists of two components: a blockchain consensus engine and a generic application interface. The consensus engine, called Tendermint Core, ensures that the same transactions are recorded on every machine in the same sequence in order to achieve Byzantine fault tolerance. The application interface, called the Application Blockchain Interface (ABCI), is built on top of Tendermint Core and enables the transactions to be processed in any programming language.
Cosmos is a platform based on Tendermint that allows you to build interoperable dApps among different blockchains in any programming language. If your application requires sovereignty and flexibility, then you can develop on your own blockchain without having to deal with the complicated networking and consensus parts of the software. In contrast, if your application is smaller scale and doesn’t require its own blockchain, then you can develop on Ethermint, allowing you to do everything Ethereum does but with faster performance.
Blockstack is a new platform for building dApps where users own their personal data. dApps on Blockstack are off-chain programs that communicate with the underlying Blockstack Core using the JSON REST API. These dApps can written in any language you want, and Blockstack has a great tutorial that teaches you how to build dApps on its platform.
Ethereum vs. Next Gen dApp Platforms Moving Forward
You should of course evaluate for yourself if you’re a new developer getting started, but in my view the choice of programming language is unlikely to be a deciding factor for most on whether to build a dApp on Ethereum, Cosmos, Blockstack, Neo, or other platforms.
Network effects are generally far more important than choice of programming language — you want to maximize the number of users of your dApp first and foremost. Most developers will build apps on a certain platform if it has the most users, and likewise more users will flock to the platform with the most apps. History has also shown that developers are willing to learn proprietary languages (Objective-C/Swift, CUDA) if there is sufficient demand for apps on such platform (Apple Store, NVIDIA GPUs). Given today’s trends and the historical data, Ethereum could become the one chain to rule them all for dApp development.
Note: Scalability and governance are considerations outside the scope of this piece that could become reasons to build on next-generation blockchains in the future. Today though, the developer experience + network effects of Ethereum are unparalleled relative to existing alternatives.
Some additional resources
- Ethereum Development Walkthrough (Parts 1–5): Context on Ethereum and dApps
- CryptoZombies: Interactive code school that gets you started in dApps quickly
- Ethereum StackExchange: Helpful community to get questions answered quickly
- Ethereum Game Developer Makes Over $500,000 in 1 Day: This piece shows the promise of dApp development incentives