03 / 08
Chromia dapp overview
This page gives a short overview of how Chromia is built and introduces Rell, its programming language, before moving on to code examples.
A dapp on the Chromia platform consists of these layers:
- Backend: You write it in Rell and deploy it to the Chromia platform, where it runs on nodes operated by a decentralized network of system providers.
- State Management: The Chromia core software keeps your dapp's state in a database and replicates it on multiple nodes.
- Blockchain: Finalized transactions are written to the blockchain, which is also replicated on multiple nodes.
Rell is Chromia's relational programming language. It aims to be quick to pick up and practical for developers of any background. Its syntax resembles that of other modern languages, and it takes a relational approach backed by an efficient query language that is pleasant to work with.
You compile Rell code and deploy it to a container on the Chromia platform. The Chromia network gives every dapp its own blockchain and manages it. Once your dapp is deployed, your frontend can send it transactions and query its data.
Deployment also sets up the tables and relations your dapp needs to store its state in a PostgreSQL database. Chromia manages this database for you and replicates it on multiple nodes. The nodes convert the queries and operations in your Rell code into SQL and run them as required, using either an interpreter or a compiler.
For more on how a Rell-based decentralized app is structured, see the dapp overview.
Interacting with a Chromia dapp
You communicate with a Chromia dapp through ordinary web requests, so reading from the blockchain and updating app state works in a way you already know. Libraries such as Postchain Client simplify this further with ready-made functions for dapp interactions. To change state, you send a signed transaction to a node. To fetch data, you send a read-only query.
The node that receives your transaction starts exchanging messages with the other nodes running your dapp, called validators. Before the transaction runs, a "supermajority" of them must agree that it is valid. Once more than two-thirds of the validators confirm validity, they reach consensus and the transaction is executed.
Executing a transaction means running the operations it contains. These operations may change state, and any changes are applied to the dapp's state database. The transaction is also written to the blockchain, which makes it immutable and consistent across all nodes.
That completes the architecture overview. For more detail, read the architecture documentation. The next part takes core Solidity concepts and shows how to express them in Chromia and Rell.