This is the second part of the series on building a complete full stack dApp on RSK.
In this article, we will explain several fundamental blockchain concepts such as smart contracts, dApps, web3.
To understand the architecture of a dapp, you will need to understand how the web works. A web application runs on a cluster computers but is mainly controlled by a single person or company which makes it centralized, while a decentralized web application runs on a peer to peer network of computers. You might want to think of a dApp as having no central server which runs on multiple computers and is not controlled by a single person or company. Similarly, In centralized software systems, the components are located around and connected with one central component. In contrast, the components of distributed systems form a network of connected components without having any central element of coordination or control. This is illustrated in the image below;
On the left-hand side in the image above, a distributed architecture is illustrated where components are connected with one another without having a central element. It is important to see that none of the components is directly connected with all other components. However, all components are connected with one another at least indirectly. The right-hand side illustrates a centralized architecture where each component is connected to one central component. The components are not connected with one another directly. They only have one direct connection to the central component.
Smart contracts are simply computer programs that execute autonomously. It eliminates the need for a middleman, it is simply a self executing contract which contains terms and conditions of agreement between parties, these terms and conditions are represented in code.
When a smart contract is stored and executed on a blockchain, it inherits the tamper-proof and tamper-evident properties that are vital for parties interacting with it to have confidence in them.
A real world example of the use of smart contracts is in Supply Chain and Tracking, as a distributor you can use smart contracts to sell and distribute your products all over the world. The code behind the smart contract can track the location of your products, so you can trace them as they change hands throughout the supply chain. Many aspects of the supply chain can be replaced by a smart contract, making the entire system more efficient and more fraud resistant.
One common way of integrating a web browser application with RSK is to use the Metamask or Nifty browser extension in combination with Web3.js. Metamask is an in-browser Ethereum wallet that injects a Web3 provider object into the browser. A Web3 provider is a data-structure providing a link to publicly accessible RSK nodes. Using Metamask allows users to manage private keys and sign transactions within their web browser. Using these browser extensions in combination with Web3.js, in a web interface, makes for a convenient way to interact with the RSK network.
This image above illustrates how a web application using web3.js library connects to the RSK Node through a JSON RPC Client.
The image above illustrates the architecture of a dApp. dApps are decentralized applications that runs on a peer-to-peer network of computers unlike traditional web apps that runs on centralized servers as shown in the image above. When these dapps are built over the RSK network, they are known as “RSK dApps”. In decentralized apps, all the users’ data is stored on immutable distributed ledger (Blockchain) and every participating node has a copy of that ledger.
The logic for the dApps are stored on the blockchain as bytecode, and this logic may be executed when transactions are executed on the blockchain. A developer does not usually write byte code directly, and instead writes in a high level language, most commonly used is the Solidity Language, which is traditionally called Smart Contracts.
There are many dApps deployed on RSK, see them on Use Cases.
Kudos for getting this far!
Next: Let’s get started building a complete decentralised application on RSK in The Complete Full Stack dApp Guide on RSK Part 2: Smart Contract
Go to top