Ethereum Protocol

Ethereum Protocol

·

16 min read

Ethereum allows us to build a new bread of applications called Decentralized Applications (DApps). just as regular applications, they run on multiple machines. But what differs them is that these machines are not owned by a single group or organization. They are owned by different people in different organizations, and anybody accross the world can provide computional resource for the network. No single actor controls the whole application or the whole network. And having this network allows us to build applications on top of it.

Introduction

Why Decentralized Applications?

There are multiple reasons to build Decentralized application some of them are :-

  1. Reliable :- Decentralized applications are more reliable there is no single point of failure, and they will continue to run even if some machines will go down.

  2. Secure :- Code and data are cryptographically secured, and nobody can amend them.

  3. Transparent :- Any participant can verify that everyone is playing by the rules and not, for example, try to change the data that should not be changed.

All of these properties create a sort of a trust layer. They create more trust in applications and more trust in users that are using them.

Why Learn Ethereum ??

  1. Allows to create decentralized applications

  2. Multi-billion-dollar industry new player enter the field literally every day.

  3. Big developers' community Ethereum has a huge community that is improving platform constantly.

  4. Ethereum is one of the most in-demand skills.

Ehthreum Applications

  1. Voting :- Online voting, which would allow us to ensure that nobody has the result of the voting.

  2. Legal Agreements :- Self-executing legal agreements that do not require lawers, and anybody can verify that a legal agreement was executed as it was specified.

  3. DeFi :- A very popular set of applications is called DeFi, or decentralized finance, Which is a set of financial applications on top of Ethereum.

  4. Digital Ownership :- We can create a provable record of who owns what, and nobody can maliciously amend those records.

Ethereum Platform

  • At the bottom of Ethereum is an Ethereum network. It has application code and data used by these applications.

  • The next layer is called Web3 API, or application programming interface. It allows to prgrammatically interact with Ethereum.

  • Then using Web3, we can build client applications and server-side applications that interact with Ethereum.

Blockchain in Brief

Before moving further in ethereum we should know about blockchian because Blockchain is foundational technology for ethereum.

History of Blockchain

  • 2008 :- The History of blockchain started in 2008 when an anonymous person named Satoshi Nakamoto published a Bitcoin whitepaper. Up until this date nobody knows who Sathoshi Nakamoto was. But this paper that he wrote described how to build a decentralized currency. This was a major breakthrough in cryptography. It was the first working approach for how to build a digital currency that has no master of central nodes. This paper also described blockchain technology.

  • 2009 :- Following the whitepaper in 2009, Bitcoin was launched, and it became the first decentralised currency in the world. The development of bitcoin ignited the cryptocurrency space.

  • 2011 :- In 2011 there were already more cryptocurrency projects. Some of them were just clones of Bitcoin, but some of them were more specialised projects.

  • 2014 :- Slowly but steadly, Bitcoin was gaining more and more adoption. and in 2014, more businesses and users started adapting Bitcoin.

Centralised Financial Institution

Before discussing Bitcoin let's discuss an alternative to bitcoin like a Bank.

Now if you want to send money, you can't do it directly. you need to rely on a centralised Financial institution, like a bank. The bank in turn, is responsible for tracking financial transactions and balances for it's users and provides services like payments.

Issue with Banking System

Why would satoshi nakamoto want to design an alternative? Well, there can be few reasons.

  • Requires Total trust :- Banking system requires a total trust, which may not be an issue in developed countries, but can be quite an issue in developing countries.

  • Slow Transactions :- Transactions in a banking system are quite slow and may take sometimes days to process, especially if this is an international transfer.

  • High Fees :- Banking system has quite high fees.

Financial System with Bitcoin

Bitcoin is just a network of machines, and this network stores a registry of assets. It stores who owns what amount of bitcoin. But there is no need to trust any individual, actor or entity in this network. None of these actors control the whole network. We can instead trust the algorithm that is underpinning the network. Using this Bitcoin network, users can send payments to each other using Bitcoin as the currency.

Bitcoin Cryptocurrency

Characteristics of Bitcoin

  • Bitcoin is Public registry of assets and transactions. Everybody can see what transactions took place and what is the balance of each account.

  • The Bitcoin network is Autonomous and it is controlled by Software and not by people. So even if there is somebody with malicious intent, they cannot compromise the network.

  • Bitcoin is permission-less and anybody can join the network either to use it for payments or to provide more computational resources for the network.

  • And now the last not least Bitcoin is cryptographically secure. Nobody can change the history of transactions, take their bitcoins, amend the transactions etc.

Blockchain

Blockchain is the technology that underpins Bitcoin. As the name suggests, a blockchain is just a chain of blocks Every block has a list of transactions that took place, and they are grouped into a block. A Block also has a pointer to a previous block that happened before it. If we follow this chain of blocks, We'll eventually get to the very first block that is called the genesis block. If we reverse this chain in opposite direction we will be able to see what were the balances for each account at any point in time.

Who generates these blocks ?

There is no central node in the system that generates those blocks. Instead, Bitcoin is peer to peer network. Everybody is equal in Bitcoin. Every node is connected to a subset of nodes and if somebody wants to send a transaction, they would just broadcast it to the network through its peers. Those peers would validate incoming transactions, check that a sender has Bitcoins they want to send, and they broadcast it further to their peers. Later at some point, a block is generated in the network. It is not generated by a single machine. Instead, there is a process that temporarily elects the leader. And this leader generates a new block, and it stores it in it's own storage and then broadcast it to it's peers until the block is broadcasted to all other peers. And every peers will validate that the block is correct. And only if they confirm that the block is correct, They store it locally to their storage, and it becomes the part of their state.

Hash Function

Let's talk about how blockchain achieve it's properties such as immutability.

At the core of it it's a concept of a hash function. A hash function is just an algorithm that can take input of any length, and as a result, it generates a very long number.

There are multiple types of hash functions, but all of them have the same properties. One property is that for the same input, a hash function will always generate the same output. If we change the input just slightly, a hash function will generate a completely different output. It will have the same length but completely different value.

It's important to understand that the output value of a hash function is not encrypted data. we can compute hash value using a hash function, but it is impossible to go the other way around and get input if we have just the output.

Properties of hash function

  1. Fast to compute :- Hash functions are very fast.

  2. Fixed (Small) size :- An output of a hash function is very small in size. Depending on the hash function, it is usually between 20 and 64 bytes.

  3. Virtually impossible to find a duplicate :- It is impossible to find two inputs that would result the same value.

  4. Digital fingerprint :- All these property together, they allow to use hash functions to compute digital fingerprints. For example, if you have a file and you want to know if it has been changed, you can just compute it's hash value and if it's the one that you expected, it means that the file has not been changed, and if -t's different it means that somebody has changed it and you have a different hash value.

How blockchain uses hash function ?

In blockchain Each block contains a hash value of the previous block, and this is how blockchain maintains links between the blocks. if someone tries to amend a block and , say, change the transaction, then that block gets a different hash and this is why it is completely impossible to secretly change passed transaction or change blockchain data.

Ethereum Overview

Let's look at the history of blockchain applications. At some point, blockchain technology became very popular, but the problem is that every project was built on it's own slightly different blockchain implementation.

One Blockchain per Application

For example, Bitcoin was useful for payments, and it had it's own blockchain implementation. Other projects like Namecoin for example that was based on blockchain to implement decentralized domain name system. again, it has it's own blockchain implementation. Another project called Nxt for implementing financial services, again had it's own blockchain as well.

And the main problem here is that the entry barrier for new applications was just too high. It was very difficult to develop your own blockchain for a new application, And this is where Ethereum came up.

Ethereum aims to create a single blockchain that will allow to develop application on top of it. So instead of specialising for a particular application, it would be a platform for developing any applications on blockchain.

Pager - Wikipedia

So, a way to think about it is those initial blockchain applications, they were like old-school pagers. It has one predefined function, and this function is built into it.

The BEST Smartphone of 2020 🏆 - YouTube

Ethereum now is like a smartphone. instead of having one application or set of applications, It is a platform that allows developers to build applications on top of it.

History of Ethereum

  • 2013 :- Ethereum was designed in 2013 It was designed by Vitalik Buterin. And this is his real name, He is not an anonymous person.

  • 2014 :- Ethereum Development started in 2014.

  • 2015 :- There was the first release of ethereum network. Every major release of Ethereum has a code name. and this release was named Olympic.

  • 2020 :- Ethereum was slowly gaining adoption for the next five years until 2020, There was a so-called "DeFi Summer" a boom in activity in decentralized financial obligations.

  • 2022 :- And in 2022, the community has finished the Merge project, an upgrade of the execution layer of Ethereum that made it faster and more efficient.

Ethereum

  • has it's own Currency :- Just like Bitcoin, Ethereum has it's own currency. In case of ethereum it's called Ether or Eth. Just as bitcoin it supports financial transactions. But unlike bitcoin We can use Ethereum currency to pay for computations on ethereum network.

  • Turing complete :- Ethereum is what is known as Turing-complete, Which is a sophisticated term to say that you can just develop general-purpose applications on top of Ethereum. And the way to think about it is that Ethereum is like a cloud provider, You can upload your application to an ethereum network, bbut you have to pay with Ether and not with dollars or rupees or euros to run your applications on top of Ethereum.

Ethereum in Nutshell

In Ethereum, there are two types of participants.

  1. The first one is called an externally-owned account. Externally owned account is controlled by a person, It has a unique address and an Ethereum balance, and this account can send Ether to other accounts, So similar to what we can do with Bitcoin.

  2. Another type of participant is called a smart contract. And smart contracts, they are not controlled by people, but they are controlled by code deployed on a Ethereum. Just like externally-owned accounts, contracts have unique addresses and Ethereum balance that they control. But they also have data associated with them, Which is called state, and they have methods that other participants can call. When a method is called, it can change a state of a smart contract, Send Ether, or interact with other contracts.

Ethereum Projects

Now Ethereum has been around for quite sometime, and it has some interesting projects, so let's briefly mention some of them.

  1. Augur :- It is a predection market where people can bet on outcomes of real-life events.

  2. OpenSea :- This is a marketplace for digital collectables, Which is an interesting concept when something can be digital, and at the same time it can be unique collectable item.

  3. Uniswap :- This is a decentralized exchange for trading cryptocurrencies.

  4. Compound :- It is fully-decentralized platform for lending and borrowing.

Web3

You may find this term "Web3" when you read about ethereum. The Idea of Web3 is that Ethereum and similar platforms are an evaluation of the internet like we had web1, Where we just had static web pages, And now we are using Web2 that consists of dynamic web applications.

Web3 doesn't have a specific definition, but what people usually mean when they refer to web3 is that they refer to an internet based on smart contracts, native payment built within these applications, and digital ownership of items on the network.

The hype around Web3 and how it can transform the internet | World Economic  Forum

Ethereum Wallets

To Interact with an Ethereum network, We need to use special piece of software called a wallet. Despite it's name, the wallet doesn't store any money or ether, So the name is quite misleading.

A wallet stores cryptographic keys that are used to sign payments or transactions that you are sending to the network. So a better name could be a key store, but the wallet is what everybody uses.

There is no single wallet implementation for ethereum; instead, there are dozens of different wallets, each one with it's own focus. and they are also developed for different platforms.

There are Command line wallets, Desktop applications, there are wallets that are run in a browser, and there are mobile applications.

Bank account v/s Ethereum acconts

Bank Accounts

  • Bank accounts are issued by a bank, so there is an institution that creates an account for you.

  • The Bank account is mostly used for payments.

  • Bank account can be restored by a bank, for example, if you forgot your password to your bank account, a bank can still help you to restore your password.

  • Bank account is controlled by bank and bank can block it or suspend it, etc.

Ethereum Accounts

  • Ethereum accounts are created by a user themselves, and it can be created by any user at any time and any user can have as many accounts as they want.

  • Ethereum accounts can be used for payments, but it can also be used to access ethereum applications.

  • An ethereum account, on the other hand cannot be restored if the access is lost, so with Ethereum you are responsible for keeping it safe.

  • Ethereum account cannot be blocked or deleted

How Ethereum Wallet Works?

A wallet is connected to several Ethereum nodes, and a node is pretty much just a computer running Ethereum software. At some point, once a block is generated somewhere in the network, it is being propagated to other nodes, and very soon it will reach your wallet.

A wallet checks if there are any transactions related to accounts that it tracks, and if there are any such transactions, it updates the state of the account in it's local storage.

Note that a wallet doesn't store any funds, it just reflects the state of the network, and the state of the network is stored on individual nodes.

Signing Transactions

Now we know how wallets are processing payments, but the more interesting thing to learn is how a wallet creates those payments, and to do it, we need to talk about the keys that a wallet is storing.

When you create an account in wallet, a wallet creates a so-called private key, and this is just an long number. A private key is used to digitally sign transaction that you send from a wallet, and it should be private. Whoever has access to the private key will be able to sign the transactions and control your account.

Now from a private key, a wallet creates a public key and an address. A public key is as the name suggests, it's public, and it can be used by anybody to verify that the sender of a payment controls a particular account.

Now if a wallet needs to send a transaction, it first of all creates this transaction, then it cryptographically signs it using the private key, and then it sends a payment and a signature to the network, and then any participant on the network can look at the signature and verify that the payment was sent by the account owner. So anybody else in the network can verify that the payment is valid, but they cannot send payments using your account.

Keep your private key secret and safe

How to get Ether

You can purchase Ether in exchange of other currency like Dollar, rupee, Euro, etc. You can do it on one of the various crypto exchanges, There is even a guide on official Ethereum website that walks through how to do this. https://ethereum.org/en/get-eth/

Ethereum (ETH) Logo .SVG and .PNG Files Download

Another way is to provide an Ethereum infrastructure previously before the upgrade in 2022 you could do this through a process called mining, but after the merge you can now get the Ether by a different process called staking.

For development purpose you can use an Ethereum test network which works just like a regular Ethereum network, but ethereum on it is free.

Test Networks

There are multiple ethereum test network but the most popular test network at the moment is Sepolia and Holesky. There is a goerli test network as this date (16-03-2024) but it is going to fully deprecate in April 2024.

We can also create our own test network and to do this all you need to do is to run Ethereum Software on multiple machines and connect them together

Faucet

To get test ether, we need to use a special service called a faucet, and all we need to do is to send the request to a faucet, and we will get some test ether for free. This faucet only works for test network

Note that test networks are completely isolated from that main ethereum network. They have different history, different transactions, different blocks, everything is different. You can have the same account on both networks but they will have different account balances. So if you get some test ether it won't be reflected on the main network.

Metamask

MetaMask is a software cryptocurrency wallet used to interact with the Ethereum blockchain. It allows users to access their Ethereum wallet through a browser extension or mobile app, which can then be used to interact with decentralized applications

MetaMask - Wikipedia

Metamask is a browser wallet you can use this wallet to send and receive ether.

Sepolia Testnet Faucet

There are some faucet available publicly where you can request for funds in you metamask created account. Some of the faucets are :-

  1. Alchemy :-https://www.alchemy.com/faucets/ethereum-sepolia

  2. Infura :-https://www.infura.io/faucet/sepolia

  3. POW Faucet :-https://sepolia-faucet.pk910.de/

    This POW faucet requires computational resources of you local machine (Laptop/Desktop)

Stake Eth

You can stake by building Infrastructure and and setup a Ethereum staking node by using their official documentation you can setup the node. But let me remind you that setting up the infrastructure, maintaining them and running them 24*7 is very costly as well as very tricky to setup.

Zeeve | Blockchain Deployment and Management Platform

To overcome this problem zeeve a web3 infrastructure based company provides helps you to setup and maintain these nodes easily. You can checkout zeeve here zeeve.io

Well that's it for today we can end this blog right here. more on ethereum is coming on my next blog. We are going to learn so much about it this is just a basic start.
In next blog We will get started with smart contracts.

Till then bye bye.

Keep Learning. Keep Improving.

Did you find this article valuable?

Support Gautam Jha by becoming a sponsor. Any amount is appreciated!