A DApp (Decentralised App) is an app that connects in some way to a blockchain (decentralised network). This doesn’t mean that the entire app is decentralised. Typically it involves just a small component of the app connecting to the blockchain through a straightforward API.
In fact, most DApps have components that rely on centralised services. For example, they could be storing sensitive information server-side, running computation or serving front end resources on a centralised server. It’s rare that apps are completely decentralised. Partial decentralisation, where an app makes use of blockchain functionality for a single aspect of its service, is far more common.
So what are the benefits of decentralisation vs centralisation?
As long as your software design follows the principle of separation of concerns, it is possible to create a modular design where some components are centralised, and some are decentralised.
A partially decentralised app allows you to access the benefits of both decentralisation and centralisation; though the decentralised aspects will only apply specifically to the data stored on the chain. It means that app services such as voting, NFT tokenisation or verifiable game transactions, which are easier to execute with a blockchain, can be decentralised while the rest of the apps function runs on a centralised server.
A decentralised design can make your app more scalable and easier to maintain.
Here are some concepts that are often used in fully or partially decentralised designs. Note that these designs aren’t mutually exclusive and are often used in combination.
Jamstack means pre-rendered content is served via a CDN (Content Delivery Network), and the dynamic features are added through APIs. Pre-rendering makes your web apps very fast to load and removes the need for the server to render the page on every request.
Some popular Jamstack frameworks include Next.js, Hugo, Gatsby, and Jekyll. Jamstack replaces a traditional web stack which typically involves a web server, an app server, a database, and a CMS, with a simpler design. This makes it easier to maintain and scale.
The serverless architecture typically means the server-side logic is in stateless containers triggered by events. This is achieved by using microservices and stateless functions. Cloud services, such as AWS Lambda, Azure Functions, and Google Cloud Functions, will execute your functions by dynamically allocating resources upon the triggering events. This allows the developer to outsource the infrastructure management.
Decentralised storage such as IPFS (InterPlanetary File System) allows you to share data across a decentralized network. This means you can host your DApp in a peer-to-peer distributed network, which makes it more resilient and inexpensive.
IPFS offers several APIs and a command-line interface, so it can easily be integrated into your DApp.
To interact with a blockchain network, you can either use a public node or set up a private one that’s dedicated to handling the requests from your apps.
Interacting with the blockchain through public nodes is easy. On CENNZnet, anyone can connect to our MainNet through a public WebSocket endpoint: wss://cennznet.unfrastructure.io/public/ws
Once you are connected to a public node, you can send signed transactions from your DApp to the node to read and write data from the blockchain.
Learn about the CENNZnet networks and public endpoints here.
For the best results, you can set up your own node. This allows you to control the uptime of the node and optimise the network communication time between your DApp and your node.
In addition, your node can earn rewards by participating in staking as a validator. See the Validator Guide for instructions.
For more details, please refer to the How to build a DApp guide.