Blockchain in a nutshell

TLDR; Blockchain is a database!

In this post, you’ll understand blockchain based on the comparison a traditional web application and a blockchain application. Moreover, you’ll learn about Smart Contracts and Distributed Applications (DApps) as a bonus!

A Traditional Web Application

A web application architecture diagram

Normally, whenever you access a web application, you use a web browser for connecting to a web server over the internet so you can access all the codes and all the data from this web server. So like this, you basically connect from your web browser to the server. The server contains all the client-side files like HTML, CSS and JavaScript and also all of the back-end codes and the business logic you might write or get any data that’s stored in a database.

Now, I have a million dollar question: How would you build an application on top of blockchain instead using a web back-end database?

A Blockchain Application

A blockchain application architecture diagram

So, how would you build an application on a blockchain?: Well, it would work a little bit differently. Instead of connecting directly to a server, you’ll access the client side application via a browser. However, this client-side application won’t talk to a web back-end in a database, instead it’s gonna actually talk directly to the blockchain. And, on the blockchain, you’ll have code that’s written with Etherium smart contracts that will contain all of the business logic for your application. Moreover, all the items are gonna be stored on the blockchain itself and that’s fundamentally how a blockchain application would work and how it’s different from a traditional web application.

So that might bring up a lot of questions like “well, how do you connect a blockchain?” and “how does the blockchain work?”..

Apps vs DApps

What is blockchain?

Your client-side application is actually talking to a blockchain which is a peer-to-peer network of nodes that all talk to one another. It's a distributed network so there are actually different computers or machines that talk to another.

You can connect to an individual node on the blockchain in order to use it and that’s what your web applications doing here. All of the nodes on the network participate in running the network and they all contain a copy of the code on the blockchain. All of the data on the blockchain is contained in bundles of records called blocks which are chained together to make up the blockchain.

The public ledger is secure and unchangeable and that’s what makes blockchain so powerful!

Blockchain explained

What is smart contract?

What about the code on the blockchain? Well, all the blockchain is contained in smart contracts which are basically just programs that run on the blockchain. Smart contracts are written in a programming language called solidity. The smart contract is immutable which that means it’s unchangeable so whenever you deployed to the blockchain you won’t be able to update that code and that’s important understand that’s what makes the blockchain so secure!

I actually think about smart contracts kind of like micro services on the web. They’re on the blockchain and they read and write data from the blockchain. They do stuff with it, and they execute business logic.

Smart contracts explained

What is Distributed Application (DApp)?

Distributed Applications (DApps) are software applications that are stored and executed mostly on cloud computing platforms and that run on multiple systems simultaneously. In contrast, a traditional app utilizes one dedicated system to achieve an assigned task.

A decentralized application (DApp) is an application built on a decentralized network that combines a smart contract and a front-end user interface.

Traditional Apps vs DApps

Summary

So, how would you build an application on a blockchain?: You’re gonna connect to the application with a web browser. You’re gonna build a client-side application in HTML CSS and JavaScript and that client-side application is going to talk directly to the blockchain that’s you’re gonna put your smart contract.

In this post, you learned blockchain, smart contract and decentralized applications! Now, you know what blockchain means! YAY!

I am a big fan of Real Madric CF and I love computer science!