Career, Tech Knowledge, Web3

Web 3.0 development with Substrate. Part 5: Overview of DApps.

This post is part of a series on Web 3.0 Development with Substrate.

Decentralised Applications (DApps) are programmes that run on P2P networks, including blockchains. Up until recently, DApps were extremely dependant on the resources of the blockchain on top of which they were built and, as a result, they would often underperform across a wide range of metrics. This is no longer the case with Substrate, a blockchain framework that establishes new models designed to enhance DApps functionalities and execution within a multi-chain ecosystem.

Novel structures

Legacy blockchains share similar two-tier structures: the protocol layer and the application layer. The protocol layer (Layer 1) encapsulates all core blockchain operations (consensus algorithms, cryptographic tokens/coins, data records), meanwhile all synchronous interactions (Smart Contracts, APIs, SDKs and DApps) constitute the application layer. As these technologies rose in popularity through the use of wallets and DAOs; researchers and developers have come to realise the limits of this schemata. Instead, finding solutions to ease the pressure on the Layer-1 computational resources has become the next critical step in DApp development.

Substrate blockchain layers are foundational for cross-chain DApps.
The innovative 3-tier structure of a Substrate blockchain.

The Substrate Framework redefines the current model by introducing a foundational layer for blockchains. In any basic Substrate chain, there are at least 3 layers: a meta-protocol layer or Relay chain (Layer 0), a protocol layer or Parachain (Layer 1), and an application layer or chain-specific instructions (Layer 2). This structure gives various degree of freedom when developing, since blockchain applications can be directly bootstrapped on to the Relay chain as a parachain (as a Bridge chain), tied to a Parachain (as a Smart Contract) or linked to a Parachain (as a DApp). Thus, each layer can focus on processing its own business logic to reinforce the security, functionality and operability of the whole network.

Secure operations

One of the primary advantage of DApps is that they offer censorship-resistance to their users across the network. This is because DApps operate from Key pairs (i.e Private keys and Public keys) that can be issued online without requiring provision of identity. Blockchain wallets are the most important and also most commonly used DApps because they are the first point of interaction between a blockchain network and its anonymous users. In the Substrate ecosystem, Polkadot.js (browser extension), Polkawallet and Fearless Wallet ensure that access to blockchain operations can occur with varying degrees of autonomy.

Substrate makes DApp development very agile.
BiFrost leverages the modularity of Substrate to expand the scope of its DApps.

To be operational, DApps also need to guarantee the integrity of the data that is transmitted between the users and the blockchain. This means that DApps need to obey the underlying blockchain logic first, before they can introduce any other complex operations. Substrate encourages developers to streamline these processes: they can create their own custom blockchain or a specific set of blockchain instructions (i.e Smart Contracts/APIs) on which they will directly build DApps. Blockchain explorers like the Polkadot/Substrate Portal and Polkascan are some example of DApps that facilitate submitting and verifying an increasing number of transactions on Substrate blockchains without affecting their overall performance.

Cross-chain execution

A key feature of a DApps is that they support trustless computation so long as all the resources needed are readily available on the network. Once the core of a DApp (i.e a Runtime module or a Smart contract) has been deployed onto a public Substrate chain, the data and parameters will persist and remain accessible to anybody, without requiring permissions. PolkaSwap is an example of a decentralised exchange built with Substrate that follows a unique system of rewards issuance called the Token Bonding Curve (TBC) which has been audited to run in a predictable manner for the rest of its lifecyle.

Darwinia Bridge chain runs its DApps in a multi-chain environment.
Darwinia integrates legacy blockchains’ functionalities to run its DApps.

DApps developed with Substrate have an added advantage over those built on existing legacy blockchains: they are modular and very scalable. Since most traditional DApps run on specific virtual environments, the challenge for developers has always been to find avenues for deploying their code without needing to refactor or rewrite it in a new programming language. Substrate chains reduce that friction from the ground up because their runtime can be customised to target any virtual machine in existence. The parachains proposed by Darwinia, MoonBeam and Plasm are offering a suite of micro-services that developers of independent blockchains can use to join the Substrate ecosystem at any point in time.

Substrate has introduced a new base layer in blockchain structure to make way for in-demand on-chain functionalities such as governance management, privacy preservation, identity registration, data management and cross-chain communication. By standardising DApp development, Substrate pushes for rigorous optimisation and benchmarking at every level of code execution. In Part 6, we will take a closer look at the back-end of a typical Substrate-built DApp.

References:

Polkadot Wiki: Polkadot and Cosmos

PureStake: Choosing a platform: A comparison of Ethereum vs Polkadot