Introduction
The emerging field of Web3 (and, closely related, decentralized finance or “DeFi”) offers exciting opportunities for developers to build a new class of decentralized applications (or “dApps”) around meaningful and valuable digital assets and identity. The concept of the Web3 model is that users stay in control of what they own, who they are, what they share, and what they choose to bring with them to applications – and application builders like you create powerful new ways for those users and what they own to interact.
Whether we’re talking about a finance application that previously would have required access to trans-national banking infrastructure, or a game where users can take their characters and loot with them when they log off – Web3 and DeFi dApps can simply do things better, and do things that were never possible before.
Much of this potential, however, has not yet been made practically accessible to developers due to shortcomings in existing Web3 and DeFi platforms.
With the coming Babylon upgrade to the Radix Public Network, Radix will offer a decentralized platform and a set of tools to give developers the most purpose-built place to create this new generation of Web3 dApps. On Radix, digital assets will be easy to create and manage, smart contract logic will be intuitive to write and make safe, and the Radix Wallet will enable seamless and powerful connections to users and their assets through your web interface.
Because of the unique capabilities that Web3 developers on Radix will have available to them, it’s useful to explain just what a dApp on Radix is – from the user’s perspective, and the developer’s.
The User’s Experience of a Radix dApp
For users, a Radix dApp will simply feel like a website that is surprisingly easy to interact with, and has surprising capabilities.
To connect to a Radix dApp website and use their digital assets and identity there, users will need a new kind of digital wallet application. The Radix Wallet is a purpose-built solution, providing an intuitive user experience to securely manage everything they own, and seamlessly connect to an unlimited diversity of dApps on Radix.
The Radix Wallet is a mobile application for iOS and Android, and it can connect directly to either a desktop or mobile browser:
For users, the star of the show is always the dApp and its unique user experience – but the Radix Wallet is the user’s hub for keeping control of what they own and how they want to connect. This not only gives users convenience, comfort, and continuity between applications – it means that developers can focus on the functionality and user experience of their particular application.
This Radix Wallet vision demo video provides a good feeling for what sorts of capabilities are possible for dApps, relying on a connected Radix Wallet.
The Anatomy of a Radix dApp
Building a dApp is more than just building a simple website. That website will need to connect to users’ Radix Wallets, and it will likely want to connect to the Radix Network to get information on the state of accounts, assets, and smart contracts. Developers may want to build their own smart contract automation on the Radix Network to sit behind the web interface – or understand how to interact with smart contracts already deployed there by other developers. And like a traditional Web2 app, developers may want a server-based portion of your application for things like user management or specialized business logic.
This means that, depending on the type of dApp, it will be built from multiple parts. To understand the anatomy of a Radix dApp, we can split them into two broad categories: the pure frontend dApp, and the full stack dApp.
Pure Frontend dApps
If you’re familiar with dApps on Ethereum, this type might be somewhat familiar; something like Uniswap would be in this category. (If you’re new to Web3 and DeFi, this might seem a little strange.)
Because decentralized ledger networks like Ethereum and Radix can store and run powerful asset automation in the form of “smart contracts”, a web application may simply provide a UI to those smart contracts and not use a traditional server-side backend at all. Of course such a dApp can have no traditional server-side user management. It can be thought of as just a program that the user runs locally in their web browser that talks to the wallet and the network only.
On Radix, this type of dApp is structured like so:
The portions in blue are existing things from Radix that you can make use of. The portions in green are the responsibility of the dApp developer.
There are three major parts to this type of dApp:
- The Radix Wallet - The developer doesn’t have to build anything at all here. It’s the place where users control their assets, and where they’ll give approval for things whenever the dApp wants to interact with their accounts, personas (logins + personal data), or assets.
- The dApp Frontend - This is the dApps’s user interface to your application, and in this case of a pure frontend dApp, it also contains all logic that isn’t in smart contracts (components) on the Radix network. It could be very lightweight (a simple UI for an asset exchange smart contract) or quite heavy (a game that is just using Radix for a little in-game asset ownership).
- The Radix Network - This is where all accounts and assets live. It is also where transactions can interact with smart contracts, which on Radix are called “components”. The developer might write their own components to run in that shared trustless network environment – or they might choose to interact with components deployed by others there.
To get a feel for how these three parts of the dApp interact, imagine a simple dApp that presents a gumball machine to the user where they can insert XRD tokens, and receive GUM tokens in return.
Full Stack dApps
This type of dApp keeps everything we had in the pure frontend dApp, but introduces a traditional server-side backend for more featureful applications and user-personalized experiences. Think of it as combining the richness of the best of Web2 applications with the Web3 superpowers of digital assets and personal control of data.
This type of dApp on Radix is structured like so:
The new dApp backend part of the system has two new functions that interact with the Radix Network:
- User Management - This is where you keep track of users that login to your system so you can personalize their experience. Radix’s Persona logins allow simple one-tap no-password logins using the Radix Wallet with on-ledger Identities.
- Asset Management - This is something you might want if your dApp needs to directly submit transactions to the network itself rather than proposing transactions to a user’s Radix Wallet to sign and submit. Simple examples of this would be managing the dApps’ own internal reserves of tokens or configuring its components.
Developers from the Web2 world may feel more familiar with this type of dApp. It’s Web2, but with new superpowers:
- The application can seamlessly interact with digital assets and asset-oriented smart contract logic on the Radix Network to create more valuable experiences and connections to other applications.
- Users have a secure, no-password mechanism to login using the Radix Wallet.
- Rather than having to store user personal data in a database (both dangerous and objectionable to users), access personal data directly from the user’s Radix Wallet – with their permission, as needed.
Get Started Building Radix dApps
If you’re ready to get started creating dApps on Radix, join the Radix developer community! A great place to get started is our Radix Developers Hub. Or if you want to cut to the chase, dive into our tech docs at Building your first Scrypto Component.
Join the Discord #Scrypto channel to ask questions, get help and share your experience.