Web3 series( Part 1) : Intro to Web3 & Block chain
Tags: web3
Published: 2022-06-16 16:00:26

What is Web3?
First lets know what is Web1?

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/27c8gxndiz7ca0kkplt7.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iio2gcefytg8bm81t0tm.png)
You could not change anything of the page.

Web2.0

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gyok8hhgz9ogipknt6f4.png)

In ![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/95t3m20f9wthy03jdmzn.png)
web2.0, the admin could control the page and at the same time you had the opportunity to interact with the admin .

Now, Web3.0

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dt9io9126i6ioebbm07d.png)
Using the Blockchain, apps can now share their databases and background.

So, to sum up

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/50dhb22qirohye1awojg.png)
Block chain offers a decentralized way to share element and you can also exchange value. It was not possible before. You can exchange information and also monetary values.  


First you had a computer and once the internet came, now you have apps, snapchats and so on. Now Web3 came and it is predicted that, things will change very fast because of this..........

Why is it so famous?
Because it is Open System & Composable.

**What is this Open System mean, right?**

Assume that you want to build an app which will have your location and all of your friends. You can easily know at any time where the person is . But do you have the data? Do you know where the person lives? or where he is right now?

May be not. But Facebook, LinkedIn has those. But they won't provide the data to you. This is called Closed system. Closed system is good for a company but not for developers or new innovations.

**Composable** means that you can build apps over another one. Currently you might not be able to use Facebook's data to build something but in Web3, things will be open sourced and you can build an app over another and another person will build one over you.


**What is Block Chain**


You may say
Blockchain - the technology that powers Web3 and Cryptocurrencies
You can think blockchain literally like chain of ordered blocks point to each other. 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5du8b3mjeu7hfka4fepv.png)

What this blocks contain?
The actually contains transactions. 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lvbqzxovcv1sntse7jq5.png)
Some terminologies:
**Block** - think of it as a hard drive that contains data that can be added on, but never delete from. Like a company ledger or an accounting ledger.

**Blockchain** - a group of blocks that adds on top of each other, like a continuation of the last block. Think of it as a group of hard drives that extends the last block 

By the way , you have heard of Decentralized, right?
What is this? Actually block chain runs on Nodes. These can be thousands and millions of nodes across the globe. These nodes can communicate with each other. 

The amazing fact is that, anyone can take part in this network and nodes. And this makes Block chain decentralized. That means that anyone can contribute or use . Open for all. There is no part which is kept Hidden. Literally anyone can come and use this software and data and these makes it De centralized. 


All this things are maintained by the Consensus Algorithm. 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v1tiyvj5mlmkfftoxtjk.png)
 
We are going to focus on **Proof of Work** . Thats what Ethereum focuses on to manage these networks and transactions. 

You can know more about Ethereum coins [here](https://g.co/kgs/u89sYB)

Let's now know what is Proof of Work
Work basically means the computing resources. 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/icbuwd6apcnuqcu9ytcp.png)

So, in servers there is literally CPU running, what are they doing? they are basically running something right?
In Blockchain world, we call these miners who solves problems to get a block cash


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/70nwqnhrx8bv7jmfiosz.png)
They use Brute force to get the correct match in order to find block hash. 

**So, what is this block hash?**
Basically block chain has chains of blocks and each has unique hash associated with it. In order to find the next hash, you need to know all the previous hashes. 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/02q3ylw5wav2dnx0hst2.png)

So, the miners just try to find the hashes by Brute force and guessing and checking. 


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wqxfybev34vg998witke.png)
This is what time it takes for Ethereum & Bitcoin to solve a math problem to find a hash or block hash. That's how the coin makers designed the system.   

Once a miner gets the right hash, it broadcast it to other miners and they verify it in the least of time. 

Now the question is


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ohe6um0ku3cq5mckltyz.png)

Talking about the Ethereum coin, 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5pybq3zmlnjl4mlv4hat.png)
It can not be created in any other way. 

So, now let's know what happens in a transaction.
Remember, we told blocks contain transactions , Right? Now assume Elan is trying to send 1 Ethereum to Albert

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l090ela6idly79ok9369.png)
 


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/abskdatk4im3wc0xye4w.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/236olexrkzq4w603fehu.png)

How to send that? Basically Elan sends her transactions to a Transaction pool     


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cjdjwzbes83n6vcsauvr.png)

It then gets distributed into the network within the pool

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r5fde0vox8djb65hy5lo.png)

While sending a transaction, you are sending your personal sign which can only be signed with your private keys. No one else can send your transactions because they won't have your private keys. nce it is signed, it's within a package and with something called gas. We will know about gas later . For now, just assume this gas carries some fees.


So, the transaction has your signed transaction+ some fees(gas) + miner tips. And this gets sent to everyone's transactions. 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zt5xx97k96n116m0rb42.png)

So, everyone's transactions now get into the same pool. 

Now miners go and search for transactions and decide which one they one to include in their blocks.

[Note: Blocks carry transactions I told you earlier]

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9c9y66aw7mgljybbob3s.png)

The choose a transactions based on the highest miner tip

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jexnfytxpaptsmi9et2h.png)
Therefore miner tips become important here cause they gave the most priority to a transactions fee . 
Now, lets understand it from a  real transaction

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nbedmbrrx8bm3k43bocf.png)
you can see the value & transaction fee here.   

Transaction fee= Miner tip + Cost of your transaction. This is what Miner tip is: 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fihw4p64dpelqv16dgxa.png)

but what about transaction fees?
In the case of transaction, you actually need computing resource .Transaction from A to B actually have some cost to ship. This cost is measure in the term called gas. Ahha!

Happy now? Let's  know about it. 

So, when you drive a car, you need gas to go from place A to B, right? This is what gas means in blockchain. Some fees to ship.
This prevents from hackers. Want to know how? 
If a hacker hacks and then try to run an infinite loop of transaction, he will need to add infinite fees (gas) with these transactions. Obviously thus he won't do it. 

Now, you may have a question that **how to know your transaction fee , right?
**
Firstly ,it basically depends on the complexity of transaction.
Transaction  from San Fransisco to LA
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/atbnum8krckxgwebdz17.png) 
will cost less than one from San Francisco to New York

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ud2s24oddw42478emlzq.png)
 
Secondly, it also depends on the price of gas
There are certain price associated with gas itself . Depending on the increasing/decreasing rate of it , transaction fee increases or decreases. 

thirdly, it depends on the network congestion. 
For example, you want Uber at Eid Day , and it will cost much higher if you would call it on some normal day. Right? So, that's it.

Now, when a transaction is picked within a block by a minder, it is sent and minder het minding tips but the gas is destroyed along with the ether.

So, for a coin like Ethereum, you can see that this can only be created when you mind blocks and than block transfer transactions. Also, it gets destroyed only when a transaction is done.


Let's know some other currency called **FIAT Currency**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tyv5qzzyc72yxh1ip1z8.png)

This transaction is backed by the government. example: US Dollar, Taka etc. 
These money is locked in banks and they don't let other know about your transactions, right? this is completely opposite of transactions in blockchain. In blockchain, you share your transaction to everyone in the node or network and miner finds it and takes it within a block to create an coin (Ethereum/bitcoin etc).

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6bnn97rub3mjl8rvjtkz.png)

this is the Ethereum transaction diagram looks like. Publicly available on public ledgers .

But for FIAT transactions:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j2laqiima1uesu7cri9q.png)

**Security aspects of Block chain**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dmz93whj2ewe6v8ndcmy.png)
 
Because of these aspects , hackers can not hack though Block chain