Technical Perspectives | After two years of developing DApps and Layer 2 networks, I switched to the Substrate camp

Recently participated in three hackathons in succession, the technology stack selected Substrate, and achieved good results. Some friends are curious to know what Substrate is. As a developer who has two years of experience in Dapp and second-tier network development, and also worked on fork Ethereum, I started to switch to the Substrate camp completely half a year ago because I think this may be a better paradigm for developing decentralized applications .  

I. Comparison of three solutions for decentralized application development

First, I want to share my understanding of decentralized application development. Developing a decentralized application , for a team that is not particularly large, is nothing more than three ways :

  1. Dapp based on smart contract
  2. Layer 2 network solution
  3. fork Ethereum

But these three solutions have more or less shortcomings in terms of development operation and maintenance cost, performance and flexibility. The relatively low cost of smart contract development, operation and maintenance is a major advantage. But limited by the underlying public chain platform, the logic that can actually be implemented is limited . For example, it is currently difficult to verify ed25519-based signatures on Ethereum. At the same time, the project needs to compete for resources with various other applications on the same platform . For example, when ERC20's Tether transfers are more frequent, or when a spinach project is very hot, users need to spend more transfer fees for each transaction of the smart contract, and the transaction confirmation will be slower.

The second-tier network and fork Ethereum are mainly costly to develop and maintain . For a two-tier network, a set of systems (such as Ethereum, EOS, and Ontology) need to be adapted for each mainstream smart contract platform, and development is largely repetitive labor. The operation and maintenance of each system also requires investment. We have not considered here that the layer 2 network will be limited to the underlying public chain to some extent. Fork Ethereum, unless some cottage projects change their names, every time a serious project requires performance optimization or customization of one or more modules, a certain number of excellent developments are required. The project party also needs to invest certain resources to develop application logic. In short, these two solutions require much more development resources than smart contracts.

Another point is that these three are not mature in terms of governance and upgrading mechanisms . First of all, the governance of these three is generally offline governance, which has well-known flaws in fairness, fairness and openness. Secondly, smart contracts are not inherently supportive of upgrades, and many Ethereum multi-signature wallets are suffering. The second-tier network or fork of the Ethereum chain requires the community to upgrade the nodes offline. A slight negligence will result in a fork (such as the recent Istanbul upgrade of the Ethereum Ropsten test network, because most of the computing power has not upgraded the node software. A fork occurred)

Second, the benefits of application chain development framework

In this context, I saw Dr. Lin Jiawen's 15-minute video of posting a chain on the Web3 Summit a year ago. It was quite shocking. I took this opportunity to research it, and then I deeply felt that the application chain may be One direction of decentralized applications . First, an application chain development framework such as Substrate makes it relatively easy for development teams to develop a blockchain . The underlying parts of the blockchain, such as consensus algorithms and P2P networks, have been implemented, and developers need only focus on business logic. The entire development cost is much lower than directly developing a two-tier network or fork Ethereum.

Secondly, because the application exclusively enjoys the resources of the entire chain , there is no resource competition problem generated by other Dapps. At the same time, the performance of the application chain itself is no less than that of public chains such as Ethereum or EOS. And compared to smart contracts, the team has more flexibility in mastering application logic development. Moreover, the team can also adjust the relevant parameters and even the consensus of the chain according to actual needs.

Advantages of the Sub strate framework

Having said the benefits of this development paradigm for application chains, we need to talk about an application chain development framework. At present, there are only two types of application chain development frameworks on the market: CosmosSDK and Substrate (of course, I also look forward to Muta of Nervos). CosmosSDK certainly has its own advantages, but here I want to talk about the relative advantages of Substrate .

  1. High degree of abstraction, more general and less development work. In fact, with the help of templates provided by the framework, developers only need to pay attention to the storage, function logic, and event writing required for their applications. Applications such as crypto cats are a few hundred small in total in an application chain Line of code. At the same time, using the official front-end, you can directly interact with the chain without additional programming. Being able to do this is inseparable from Parity's accumulated development experience with multiple blockchain clients.
  2. The ecology of the surrounding tools is relatively complete. For example, based on the official front-end library, it is easy to develop the front-end interactive page of the application chain. Based on official and third-party rpc client libraries, it is easy to write custom rpc clients.
  3. Since all Runtimes (application logic) are written in Wasm, Substrate-based application chains can support online upgrades . In other words, after an on-chain governance has passed an upgrade resolution, the full node will run the latest version of logic even if the software is not manually upgraded. This feature makes the on-chain governance and upgrade seamless, and the experience is closer to the upgrade in traditional software development, which basically solves the governance and upgrade issues of the above three solutions.
  4. At present, the official has given WASM and EVM modules. If you want to develop a chain that supports smart contracts , it will be very, very fast.

The two points 1 and 2 make Substrate-based application chain development very friendly to small teams . In the case of being familiar with Rust, it can be said that the workload of developing a Substrate application chain is basically the same as developing an Ethereum Dapp. This is why all of our recent hackathons can be developed in a short time.

Author: Wu Yifei, Cdot Network CTO