Caos

Caos

Cryptocurrency Investor 📈 Blockchain developer 👨‍💻 Husband/Father 👨‍👩‍👧 Student 👨‍🎓 https://caos.fn.services
twitter

DApp Development Guide — 01 Preparation Chapter

Introduction#

The author entered the blockchain industry in early 2018, participating in public chains, spot/leverage/futures trading at exchanges, development of on-chain DeFi protocols and DApps, as well as engaging in community building for developers across different ecosystems and preparing courses for developers. Throughout this process, I have interacted with many developers, most of whom possess Web2 skills and experience but lack sufficient understanding of software development in Web3. Reflecting on my own development path in the Web3 field, much of it has been a random walk with no positive feedback, transitioning from an internet engineer to a developer capable of independently building DApps. This journey has been long and tortuous. Of course, I also understand that this is part of the gradual improvement of blockchain technology. It is unrealistic to expect to have a relatively clear knowledge structure to learn how to build DApp applications back in 2018.

Although blockchain technology has developed rapidly in recent years, the learning curve for developers has not decreased due to the dispersion of information and market noise. Especially in the past two years, after focusing more on DApp development and project research, this feeling has become even more pronounced, which led to the idea of writing this series of articles.

Whether you are transitioning from the internet to blockchain or are still exploring the blockchain industry as a developer, I hope these articles can help you.

Explanation#

This series of articles aims to help developers utilize existing software development technology stacks to build decentralized applications (DApps) in a structured manner. The target readers should have basic web development skills or be familiar with any programming language. If you do not have a background in software development, it is recommended to start with foundational software development skills or master a programming language before reading this series of articles.

This article assumes that the reader possesses one of the following abilities:

This article primarily helps everyone understand the development stages of DApps and their similarities and differences with Web2 applications:

Several Stages of DApp Development#

Before that, we need to know what a DApp is — an application that runs on a decentralized network, providing services in the form of smart contracts and clients. Since the birth of Bitcoin, the mutual promotion and evolution of applications and protocols have given rise to different forms of DApps. This process has also seen different waves of DApp development. Since entering the blockchain industry in 2018, I have been paying attention to both the application layer and the protocol layer, and I have been fortunate to witness the vigorous development of the blockchain industry.

In summary, the development of DApps has gone through several stages:

  • The wave of Bitcoin forks and improvements (2013~2018) — Led by Litecoin and Bitcoin Cash, a series of Bitcoin forks brought about the first boom in blockchain applications. These applications focused on better decentralized currencies and improved blockchain parameters, with few innovations in technology and application layers. Market attention was more focused on the distribution of interests among mining groups, improvements in mining hardware, and technical claims. This narrative faded from public view after the Bitcoin Cash fork into BCH and BSV in 2018.
  • The rise of Ethereum smart contract standards and centralized exchanges (2017~2019) — The emergence of Ethereum allowed for large-scale application of smart contract technology compared to Bitcoin. The establishment of the ERC-20 standard established digital currency exchanges as the main form of head applications and clarified the early profit models of blockchain applications, pushing investment/speculation demands to their peak.
  • The emergence of Decentralized Finance (DeFi) and Decentralized Autonomous Organizations (DAO) tools (2018~present) — Blockchain has not stopped here. The on-chain AMM mechanism was popularized by Bancor and Uniswap. At the same time, many DAO pioneers attempted to quickly launch on-chain DAO organizations through low-code configuration methods. DAO platforms led by Aragon and DAOHaus have spawned more DAO organizational forms and accelerated the spread of blockchain governance ideas.
  • The emergence of multi-chain/cross-chain and Layer2 and new generation smart contract platforms (Flow, Near, Solana), laying the foundation for cross-chain applications. At the same time, optimistic Rollup scaling has also shifted towards applications (Arbitrum, Optimism), opening up people's imagination of growth space in Web3. Multi-chain and cross-chain have spawned a large number of services and innovations, such as cross-chain bridges and cross-chain liquidity aggregation, etc. The new generation of smart contract platforms also provides developers with more choices.
  • On-chain data analysis aggregation (2019~present) — With more on-chain users pouring in, on-chain data has also seen explosive growth. Data analysis and aggregation scenarios have emerged, accelerating the adoption of data service middleware such as The Graph and ChainLink, which greatly enhance the experience of DeFi and on-chain applications, further promoting the development of DApps. At the same time, more ToD & ToB developer service platforms, such as Infura and Alchemy, have emerged, further improving the development experience of DApps. Meanwhile, user-side data analysis products such as Dune and Nansen have experienced strong growth. Decentralized storage services like IPFS and Arweave have also been widely adopted.
  • NFT and GameFi (2021~present) — 2021 was the year of the NFT explosion. With the development of the previously mentioned infrastructure and applications, a richer asset class and a standardized NFT development process with lower thresholds have spawned PFP type assets and applications in crypto art. Axie Infinity ignited the narrative of X to Earn, all built on the foundations of ERC-721 and ERC-1155. The prosperity of NFTs has led to the emergence of on-chain NFT trading platforms like OpenSea.
  • Decentralized identity (Decentralized identifiers - DID) and Web3 social (2021~present) — As user data and cross-chain scenarios increase, users' on-chain data gradually increases and becomes dispersed across different chains. The aggregation of on-chain data based on users and on-chain identities is becoming increasingly important, giving rise to application protocols like BrightId and Proof of Human. With the increasing adoption of decentralized domains (ENS) [https://ens.domains/], support for DID and Web3 social has been provided, with applications like Lens and CyberConnect gaining attention in the Web3 social space.
  • Web2.5 and Metaverse (2022~present) — With the influence of Web3 breaking into the mainstream in 2021 and 2022, traditional internet giants are also seeking a new round of growth. Internet companies like Facebook have begun to embrace the Metaverse, and brands with significant influence like Nike, Adidas, and Starbucks are starting to experiment with integrating blockchain into existing business models, which we refer to as Web2.5 application types. Additionally, more teams are attempting to combine Augmented Reality - AR/Virtual Reality - VR/Artificial Intelligence - AI technologies with blockchain to explore new paradigms for blockchain applications.

It can be seen that the development of blockchain applications resembles an evolutionary tree, branching out from Bitcoin over time, flourishing under the impetus of the open-source community. This also allows us to see the trend of DApp development, where the evolution of technical protocols and the demand for application scenarios are interdependent.

In the early stages of blockchain development, the technology stack and concepts related to DApps were not widely disseminated; everything was in a primitive state. Web3 application developers faced many challenges, such as a steep learning curve, incomplete infrastructure, non-standardized contract standards, and unclear business models. Many needs that seemed very simple and reasonable in Web2 were difficult to realize within the blockchain technology stack. Setting aside technical differences, developers often needed to first improve the foundational infrastructure of software development before they could complete the development of certain application scenarios. This requires developers to possess certain architectural capabilities and a deep understanding of the underlying blockchain.

With the efforts of the open-source community, drawing on the development path of the internet and the mature software processes of Web2, the research and development trends of blockchain applications have also become clear. After long iterations and evolutions within the community, new application scenarios have emerged, giving rise to new protocols and standards. These new protocols and standards, in turn, promote innovation in applications. With the richness of new infrastructure and development tools, the barriers to application development are gradually lowering, and a new generation of smart contract platforms and protocol middleware is emerging. These products prioritize enhancing developer experience and promote the prosperity of DApps based on existing protocols and products.

For developers, the trends in blockchain application development are:

  • The technical threshold is gradually lowering.
  • The business threshold is gradually increasing.

From a technical perspective, open-source technical tutorials and documentation are abundant, and with a little effort, one can start DApp development. Existing tools, middleware, and services are already very user-friendly and stable, and each ecosystem has a well-established developer onboarding process. The difficulty for developers to build a decentralized application is continuously decreasing.

From a business perspective, blockchain is still in a very early stage. Compared to the internet industry, the technology is far from mature, and most entrepreneurs are still exploring. Due to its highly cyclical nature, it is challenging to establish a mature business model similar to that of the internet industry, let alone stable customer acquisition channels and controllable customer acquisition costs. Many businesses do not generate long-term positive external revenue, and the entrepreneurial risks based on DApps are extremely high. Of course, high risk also means high returns, and in the long run, blockchain still has significant development potential.

So, what kind of DApp will become the next killer application? I am continuously thinking and summarizing this, and I will also help analyze this in future articles. At this stage, we should focus more on what knowledge and skill reserves are needed to develop a DApp.

Characteristics of DApps#

Therefore, engineers who want to engage in or get started with DApp development need to clearly recognize the similarities and differences between Web3 business and Web2. On one hand, this helps us smoothly complete skill migration and reduce the difficulty of cognitive transition; on the other hand, it helps us clarify which difficulties to avoid potential problems.

Open and Transparent
The main logic of DApps needs to be completed through smart contracts, and the core business data is also stored in smart contracts. These contracts and business data are publicly transparent and can be retrieved by third parties, which eliminates the competitive advantage of businesses that rely on platform and data monopolies, while providing a foundation for application composability.

Asset-Oriented
The core of DApps is assets; all business and interaction logic revolves around assets. Data is generated alongside changes in assets. At the same time, assets can also serve as a medium for DApps to interact with users, playing roles such as rights, debts, certificates, etc.

Composability
With open-source code and public data, DApps possess the ability to be called and integrated by other developers. Based on some standard on-chain interfaces, contracts can also call each other, giving DApps the combinatorial ability akin to Lego blocks. Similarly, standardized assets within DApps can also be used across applications.

Transaction-Driven
This characteristic is determined by the technical features of blockchain. In account model-based smart contract blockchains, all changes in on-chain states require a transaction initiated by a private key signature. Smart contracts cannot initiate automatic execution or calls. To ensure data consistency and validity, blockchain must guarantee the legality of each transaction at the cryptographic level, thus achieving distributed data consistency.

Event-Driven
Although DApps must adopt a transaction-driven approach to think about user application usage processes, we still need rich application data to enhance user query experiences. Because blockchains only retain the latest global state, process data is scattered across different blocks and may not even be stored on-chain. Blockchains do not support complex relational queries, necessitating off-chain data indexing services. To ensure the correctness of data queries, we still need to index process data on a transaction basis. This requires defining the event types and related event parameters generated in transactions during DApp development, using off-chain caching services to cache process data for client queries.

Similarities with Traditional Web Applications#

There are many similarities with Web2 software development:

  • Client-server architecture (BS/CS)
  • Application interaction processes
  • Software development processes

Client-Server Architecture
Comparison of Web2 and Web3 Architecture - Image from Xitu Juejin Technical Community

From the perspective of application models, aside from the core backend services being replaced by smart contracts and data being stored on the blockchain, everything else can be accomplished using traditional internet technology stacks. For example, the client technology stack, caching service indexing queries, CDN acceleration, mobile clients, etc., can all leverage mature internet solutions.

Clients and blockchains also communicate based on the TCP/IP protocol. Some blockchains or node service providers also support REST-type query interfaces and protocols, making it convenient for developers to complete data interactions between clients and servers.

Application Interaction Processes
An excellent DApp also requires an excellent user experience. We see that many DApps have already managed to encapsulate the complexity of blockchain, providing users with aesthetically pleasing product interfaces and convenient blockchain interaction experiences. By leveraging data indexing services, they can achieve interaction experiences comparable to internet products. Achieving this also requires efforts in professional product design and interaction design to improve product usability and eliminate the gap between users and Web3.

Software Development Processes
Similarly, since it is software development, best practices for software development and process management still apply. Market evaluation, requirement reviews, technical architecture design, use case design, software iteration methods, unit testing, etc., are all essential processes. Whether for large or small applications, these key processes must be undergone to better complete the process of developing a DApp from zero to one.

Differences from Traditional Web Applications#

So, where exactly do DApps differ from traditional Web2 applications? Let's first look at a more detailed architecture diagram of Web3 DApps:
Detailed Technical Architecture of Web3 - Image from Xitu Juejin Technical Community

We will not elaborate on the content here during the preparation phase, as it will be discussed in later articles.

If you are familiar with the Web2 development process and have some development experience, you are already half a DApp developer. To better develop DApps, we still need to make some cognitive shifts:

  • From service authorization to signature verification
  • From data-centric to asset-centric
  • From closed systems to composability
  • From efficiency-first to security-first

From Service Authorization to Signature Verification
The commonly used HTTP protocol for internet products is stateless; each request exists independently, using cookies and sessions or additional information in HTTP headers to identify and authenticate user identities. The authentication methods here are primarily centralized and determined by each service, with no completely unified standards. However, in DApps, authentication transforms into signature verification, completing user permission authentication through digital signatures. Everything is based on cryptographic algorithms, which enhances security while also increasing applicability.

From Data-Centric to Asset-Centric
From the perspective of internet platforms and applications, the importance of data is self-evident. The monopoly and competition over user data have never ceased. Data within platforms becomes the core production material for internet advertising monetization, and users do not "own" their data. In DApps, ownership is paramount; the boundaries between data and assets become blurred, with assets highlighting their core position in applications. Users' rights data and business data often manifest as assets within applications, and many DApp services treat user assets as primary resources, conducting business and services based on these assets.

From Closed Systems to Composability
The traditional internet moat relies on closed systems and massive data, but DApps take the opposite direction. Based on publicly available on-chain data and standardized assets, DApps possess a foundation for composability. Application developers can integrate assets from other applications or protocols as the basis for their business, and they can also provide convenient SDKs for third parties to integrate their application assets. Issuing assets in a standardized manner allows applications to be combinable.

From Efficiency-First to Security-First
Centralized systems do not need to consider distributed consensus issues, allowing their data to be freely rolled back and business logic updated. Applications based on smart contracts cannot roll back data or perform large-scale business updates. All of this is considered from the perspective of asset security, sacrificing efficiency for decentralization. As DApp developers, we must consider the scalability and compatibility of smart contracts from the design stage, while also ensuring proper decoupling of business logic, separating infrequently updated logic from potentially updatable logic. Since business and user assets are closely related, we also need to pay attention to the permissions of smart contracts and potential security vulnerabilities. Throughout the development history of blockchain applications, it has been a journey marked by security vulnerabilities and user losses. As application developers, we must remain vigilant, learn from past experiences, and handle asset logic with caution, conducting thorough unit testing and code audits to minimize security risks.

Conclusion#

As the first article in this series, it provides an overview of the development and characteristics of blockchain DApps, helping us sort out some similarities and differences between DApps and internet applications. This aids developers in mentally preparing for DApp construction. Whether you are a product manager or a developer, based on these concepts and understandings, application design and development can be more efficient.

In subsequent articles, we will explain the process of a DApp from conception and design to development and launch using specific real project cases, allowing us to understand more intuitively how a DApp is built from zero to one.

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.