====== Challenges in architecting dApps for blockchain platforms ====== By Anton Zubarev ===== Introduction ===== Numerous architecture challenges appear, while developing software systems [1], including interface stability, guaranteeing security and reliability, evolution management and assembling independently developed modules. With the invention of the Blockchain technology, decentralized apps (dApps), though being around before blockchain (using P2P network) [2], became increasingly popular. These kinds of apps, while having significant advantages over typical ones, present new architectural challenges. The essay introduces the overall concept of decentralized apps on the blockchain and describes challenges in their architecture. ===== Smart contracts as a base for DApps on the blockchain ===== Blockchain technologies have been actively developing with the invention of the Bitcoin cryptocurrency by Satoshi Nakamoto in 2008 [3]. A blockchain is essentially a public digital ledger, which is distributed and decentralized and which is used to store transactions among many nodes. Moreover, every record in the blockchain cannot be changed after it has been “committed” to the network without altering all of the following blocks of records. The theoretical basis of the blockchain, providing advantages such as transparency, security, immutability and decentralization, made it a very promising technology for a variety of Internet-based systems including digital currency, Internet of Things (IoT), public and security services [4]. Since blockchain is a form of a distributed system with no centralized control (decentralized consensus algorithms are used), all the applications, built on it, can be categorized as decentralized applications (or, shortly, DApps). As it was mentioned in the introduction, before the rising popularity of the blockchain, DApps were referenced and used in the context of Peer-to-Peer (P2P) networks. Some of the most widely used of them are, for example, BitTorrent [5] (used for file sharing) and BitMessage [6] (for instant messaging). While blockchain infrastructure provides decentralized and distributed ledger to store some records (initially related to transactions between users of the cryptocurrency), it is still not clear how programs can be executed. Another important step in the blockchain evolution is the adoption of smart contracts. The smart contract functionality provides an abstraction layer for general computations on the blockchain. Those blockchains supporting smart contracts are often referred to as second-generation blockchains. One of the most popular examples is Ethereum [7], which gives developers an ability to implement Turing-complete smart contracts, that is, the ability to create DApps. Ethereum DApp market is the biggest (by value) blockchain-based DApp market [8]. ===== Characteristics of dApps ===== Decentralized apps have the following advantages: * No censorship – the user can’t be blocked from using dapp (submitting transactions). One of possible applications ¬ decentralized social media platform, where no single participant can delete or edit the message already sent. * Privacy – most of dapps do not require the user to share his real-world identity. * No owners – as the app is decentralized, the code can’t be taken down and anyone is able to use the app once it is on the blockchain. * Simple to deploy – infrastructure (for the deployment of the app) is already there, developers should only code high-level logic of the app. * No down time – the blockchain is always working on large amount of nodes and blockchain network is very difficult to attack. * Open-source – blockchain economy forces developers to have open-source project, as, otherwise, users won’t trust it. As for the disadvantages, they are: * Low scalability – all current blockchain systems suffer from throughput bottlenecks [9] – they have low capability of dealing with a large amount of concurrent traffic. As an example, game CryptoKitties, after becoming rather popular, resulted in 30000 pending transactions on Ethereum. * High latency – due to the nature of the blockchain, transaction confirmation time is rather large. Even though Ethereum has reached transaction confirmation time of around 15 seconds (Bitcoin user has to wait around 10 minutes for the confirmation), it is not really comparable with the latency of typical centralized apps and users may get frustrated when using dapps. * Poor UX – besides the aforementioned high latency, which negatively affect user experience, another common problem is rather hard “onboarding” for non-technical users – one has to firstly buy some cryptocurrency on an exchange, then connect Metamask account (or any other wallet) and only then the user can reach the dapp. * Hard code modification – after release of the dapp on the blockchain it is rather hard to change the code, so developers have to thoroughly test the dapp. ===== Architectural challenges ===== After studying the notion of decentralized apps and their advantages and disadvantages, the following architectural challenges were identified: * Thorough testing should be done (as updates are undesirable due to the nature of blockchain) and that, in turn, requires well-thought architecture and complex/intricate codebase can significantly slow the process of testing and evaluating the correctness of the dapp in various scenarios. * Possible choice to sacrifice the decentralization – many developers decide to partially use centralized services like AWS or Azure for the sake of robustness and usability. While it is partly beneficial for the end-user, the whole ideology of decentralization is compromised. Moreover, those centralized services create a possible point of failure. * Maintaining privacy. Since all transactions are visible to all users of the blockchain, it is the responsibility of the developer to encrypt any sensitive data of the user. * Decide on the economy of the project. Every transaction has a fee and it is the choice of the developer to decide how to distribute the needed payment for dapp to function on the blockchain [10]. * Select the blockchain implementation. Different blockchain implementations have different pros and cons and it is important to choose stable one, but without sacrificing the potential flexibility. ===== Conclusion ===== The essay presented the overall concept of decentralized apps (dapps) and possible architectural challenges. Despite the growing popularity of smart contracts and infrastructure for the deployment of decentralized apps, there are multiple important factors to take into account during the development of the dapp. Those factors are mostly related to the nature of the blockchain. In my opinion, crucial ones are the need to thoroughly test the dapp, before it is released, and maintain the privacy of the users, due to the immutability of the blockchain network. ===== References ===== - Bosch, Jan. Architecture challenges for software ecosystems. ACM International Conference Proceeding Series. 93-95. 10.1145/1842752.1842776. - Pacitti, Esther et al. “P2P Techniques for Decentralized Applications.” Synthesis Lectures on Data Management (2012). - S. Nakamoto, “Bitcoin: A peer-to-peer electronic cash system,” 2008. - Z. Zheng, S. Xie, H.-N. Dai, X. Chen, and H. Wang, “Blockchain challenges and opportunities: a survey,” International Journal of Web and Grid Services, vol. 14, no. 4, pp. 352–375, 2018. - BitTorrent. URL: https://www.bittorrent.com/ - BitMessage. URL: https://bitmessage.org/ - Buterin, Vitalik. “A Next-Generation Smart Contract and Decentralized Application Platform.” (2015). - 2020 Q2 Dapp Market Report by Dapp.com. URL: https://www.dapp.com/article/q2-2020-dapp-market-report - Cai, Wei & Wang, Zehua & Ernst, Jason & Hong, Zhen & Feng, Chen. (2018). Decentralized Applications: The Blockchain-Empowered Software System. IEEE Access. 6. 53019-53033. 10.1109/ACCESS.2018.2870644. - Wu, Kaidong & Ma, Yun & Huang, Gang & Liu, Xuanzhe. (2019). A first look at blockchain‐based decentralized applications. Software: Practice and Experience. 51. 10.1002/spe.2751.