What is DApp? How to Build Your Own DApp?
Perhaps, you’ve heard that many Fortune 500 companies are interested in the blockchain technology, discovering its new applications in such industries as health care, supply chain, finance, real estate, etc. Blockchain is no longer just a technology associated with cryptocurrencies, it’s the basis for numerous dApps — decentralized applications.
dApps are applications run on a decentralized network by many users. These applications use protocols that don’t depend on trust between two parties. Blockchain allows developers to increase uptime, to decrease downtime, and to minimize costs. In addition, developers who work on dApps do their best to detect any potential points of failure. Given that dApps rely on computing power from many users in the network, these users usually get a reward in tokens.
dApps offer certain advantages for both developers and users, as they work efficiently, protecting users from server failures, eliminating losses of data and security breaches. It’s almost impossible for hackers to shut down dApps because they are not powered from a certain central source.
Most dApps share some common features, such as :
- Open-source code, autonomous management
Applications don’t require you to create a maintenance team. There’s also no need in a central server, and everyone can work on the application. Most modern applications are hosted on cloud servers or intended for downloads because developers want to make them more accessible, while dApps address this problem using decentralization.
- Protected data
The data is securely stored in a blockchain. In addition, blockchain allows developers to avoid points of failure.
Tokens are used as a reward for users who provide computing power. Costs are distributed among providers depending on their activity. In addition, tokens are used in ICO, which is the most common method of fundraising for startups engaged in developing decentralized software.
dApps can run on various blockchains, however, the Ethereum blockchain is the most popular. Ethereum is also the first blockchain that enabled developers to create dApps. It also has a special runtime environment called EVM (Ethereum Virtual Machine). EVM prevents attacks and makes sure programs cannot influence each other’s state, eliminating interference in communication.
How to Build DApps on Ethereum
Ethereum provides a friendly environment for developers who can create a variety of decentralized applications. The most important part of any decentralized application is the technology of smart contracts. Smart contracts automatically define the terms of the agreement and also automatically ensure that the necessary conditions are met. They enforce obligations and define penalties. For example, if you want to rent an apartment and pay for it in cryptocurrency, you and the landlord can use smart contracts. You will get a digital key that will become accessible at a specified date. If you don’t receive the key on time, the smart contract will automatically issue a refund. On the other hand, if the landlord sends the key before the specified date, the blockchain will hold it until the necessary date and then release the key for you and the fee for the landlord. Just as many other blockchain-based solutions, contracts can be checked by anyone from the network, which makes the whole system transparent and reliable. Smart contracts also automatically cancel at the pre-defined time. In addition, it’s impossible to change such contracts without both parties receiving an alert.
At first, you can use centralized web servers for web components that interact with Ethereum and need hosting. Most existing dApps use centralized servers for this purpose. However, it’s certainly not the best solution, since you will need to trust the server. Fortunately, there are also decentralized hosting solutions like Swarm and IPFS, that may be adopted more widely in the future.
Another important factor to consider is a browser that will render the HTML5 user interface. There are several reasons why traditional browsers are not a perfect solution to this problem. First, they rely on external centralized RPC services to ensure interaction with the blockchain. Secondly, web 2.0 browsers don’t have a built-in wallet for cryptocurrencies.
How to Build DApps on EOS or Tezos
Although having the same purposes, EOS is quite different from Ethereum when it comes to building dApps. There are many blockchain experts who discuss the advantages and disadvantages of both blockchains, trying to understand who will dominate the dApp market in the future. The first difference is scalability: EOS allows for making 1,000 to 6,000 transactions per second, compared to 15 transactions in the current version of Ethereum. EOS also has zero transaction fees and supports human-readable account names, while in Ethereum usernames look like long strings of symbols.
To develop a smart contract on EOS, you need to create a wallet on your private blockchain, load a contract called “eosio.bios,” and create your accounts. First, start a single-node blockchain, and then create the wallet. Private keys are stored in encrypted storage with a specific encrypted password. There’s no need to use your passwords directly. Instead of using the command line, you can enable the interactive mode. We suggest that you keep your wallet locked when not using it and unlock it to when creating smart contracts.
The eosio.bios contract allows you to control the resource location of accounts directly, thus helping access API calls. EOS allows users to create two accounts. The first account is a user account, and the second one is used for testing. When creating token contracts, the system differentiates unique tokens from the others and defines them. After this, the user can call such actions as recalling, freezing, and contributor whitelisting.
To develop dApps on Tezos, you will have to familiarize yourself with its smart contract language — Michelson, a static typing language that can keep the information on the type in its bytecode and checks the type during the runtime. Thanks to this feature, Tezos can do type checking while users are doing transfers. If Tezos sees that the type of calling parameters differs from the type specified in the contract, the system will indicate a mismatch error.
Michelson itself is completely different from other programming languages, in fact, this language resembles an operation code of a virtual machine. This language is certainly not the best choice for handwriting. Developers can use Liquidity, a high-level language that solves this problem. You can also use an alternative language called fi.
The Most Popular dApps
CryptoKitties is the most popular decentralized game and one of the most popular decentralized applications, in general. Moreover, developers of this game managed to make a valuable contribution to the blockchain technology by introducing ERC-721 token. This is a collecting game. You can collect and trade various kittens. Each one of them is 100% unique and has a number of specific attributes. Given that all kittens are unique and have a different value, developers came up with the idea of non-fungible tokens, and ERC-721 became the first non-fungible token in the world. Non-fungible tokens enable us to tokenize virtually anything, including specific valuable items like unique works of art, real estate, etc.
The game itself became so popular that it caused significant congestion of the Ethereum blockchain in 2017.
- Gods Unchained
This is another decentralized game. This project has received great support in the blockchain industry and attracted an impressive amount of venture capital. It’s a multiplayer game where players can fight and trade. The company plans to start a world championship in 2019, with $1.6 million of payout.
This is a decentralized crypto-exchange. IDEX is the most popular exchange based on Ethereum. Compared to centralized exchanges, IDEX ensures better private key security and has lower fees.
ForkDelta is another exchange, which supports exclusively ERC-20 tokens. All trades are completed using smart contracts.
It’s a gambling application. Gambling has become one of the most common applications of the blockchain technology so there’s no surprise that such apps are popular. This game simulates the whole cycle of ICO exit scams. There are thousands of users who have lost their tokens playing this game, however, one user actually managed to win $3 million in the first-round jackpot.
It’s also a gambling app which is able to show real chances of winning. Users can choose the probability of winning and how many tokens they want to bet. The lower the probability, the higher the possible payout.
This ambitious project is aimed to create a globally accessible, open financial system where everything that has value is tokenized. Creators of this project state that the blockchain-based global financial system will be able to serve as an equalizing force that helps people who live in countries with corrupted governments and limited access to healthcare, education, internet, etc.
This app is different from many others because it’s a market of predictions. People can bet cryptocurrency on the outcomes of various events, including elections or natural disasters. When a certain outcome is declared, users get payouts automatically. Creators of Augur state that their project can become a tool for political and business forecasting.
Challenges of Decentralized Applications
Although dApps have a number of advantages, they have yet to become mainstream. Why are dApps not popular? The thing is that every decentralized application faces the same challenges, sooner or later.
The first and the main problem is that it’s still too hard to create completely decentralized apps that wouldn’t involve any centralized solutions at all. Of course, various startups are trying to address this issue, but such complex problems require a developed community, strong collaboration, and fast decision-making. There’s a need for a different kind of environment that cannot just appear out of nowhere. This is also a reason why even Bitcoin used to be partially centralized at the beginning — there were not so many people who understood what Satoshi was doing. Even today, infrastructure still lags behind compared to the new technology.
Another common challenge is governance. Any ambitious project needs strong leaders. Many blockchain startups quickly become inert when they turn into corporations, and founders get overwhelmed with all the typical business issues. In addition, there is an extremely strong competition in the blockchain market, which is a reason why bigger companies are ruthless when it comes to dealing with smaller competitors. In turn, it results in a lack of fresh ideas and innovation.
We’ve already mentioned the scalability issues, which remain one of the main challenges in the blockchain industry. For example, CryptoKittens led to a significant decrease in the speed of transactions and increased fees because users of the network performed too many transactions. Ethereum can perform only 15-30 transactions per second, which is a big problem. Scalability remains one of the main arguments of Ethereum’s competitors (e.g. EOS, Stellar, Cardano, etc.). Although each one of these projects promises to solve the scalability problem, none of these solutions has been successfully tested yet.
There is also a problem associated with the high volatility of cryptocurrencies. It’s impossible to build a stable economy without any stable assets that represent value. To make some cryptocurrency stable, we need collateral. For example, a cryptocurrency can be backed by a fiat currency. Another solution is crypto-collateralized cryptocurrencies. An example of this approach is Bitshares, which value is determined by crypto-assets.
Finally, any product or service can become popular only if it offers good usability. If we compare blockchain to the internet, now blockchain is somewhat similar to the dial-up internet. This technology is still new. Users have to deal with long private and public keys, they also need to calculate the necessary amount of gas for their payments. In addition, there are such threats as Coinbitclip Trojan, which changes a few digits of a BTC address when a user copies it on the clipboard. After this, the victim sends money to the scammer’s wallet. Obviously, such a kind of fraud would be impossible if addresses wouldn’t be 33 characters long.
Useful Resources to Learn More About DApps
- Learn Solidity
Ethereum and Solidity: The Complete Developer’s Guide
Solidity Tutorials – Coinmonks – Medium
- Learn smart contracts
Intro to Programming Smart Contracts
- Learn Truffle
- Learn EOS
First Steps in EOS Blockchain Development
Your First EOS dApp
- Learn Tezos
The Hitchhiker’s Guide to Tezos
Getting Started with Tezos