Intended Anatomy of Radix dApps

A decentralized application (dApp) is an application built to be deployed to a decentralized network and run by that network. Building a dApp typically involves creating both a web-based front-end user interface, and some smart contract logic that runs on a decentralized network. A web3 wallet (such as Metamask on Ethereum) typically connects a user’s account and assets to the dApp by taking responsibility for cryptographically signing transactions with the private key for the user’s account and submitting them to the decentralized network.

dapps arch

Radix follows this same model, with Radix’s smart contracts taking the form of Scrypto-based blueprints and components. A typical user interaction with a Radix dApp would work like this:

  1. The user loads a dApp UI webapp, which is served on a traditional cloud host or other file hosting system. (This host might also manage off-ledger data like private data for users or images for NFTs.)

  2. The dApp UI webapp connects to the Radix Network (via a Gateway node) to read the current state of any relevant components.

  3. The user initiates an action in the webapp which formulates a transaction and passes it to the user’s web3 wallet application.

  4. The wallet application signs the transaction (with the user’s approval) and submits it to the Radix Network (again via a Gateway node). The network computes and commits the results of the transaction to the state of components on the network.

The above describes the anticipated dApp architecture when Scrypto and Radix Engine v2 capability is implemented in the Radix Network protocol for its Babylon release. Until Babylon, the current Olympia release of the Radix Network has no Scrypto capability, and no web3 wallet, and so we have provided other ways for developers to get started today.

Radix dApp Development with Alexandria

To allow developers to begin experimenting and developing with Scrypto right away in preparation for Babylon, the current early access release of Scrypto (Alexandria) provides a local simulator so that the Radix Network is not immediately needed. It works like this:

dapps simulator

Blueprints are deployed, and instantiated into components, within the simulator environment running on the developer’s computer, using the filesystem as a simulated "ledger".

The Scrypto command line tools play the role of both dApp UI and wallet, letting the developer directly read the state of components, and submit transactions which require no signature and are automatically accepted by the simulator as valid and the results committed to the "ledger".

While this allows the developer to build complete Scrypto-based component functionality, it is currently not possible to connect dApp UI webapps. We are investigating ways to allow a webapp to be mated to the simulator to enable early webapp development and testing. And while there is no Radix web3 wallet yet available, such a wallet is under development for the Babylon release; further details will come later.