Web 3.0 for mortals: An honest look at the next generation of the web
Tags: javascript, webdev, programming, blockchain
Published: 2021-09-26 23:59:07

![Cover](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bkca0azk664hmy1aeggj.png)
### Introduction
Lately has emerged a lot of information and hype about Web 3.0 even though it is claimed as the future of the web I missed an honest take. Information about how to get your hands on, what useful products are made with it, the real benefits, the cons. I was looking for this rather than someone selling me the idea.

That's why in this article, we'll take an honest look at the next generation of the web:

- A conceptual explanation
- Examples of Web 3.0 apps
- How the code looks like.
- How to get started.
- The cons

## The concept "Web 3.0"

Before telling what web3.0 is about let's explain a little bit what were the previous generations were about. It can be summed up like this:
- In the original web A.K.A  **Web 1.0** the information flowed in one direction and was static, it was from the sites to the users.
- **Web 2.0**: Information started to be bidirectional, users interact with web apps feeding them with data (uploading photos, creating content, sharing, etc). Its pick was social apps, video/streaming apps as we know today.  
- **Web 3.0** Aims to be a more semantic, intelligent, and decentralized web where Artificial Intelligence, Blockchain, crypto play the main role in web development.

Notice how each generation is built upon the necessity created by the previous one, In this case, the current Web 2.0 where our data is practically owned by big companies, that can censor us, and used it to whatever thing they put in their terms and conditions made the data centralized. The main task of the **decentralized** aspect that web3.0 introduces is privacy, security and brings ownership to the users; and here is where blockchain comes in.

## What is Blockchain?
Basically, Blockchain is a way to store information where data is grouped together, secured by a crypto signature, and immutable, once created can't be changed instead a new block is created with the new information, which is known as a block. Every block saves a reference of the previous block as well as the next one if exists, the information is chained together in chronological order.

But in addition, Blockchain is responsible for keeping this information in the main ledger that will work as a source of truth and can be read by anyone. This is replicated in multiple computers known as nodes that also have the role of adding new blocks to the chain and share with the network in order to be validated and finally added in the main ledger.

## Ethereum
There are many implementations of blockchain but here I am going to cover **The Ethereum Blockchain** that not only saves transactions and state data but also serves as a platform to run programs called **Smart Contracts** (we'll talk a little more about them below) this is the difference between Ethereum blockchain and others like Bitcoin Blockchain (not the cryptocurrency).

>Ethereum is a technology that lets you send cryptocurrency to anyone for a small fee. It also powers applications that everyone can use and no one can take down.

>It's the world's programmable blockchain

Ethereum works like a big computer, that uses the resources of its nodes as one and every node in the network is running a system called The Ethereum Virtual Machine(EVM) this is the one that allows us to run programs on the Blockchain. 

## Talk is cheap, show me the code

Now that we are familiar with the concept let's see what a blockchain developer does and how the programs look like. 

The resulting program for the Ethereum Blockchain is known as Smart Contract. There are high-level languages that compile the code to EVM language, **Solidity** is the most popular and has some similarities with javascript but there are others like Serpent and  LLL (Lisp Like Language).

This is how a hello world would look like in Solidity:

```solidity
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;

contract Greeter {
    string private greeting = "Hello world";

    function greet() public view returns (string memory) {
        return greeting;
    }
}
```
The first line is an instruction for the compiler setting the version of Solidity due to breaking changes of the latest versions with the previous ones, It is a strongly typed language. Here is a variable definition and how a function is defined. Don't worry I'll let you sources to learn more about it here I just wanted to show how the code looks like to give you an idea.

Smart Contracts will behave as our backend and can be connected to a frontend to create a Decentralized App (Dapp) 

### Live Examples
The most common examples fall into categories like finance, games and marketplace. Some of the Dapps that standout are:  

- **[Brave Browser](https://brave.com/)**: Brave made a reimplementation of how ads work in browsers offering tokens to users to see ads and selecting the frequency they want to see them. Those tokens can be used to support content creators and exchange for future services.
- **[Open Sea](https://opensea.io/?ref=0xcd2b3c517d3de4f962dc01700dc57960cdbeb5e9&utm_source=DappRadar&utm_medium=deeplink&utm_campaign=visit-website)**: Digital Art Market Place where web artists can sell digital resources (image, video, audio, or 3D art)
- **[Gitcoin](https://gitcoin.co/)**: That allows users to earn money building open-source public projects.

### How to get started

There's a gamified tutorial that can serve as a practical introduction with the Solidity language and dapps called [cryptozombies](https://cryptozombies.io/)

After grasp some of the main concepts of Solidity you can go and install [hardhat](https://hardhat.org/getting-started/) to create your own contracts and test, deploy in your own local development environment 

Connect the smart contract with a frontend (can be your framework of choice) [ether.js](https://docs.ethers.io/v5/getting-started/) is a lightweight, ESM ready package to interact with smart contracts in javascript.

## Blockchain challenges.

It isn't all roses in blockchain, every new block created requires a strong amount of computation to solves a **Proof of work** the first node to solve that problem ends up adding the new block to the blockchain and emit the change to all other nodes.

How Ethereum incentives nodes to spend those resources in solving the proof of work fast, and how to prevent developers and its smart contracts from consuming all resources with an accidental infinite loop for example. The answer was paying.

The first to solve a proof of work receives a payment from the network, and every transaction requires payment so if an infinite loop consuming resources is introduced in a small contract it will stop when it has nothing to pay. The fee payments are in **Ether(ETH)** the cryptocurrency of Ethereum.


**Cons**
- It is expensive to develop apps in the blockchain because of the cost associated with every transaction
- Computation requires a lot of energy currently
- Transactions are slow compared with web 2.0
- The extra steps, software, and education can be a barrier for new developers and by extension the main adoption

## Conclusion.
The main concerns of web 3.0 are interesting and a big contrast of how we see and apply the web today

It opens a lot of possibilities and I am willing to see how it evolves in the near future and how it creates conditions to make development more affordable to expand the vision of a more secure, decentralized and private web. 

Thanks for reading. I hope the article helps to bring some clarity on the topic if you have any questions the comments are open, or if you like [Twitter](https://twitter.com/JesusntGuerrero) as well as my [Github](https://github.com/jesusantguerrero) where I do some experiments and projects.

Have a good day.

## Resouces
- [DappRadar](https://dappradar.com/) WebApp that list Descentralized apps
- [Ethereum Developer Docs](https://ethereum.org/en/developers/docs/) Official documentation describing every concept of Ethereum network
- [Cryptozombies](https://cryptozombies.io/) Practical introduction to Solidity in form of gamified tutorial. 
- [Oliver's thread on become a Web 3.0 developer](https://twitter.com/oliverjumpertz/status/1396394220299169793) Thread with resources (Courses, tools) with what a developer need to become a Web 3.0 developer
- [Vitto's thread on web3.0](https://twitter.com/VittoStack/status/1439980837899055108) Useful thread with information and resources to understand and apply web3.0
- [Web 2 vs Web 3](https://ethereum.org/en/developers/docs/web2-vs-web3/)