0% found this document useful (0 votes)
24 views58 pages

Unit1 SCSA1615 SmartContract Final

This document provides an overview of Ethereum, highlighting its features, benefits, and real-world applications, as well as comparing it with Bitcoin. Ethereum is a decentralized platform that enables the creation of smart contracts and decentralized applications (dApps) using its cryptocurrency, Ether (ETH). The document also discusses the differences between Bitcoin and Ethereum, including their consensus mechanisms, transaction speeds, and programming languages used for smart contracts.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views58 pages

Unit1 SCSA1615 SmartContract Final

This document provides an overview of Ethereum, highlighting its features, benefits, and real-world applications, as well as comparing it with Bitcoin. Ethereum is a decentralized platform that enables the creation of smart contracts and decentralized applications (dApps) using its cryptocurrency, Ether (ETH). The document also discusses the differences between Bitcoin and Ethereum, including their consensus mechanisms, transaction speeds, and programming languages used for smart contracts.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 58

III YEAR - SEMESTER VI

B.E-CSE (BLOCKCHAIN TECHNOLOGY)


SCSA1615- SMART CONTRACT
UNIT I INTRODUCTION
Unit I- Introduction: Ethereum, Ethereum Vs Bitcoin, Ethereum Clients, Account
Management, Ether, The Ethereum Network, Mining, History of Ethereum, Community, The
Ethereum Foundation, Smart Contracts, DApps and DAOs, Quick Start Overview of Remix
using JavaScript VM.
1.1 INTRODUCTION TO ETHEREUM
 Blockchain technology gained public notice with the advent of bitcoin in 2009.
 Bitcoin is a cryptocurrency that runs on blockchain technology and is by far, the most
popular and most ranked cryptocurrency.
 Ethereum was initially released in 2015. Within two years of its release, it was ranked
the second best blockchain network, Bitcoin is the first.
 The Ethereum network acquired more global interest when china stated that it is the
best blockchain network ever created.
 The source code of Bitcoin and Ethereum blockchains is open source anyone can access
it in the links. This allows anyone to contribute to it, such transparency is key for
participants to trust the network.

What is Ethereum?
Ethereum is a blockchain-based distributed platform. The network currency of Ethereum is
known as Ether (ETH). Here also, the transactions are stored in an immutable distributed
ledger. Ethereum is a Blockchain network that introduced a built-in Turing-complete
programming language that can be used for creating various decentralized applications (also
called Dapps).
Ethereum is a modular and programmable blockchain that handles applications without relying
on a centralised counterparty. The platform is built on the public, open-source, decentralised
and cryptographic blockchain technology. It powers decentralized applications (dApps) that
are supported by smart contracts. With its collective computing power on the distributed
network (the Ethereum Virtual Machine), Ethereum executes peer-to-peer transactions to
realise automatic, conditional transfer of value and information, including money, voting
rights, and property.
 Ethereum is designed to be scalable, decentralized, and programmable.
 It provides a flexible platform to build applications using the solidity scripting
language.
 Transactions are sent and received in user created Ethereum accounts.
 It is a blockchain-based platform with the cryptocurrency Ether (ETH).
 The Ethereum network is currently famous for allowing the implementation of smart
contracts. Smart contracts can be thought of as ‘cryptographic bank lockers’ which
contain certain values.
 These cryptographic lockers can only be unlocked when certain conditions are met.
 Unlike bitcoin, Ethereum is a network that can be applied to various other sectors.

1
 Ethereum is often called Blockchain 2.0 since it proved the potential of blockchain
technology beyond the financial sector.

Fig.1.1. Representation of Ethereum


 The consensus mechanism used in Ethereum is Proof of Stakes(PoS), which is more
energy efficient when compared to that used in the Bitcoin network, that is, Proof of
Work(PoW). PoS depends on the amount of stake a node holds.

 Ethereum can be compared to a ‘world computer’ on a blockchain where the underlying


blockchain technology is the virtual machine’s hard drive, smart contracts are
programs, validators2 are central processing units (CPUs), and users pay with ETH to
use this ‘computer’

Fig. 1.2. Ethereum Blockchain

2
How Does Ethereum Work?
Ethereum implements an execution environment called Ethereum Virtual Machine (EVM).
 When a transaction triggers a smart contract all the nodes of the network will execute
every instruction.
 All the nodes will run The EVM as part of the block verification, where the nodes will
go through the transactions listed in the block and runs the code as triggered by the
transaction in the EVM.
 All the nodes on the network must perform the same calculations for keeping their
ledgers in sync.

Fig.1.3. Ethereum Working Process


 Every transaction must include:
 Gas limit.
 Transaction Fee that the sender is willing to pay for the transaction.
 If the total amount of gas needed to process the transaction is less than or equal to the
gas limit then the transaction will be processed and if the total amount of the gas needed
is more than the gas limit then the transaction will not be processed the fees are still
lost.
 Thus it is safe to send transactions with the gas limit above the estimate to increase the
chances of getting it processed.

Features of Ethereum

1. Smart contracts: Ethereum allows the creation and deployment of smart contracts.
Smart contracts are created mainly using a programming language called solidity.
Solidity is an Object-Oriented Programming language that is comparatively easy to learn.
2. Ethereum Virtual Machine (EVM): It is designed to operate as a runtime environment
for compiling and deploying Ethereum-based smart contracts.
3. Ether: Ether is the cryptocurrency of the Ethereum network. It is the only acceptable
form of payment for transaction fees on the Ethereum network.
4. Decentralized applications (Daaps): Dapp has its backend code running on a
decentralized peer-to-peer network. It can have a frontend and user interface written in
any language to make calls and query data from its backend. They operate on Ethereum
and perform the same function irrespective of the environment in which they get
executed.
5. Decentralized autonomous organizations (DAOs): It is a decentralized organization
that works in a democratic and decentralized fashion. DAO relies on smart contracts for
decision-making or decentralized voting systems within the organization.

3
Real-World Applications of Ethereum

 Voting
 Agreements
 Banking systems
 Shipping
 Crowdfunding
 Domain names

Benefits of Ethereum
 Availability: As the Ethereum network is decentralized so there is no downtime. Even if
one node goes down other computing nodes are available.
 Privacy: Users don’t need to enter their personal credentials while using the network for
exchanges, thus allowing them to remain anonymous.
 Security: Ethereum is designed to be unhackable, as the hackers have to get control of
the majority of the network nodes to exploit the network.
 Less ambiguity: The smart contracts that are used as a basis for trade and agreement on
Ethereum ensure stronger contracts that differ from the normal traditional contracts which
require follow-through and interpretation.
 Rapid deployment: On Ethereum decentralized networks, enterprises can easily deploy
and manage private blockchain networks instead of coding blockchain implementation
from scratch.
 Network size: Ethereum network can work with hundreds of nodes and millions of
users.
 Data coordination: Ethereum decentralized architecture better allocates information so
that the network participants don’t have to rely on a central entity to manage the system
and mediate transactions.

Drawbacks of Ethereum

 Complicated programming language: Learning solidity from programming smart


contracts on Ethereum can be challenging and one of the main concerns is the scarcity of
beginner-friendly classes.
 Volatile cryptocurrency: Ethereum investing can be risky as the price of Ether is very
volatile, resulting in significant gains as well as a significant loss.
 Low transaction rate: Bitcoin has an average transaction rate of 7TPS and Ethereum has
an average speed of 15 TPS which is almost double that of bitcoin but it is still not enough.

1.2 ETHEREUM Vs BITCOIN

What is Bitcoin?
Bitcoin is a cryptocurrency, which is a form of digital, private money that works
independently without the intermediaries such as bank or government. It is a digital token,
or virtual currency, as well as the network on which such tokens can be stored and
moved. Bitcoin is a digital currency that can be transferred on a peer-to-peer (P2P) network
without the need for any central authority.
 It was invented by a person or group of people with the name Satoshi Nakamoto in 2008.
All the transactions are stored in an immutable distributed ledger.

4
 Bitcoin is created, stored, transacted, and distributed using a decentralized, distributed
system known as Blockchain.
 A public ledger records all the transactions of the Bitcoin and copies are retained on all
the servers around the world.
 It is not necessary to buy an entire bitcoin, one can buy only a fraction of it if that is all
necessary.
 BTC is the abbreviation for Bitcoin.

Features of Bitcoin:
 Distributed: All bitcoin transactions are recorded in a public ledger known as
the blockchain. There are nodes in the network that maintain copies of the ledger and
contribute to the correct propagation of the transactions following the rules of the
protocols making it impossible for the network to suffer downtime.

 Decentralized: There is no third party or no CEO who controls the bitcoin network. The
network consists of willing participants who agree to the rules of a protocol and changes
to the protocol are done by the consensus of its users. This makes bitcoin a quasi-political
system.

 Transparent: The addition of new transactions to the blockchain ledger and the state of
the bitcoin network is arrived upon by consensus in a transparent manner according to
the rules of the protocol.

 Peer-to-peer: In Bitcoin transactions, the payments go straight from one party to another
party so there is no need for any third party to act as an intermediary.

 Censorship resistant: As bitcoin transactions are pseudo-anonymous and users possess


the keys to their bitcoin holdings, so it is difficult for the authorities to ban users from
using their assets. This provides economic freedom to the users.

 Public: All bitcoin transactions are available publicly for everyone to see. All the
transactions are recorded, which eliminates the possibility of fraudulent transactions.
 Permissionless: Bitcoin is completely open access and ready to use for everyone, there
are no complicated rules of entry. Any transaction that follows the set algorithm will be
processed with certainty.

 Pseudo-anonymous: Bitcoin transactions are tied to addresses that take the form of
randomly generated alphanumeric strings.

How Do Bitcoin Transactions Work?

Bitcoin transactions are digitally signed for security. Everyone on the network gets to know
about a transaction. Anyone can create a bitcoin wallet by downloading the bitcoin program.
Each bitcoin wallet has two things: public key and private key.
A bitcoin transaction contains three pieces of information:
 Private key: The first part contains the bitcoin wallet address of the sender i.e. the
private key. It is like a digital signature via which anyone can send bitcoins.
 Amount of bitcoin to be transferred: The second part contains the amount that has
been sent.

5
 Public key: The third part contains the bitcoin wallet address of the recipient i.e. the
public key. It is like an address or an account number via which any user or account can
receive bitcoins.
The public key can be shared with anyone but the private key must be held by the owner. If
the private key gets hacked or stolen then bitcoin gets lost.

How Does Bitcoin Mining Work?

In the Bitcoin network, there are nodes that use the computing power of their CPU to process
the transactions. The following are the steps followed while mining a bitcoin:
 The user initiates the bitcoin transaction by listing the details like the number of
bitcoins to be sent, and the public address, and affixing the private key to generate a
digital signature. The encrypted information to the miners present on the network.
 The miners will verify the transaction to check whether there is sufficient balance to
carry out the transaction.
 The faster the CPU of a miner, the greater the chances for the miner to get rewarded
for verifying the transaction. The miner’s job is only to provide the CPU, there is no
manual intervention from the miner. The bitcoin program will run automatically on the
system.
 Once the transaction is verified, the number of transactions is broadcasted to the
network of miners who can copy or download the block.
 These blocks through timestamps are stored in sequential order to form a
blockchain.
 Each miner in the network must have an updated copy of the blockchain ledger in
order to earn bitcoins.

Benefits of Bitcoin

The following are some of the advantages of using bitcoins:


 User anonymity: Bitcoin users can have multiple public keys and are identified by
numerical codes. This ensures that the transactions cannot be traced back to the user.
Even if the wallet address becomes public, the user can generate a new wallet address to
keep information safe.
 Transparency: Bitcoin transactions are recorded on the public ledger blockchain. The
transactions are permanently viewable, which gives transparency to the system but they
are secure and fraud-resistant at the same time due to blockchain technology.
 Accessibility: Bitcoin is a very versatile and accessible currency. It takes a few minutes
to transfer bitcoins to another user, so it can be used to buy goods and services from a
variety of places accepting bitcoins. This makes spending bitcoin easy in another country
with little or no fees applied.
 Independence from central authority: Bitcoin is a decentralized currency, which
means there is no dependence on any single governing authority for verifying
transactions. This means that the authorities are not likely to freeze or demand back the
bitcoins.
 Low transaction fees: Standard wire transfers involve transaction fees and exchange
costs. Since bitcoin transactions do not involve any government authority so the
transaction fees are very low compared to bank transfers.

6
Drawbacks of Bitcoin

The following are some of the cons of using bitcoin:


 Volatility: There are various factors that contribute to the bitcoin’s volatility like
uncertainty about its future value, security breaches, headline-making news, and one of
the most important reasons is the scarcity of bitcoins. It is known that there is a limit of
21 million bitcoins that could ever exist which is why some regard bitcoin as a scarce
resource. This scarcity makes bitcoin’s price variable.
 No government regulations: Unlike the investments that are done through central
banks, bitcoins transactions are not regulated by any central authority due to a
decentralized framework. This means that bitcoin’s transactions don’t come with legal
protection and are irreversible which makes them susceptible to crimes.
 No buyer protection: If the goods are bought using bitcoins and the seller does not send
the promised goods then nothing can be done to reverse the transactions and since there
is no central authority so no legal protection can be provided in this case.
 Not widely accepted: Bitcoins are still only accepted by a small group of online
merchants. This makes it unfeasible to rely completely on bitcoin as a currency and
replace it with traditional bank transactions.
 Irreversible: There is a lack of security in bitcoin transactions due to the anonymous
and non-regulated nature of the bitcoin transactions. If the wrong amount is sent or the
amount is sent to the wrong recipient then nothing can be done to reverse the
transactions.

7
Bitcoin vs Ethereum: Below are some of the differences between Bitcoin and Ethereum:
Sl.No Basis Bitcoin Ethereum
Bitcoin (abbreviation: BTC; sign: ₿) is a decentralized Ethereum is a decentralized global software platform
1 Definition digital currency that can be transferred on the peer-to-peer powered by blockchain technology. It is most commonly
bitcoin network. known for its native cryptocurrency, ether (ETH).
The word bitcoin was defined in a white paper published Ethereum was conceived in 2013 by programmer Vitalik
2 History
on 31 October 2008. The currency began use in 2009. Buterin, and then went live on 30 July 2015.
The purpose of Ethereum was to utilize blockchain
The purpose of bitcoin was to replace national currencies
3 Purpose technology for maintaining a decentralized payment
during the financial crisis of 2008.
network and storing computer code.
Although bitcoin do have smart contracts, they are not as Ethereum allows us to create smart contracts. Smart
flexible or complete as Ethereum smart contracts. Smart contracts are computer codes that is stored on a
4 Smart Contracts
contracts in Bitcoin does not have all the functionality that blockchain and executed when the predetermined terms
a programming language would give them. and conditions are met.
Smart Contract
Smart contracts on Bitcoin are written in programming Smart contracts on Ethereum are written in
5 Programming
languages like Script, Clarity. programming languages like Solidity, Vyper, etc.
Language
Ethereum transactions may contain some executable
6 Transactions Generally, bitcoin transactions are only for keeping notes.
code.
7 Hash Algorithm Bitcoin runs on the SHA-256 hash algorithm. Ethereum runs on the Keccak-256 hash algorithm.
Consensus The Proof-of-Work (PoW) is the consensus mechanism The Proof-of-Stake is the consensus mechanism used by
8
Mechanism used by the Bitcoin network. Ethereum.
9 Block Time The block time of bitcoin is 10 minutes. The block time of Ethereum is 14 to 15 seconds.
10 Block Limit The bitcoin blockchain has a block limit of 1 MB. The Ethereum blockchain does not have a block limit.
Bitcoin is the most popular digital currency in the market Ether, native currency of Ethereum is the second-largest
11 Popularity
to date. cryptocurrency after bitcoin to date.
12 Energy Consumption Energy consumption is very high. Energy consumption is very low as compared to bitcoin
13 Structure Structure of bitcoin is simple and robust. Structure of Ethereum is complex and feature rich
Miner got nearly 6.25 BTC on successfully adding new Miner got nearly 5 BTC along with same additional
14 Rewards
block in network. rewards on successfully adding new block in network.
15 Assets Assets of Bitcoin is BTC. Assets of Ethereum is Ether.

8
1.3 ETHEREUM CLIENTS

What is Ethereum Client?


An Ethereum client is a software program that is used to implement the Ethereum specification
and connect itself with other Ethereum clients over a peer-to-peer network. Different Ethereum
clients can communicate with one another if they follow the reference specification and the
defined communication protocols. While these many clients are created by various teams and in
various programming languages, they all “speak” the same protocol and adhere to the same rules.
As a result, they may all function on and interact with the same Ethereum network.
 These interactions among different clients in the network take place using various
programming languages like Geth (Go), OpenEthereum (Rust), Nethermind (C#, .NET),
Besu (Java), Erigon (Go/Multi).
 The yellow paper is the Ethereum protocol that allows anybody to run a client to construct a
node.
 The formal requirements that comprise Ethereum distinguish the blockchain from Bitcoin.
Whereas Ethereum sets standard behaviors that all Ethereum clients must adhere to, Bitcoin
Core does not. Ethereum’s specs enabled the blockchain to allow for different, but
interoperable, software implementations of an Ethereum client by providing standard
documentation and simple language.

Types of Ethereum Clients


There are 3 types of Ethereum Clients
1. Full Client: Full clients save the complete Ethereum blockchain, which might take
several days to synchronize and takes a massive amount of disc space – more than 1
Terabyte, according to the most recent estimates. Full clients enable connected nodes to
conduct all network functions, including as mining, transaction and block-header
validation, and smart contract execution.

2. Light Client: Ethereum clients do not always need to necessary keep all of the data, so
often, when data storage and performance are concerns, developers utilize the “light
clients”. Light clients provide a portion of full client capability. Because light clients do
not keep the entire Ethereum blockchain, as a result, they can provide quick delivery and
free up data storage space.
 The functionality of a light client is adapted to the purposes of the Ethereum client.
 Light clients, for example, are widely used within wallets to maintain private keys
and Ethereum addresses.
 They also manage smart contract interactions and transaction broadcasts.
 Light clients are also useful for web3 instances within JavaScript objects, Dapp
browsers, and obtaining the exchange rate data.

3. Remote Client: A remote client is much like a light client. The primary distinction is
that a remote client does not keep its own copy of the blockchain or validate transactions
or block headers. Remote clients, on the other hand, rely entirely on a full or lite client
to have access to the Ethereum blockchain network. These clients are mostly used as
wallets for transmitting and receiving transactions.

9
Benefits of Ethereum client implementations:
There are several benefits to having so many Ethereum client implementations, including the
following as follows.
1. It strengthens the network’s bug resistance.
2. It keeps development resources from being centralized.
3. In general, team contests aid in the discovery of the best solutions to common and difficult
problems.
4. In mining, prototyping, DApp development, and other areas, each customer may have a
distinctive emphasis, strength, and weakness. DApp developers and private Ethereum
blockchain operators may pick and choose which ones best suit their purposes.

What is Ethereum Node?

An Ethereum node is a computer that is running the software client. The blockchain network is
made up of nodes, which are the only method to access it. Nodes communicate with one another
in order to validate transactions and record data about the status of the blockchain. On the
Ethereum network, these computers or servers are responsible for storing, validating, and
trading data.
 Each node keeps its own copy of the blockchain and strives to verify that it matches the
copies of all the other nodes.
 Every node on the network must process any action that requires a new block to be added to
the blockchain.
 This network of continually communicating nodes allows us to avoid relying on a single
source of truth and all of the challenges it entails.
 A new block is added based on whether or not the majority of nodes accept it.

1. Full Node: The responsibility of a full node is to verify and validate each and every
transaction that takes place inside the network and maintain the state of the blockchain. When a
smart contract transaction occurs, full nodes also execute all of the instructions in the smart
contract. It determines whether or not the smart contract execution is producing the expected
results. These nodes maintain a full copy of the blockchain data.
 It keeps receiving copies of the entire blockchain including its transactions which are stored
locally and keeps the latest state of transaction with itself.
 When a smart contract transaction occurs, full nodes also execute all of the instructions in
the smart contract.
 It determines whether or not the smart contract execution is producing the expected results.
 Consider an example where person A performs a transaction to person B, this transaction is
added to the blockchain, then the full nodes verify whether the transaction complies with all
the Ethereum specifications, and maintain the latest state of the blockchain by storing or
removing the specification if it does not comply.
 An example of a discarder transaction is when a person transfers X ETH to another person
but their account contains less ETH.

10
2. Archive Nodes: Archive nodes are complete nodes that have the “archive mode” option
enabled. While a Full Node only stores the latest state of the transaction, the Archive nodes hold
all of the blockchain’s history data dating back to the genesis block.
 The Archive node is used when blocks prior to the latest 128 blocks are required.
 For example, using functions like eth_getBalance of a historic address would require an
archive node, as will interacting with smart contracts launched far earlier in the blockchain.
 Because of its special feature, Archive Nodes require more than 6 Terabytes of space,
contrary to Full node which only requires a little over 500 Gigabytes of diskspace.
 So, it can be inferred, that archive nodes are not useful for average people, they are effective
in the application of block exploring, wallet vending, and chain analytics.

3. Light Nodes: A light node, unlike a full node, does not hold the complete current blockchain
state and stores only the block header. It is suitable for low memory and computational devices
since maintaining a light node involve the least investment in hardware, running costs, and
technical skill.
 Light nodes rely on full nodes to function.
 These nodes do not need to run continuously or read and publish a large amount of data on
the blockchain.
 It provides an easy way to create a wallet, especially for beginners.
 For example, Solid-State Drives cannot afford to store the gigabytes of data that other nodes
take.
But there are some limitations of light nodes which cannot be denied, there is no guarantee that
the light wallet provider will be online when it is needed.

Ethereum Node vs Ethereum Client


Below are some of the differences between Ethereum Node and Ethereum Client.

Sl.No Ethereum Node Ethereum Client


A client is an Ethereum implementation that
A machine running Ethereum client
validates all transactions in each block,
1 software is referred to as an
ensuring the network’s security and data
“Ethereum Node”.
accuracy.
The three types of Ethereum Nodes
The three types of Ethereum Clients are Full,
2 are Full, Light, Archive, and Miner
Light, and Remote Clients.
Nodes.
The Ethereum node operating
The Ethereum client computer allows a user to
3 system allows us to access the
access the node operating system.
internet.

11
1.4 ACCOUNT MANAGEMENT

Ethereum Accounts?

Ethereum is a digital, blockchain-based open source digital cryptocurrency platform which also
has the functionality of smart contracts. The cryptocurrency of Ethereum is called Ether (ETH).
The Ethereum network is like a blockchain network but it also enables apps and contracts instead
of only making transactions.
A smart contract is a program that runs on the Ethereum blockchain, they are used to define an
agreement or a contract and make sure that it is being followed, an amazing use case of smart
contracts would be in ensuring quality management of factory-made products by providing
transparency and traceability regarding product origins and other information about things eaten
on a daily basis from a global supply chain.

What are Ethereum Accounts?


An Ethereum account is similar to a bank account, but for ethers or ETH, where Ethereum can
be held, transferred to other accounts, and can also be used to execute smart contracts. An
Ethereum account is an entity that is composed of an Ethereum address along with a private key.
The first 20 bytes of the SHA3 hashed public key is the Ethereum address.

Type of Ethereum Accounts


Ethereum has two types of accounts: An externally owned account (EOA), and a Contract
account. These are explained as following below:
1. Externally owned account (EOA)
2. Contract Account
Fig. 1.4 shows the pictorial representation of Ethereum Accounts

Fig. 1.4. Diagram of Ethereum Accounts

12
Different Fields in Ethereum Accounts

1. Nonce: The nonce in an Ethereum account indicated the number of transactions that have
been sent from that account. This ensures that each transaction is made only once by taking
count every time it takes place.
2. Ether Balance: The balance of an Ethereum account denotes the amount of ether present in
an ether repository of the current ether account.
3. Contract Code: This is non-mandatory to fill, in case it is present since not all accounts have
a contract code. But note, that they cannot be altered once executed.
4. Storage: This field remains not filled unless mentioned.
5. Code Hash: The value of the code hash for Contract Accounts will be a hash that refers to
the code present in that Ethereum account and since no code is associated with externally
owned Ethereum accounts, therefore, code hash will be an empty string.

 Externally owned account (EOA): Externally owned accounts are controlled by private
keys. Each EOA has a public-private key pair. The users can send messages by creating and
signing transactions.
This is the most basic type of Ethereum account, it functions similarly to a bitcoin account.
A private key controls the Ethereum address for EOAs. A person can open as many EOAs
as they require. It is created whenever a wallet is created, and it is made with a private key
that is required to access EOAs, check balances, send and receive transactions, and establish
smart contracts.
Externally Owned Accounts and Key Pairs
An Ethereum account is a private-public key pair that may be linked to a blockchain address.
1. It is a “owned” or “externally owned” account if the private key is known and controlled
by someone.
2. Otherwise, we’re talking about smart-contract accounts if the private key is unknown and
just an address exists.
Contract accounts do not have a private key connected with them, although externally owned
accounts have. Control and access to one’s assets and contracts are granted through the EOA
private key.
 Control and access to one’s assets and contracts are granted through the EOA private
key. The user keeps the private key safe.
 While, as the name implies, the account’s public key is open. This key serves as the
account’s identity. A one-way cryptographic function is used to produce the public key
from the private key.
 For example, if you create an account on Ethereum, you will retain the private key to
yourself while sharing the public key. Transactions between accounts are completed
using public keys.

Advantages of EOA:
 Transactions from an external account to a contract account can trigger code that can
execute many different actions, such as transferring tokens or even creating a new
contract.
 Externally Owned Accounts cannot list incoming transactions.

13
 Contract Account: Contract accounts are controlled by contract codes. These codes are
stored with the account. Each contract account has an ether balance associated with it. The
contract code of these accounts gets activated every time a transaction from an EOA or a
message from another contract is received by it. When the contract code activates, it allows
to read/write the message to the local storage, send messages and create contracts.
 Contract-based accounts can perform all of the functions of an externally owned account, but
unlike EOAs, they are formed when a contract code is deployed, are governed by contract
codes, and are accessed using a unique address. When one party accepts a contract, a unique
account is formed which contains all of the charges associated with that contract. Each
contract is granted a distinct serial number, which is referred to as a contract account.
 Types of Contract Accounts
 Below are the three types of contract accounts:
i. Simple Account: The account is created and owned by a single account holder.
ii. Multisig (multisignature) Account: A Multisig Wallet contains several owner
Accounts, one of which is also the creator Account.
iii. Simplest Account: A Multisig Wallet contains several owner Accounts, one of which
is also the creator Account.

Advantages of Contract Accounts:


1. A contract account can list incoming transactions.
2. Contract accounts can be set up as Multisig Accounts.
3. A Multisig Account can be structured such that it has a daily limit that you specify, and
only if the daily limit is exceeded will multiple signatures be required.

Disadvantages of Contract Accounts:


1. Creating contract accounts costs gas because they use the valuable computational and
storage resource of the network.
2. Contract accounts can’t initiate new transactions on their own. Instead, contract accounts
can only fire transactions in response to other transactions they have received either from
an externally owned account or from another contract account.

Externally Owned Accounts vs Contract Based Accounts


Below are the differences between Externally owned accounts and contract-based accounts.
S. No. Externally Owned Accounts Contract Accounts
1. This account is controlled by humans. This account is controlled Contract Code.
The private key is needed to access No key is needed to access Contract
2.
EOAs. Accounts.
EASs are created automatically on
3. CA require EOAs to be activated.
creating a wallet.
EOAs do not have their own
4. CAs have their own associated code.
associated code.
No execution fee is associated with
5. The execution fee is associated with CAs.
EOAs.
Code hash represents the code associated
6. Code hash is an empty string.
with the account.

14
1.5 ETHER

What is Ether(ETH)?
Ether (ETH) is the native cryptocurrency of the Ethereum network. It serves as the fuel that
powers the execution of smart contracts, enables transactions, and facilitates interactions within
the Ethereum ecosystem.

Ether is the transactional token that facilitates operations on the Ethereum network. All of the
programs and services linked with the Ethereum network require computing power, equipment,
internet connections, and maintenance. Ether is the payment users give to network participants
for executing their requested operations on the network.

It is more accurate to refer to ether as the "gas" that powers the network. Gas is the term the
community uses to refer to the exchange of ether for the work done to verify transactions and
secure the blockchain.

Understanding Ether (ETH)


The Ethereum blockchain is a distributed ledger designed as a platform that makes it easier for
people to create applications that require information to be stored securely. Additionally, it was
created to remove third parties from global financial systems and transfer monetary control to the
people instead of governments and businesses.

A distributed, worldwide virtual computer hosts the platform and the blockchain. It uses nodes
(the remote hosts), a consensus layer, an execution layer, and volunteers who provide the
equipment necessary for hosting the virtual machine.

The operational costs of maintaining a host and participating in the network and blockchain are
minimal, but the volunteer validators must stake valuable ether of their own to host nodes.
Validators receive a chance to validate transactions and earn a reward for their work, issued in
ether (ETH).

 In order to support the Ethereum network, developers need the cryptocurrency, Ether,
to create and run applications. Ether is used to pay for transaction fees and
computational services.
 Users can send Ether to other users, and developers can write smart contracts that
receive, hold, and send Ether.
 Ether comes into existence by the validation of transactions on the Ethereum
platform, through a process called mining. Those performing this validation are
referred to as “miners”.
 When miners successfully verify a group of transactions, they are awarded
Ether. Miners follow a set of cryptographic rules which keep the network stable,
safe and secure.
 Ether transactions are recorded and verified on a digital public ledger called
blockchain.

15
Ethereum Wallets

 Before taking possession of Ether, an individual must have an Ethereum wallet.


 Secure Ethereum wallets can be downloaded and set up onto a computer, smartphone or
other mobile device.
 Each Ethereum wallet stores an individual’s private key which allows the wallet owner
to sign transactions that send Ether to other parties.

What is Ethereum?
Ethereum is a decentralized blockchain platform that enables the development and execution of
smart contracts and decentralized applications (DApps). It provides a foundation for building
various blockchain-based solutions and allows for the creation of programmable digital assets.

Is Ether the same as Ethereum?


No, Ether and Ethereum are not the same. Ethereum is the blockchain platform, whereas Ether
is the cryptocurrency native to that platform. Ethereum provides the infrastructure and
capabilities for decentralized applications, while Ether is the digital asset used within that
ecosystem.

Ether Uses
 Transaction Fees and Gas: Ether is used to pay transaction fees on the Ethereum network.
Users must include a fee, known as “gas,” to incentivize miners or validators to process and
validate transactions.
 Smart Contract Execution: Ether is required to execute smart contracts on the Ethereum
network. It serves as the currency for deploying and interacting with these self-executing
agreements.
 Decentralized Finance (DeFi): Ether plays a significant role in DeFi applications. It can be
used as collateral for loans, liquidity provision, yield farming, and governance within DeFi
protocols.
 Token Creation and ICOs: Ether has been instrumental in the creation of tokens on the
Ethereum platform. Many projects conduct Initial Coin Offerings (ICOs), raising funds by
selling their tokens in exchange for Ether.
 Interoperability and Integration: Ether can be tokenized as Wrapped Ether (WETH) and
used on other blockchain platforms, enabling interoperability and seamless integration
between Ethereum and other ecosystems.

How to Buy Ether?


To buy Ether, you can follow these steps:
1. Set up a cryptocurrency wallet that supports Ether.
2. Choose a cryptocurrency exchange that allows you to buy Ether.
3. Create an account on the exchange and complete the necessary verification process.
4. Deposit funds into your account using fiat currency or other cryptocurrencies.
5. Place a buy order for Ether on the exchange, specifying the desired amount and price.
6. Once the order is filled, the purchased Ether will be credited to your wallet.

16
How do you obtain Ether?
There are multiple ways for an individual to obtain Ether.
 It can be purchased on an exchange using a fiat currency under the symbol ETH.
 It can be exchanged for Bitcoin on exchanges that offer a BTC-ETH pair.
 It can be transferred to you from another person or entity.
 It can be earned as a miner, through joining a mining pool or by purchasing a cloud mining
contract

How is Ether used to power DApps?


Ether plays a crucial role in powering DApps on the Ethereum network. It is used for:
 Accessing DApp features: Ether can be required to access specific functionalities, premium
features, or services within a DApp.
 In-App Purchases: DApps may allow users to make purchases using Ether. This can include
buying digital goods, virtual assets, or in-game items.
 Decentralized Governance: Ether can be staked or used for voting within decentralized
autonomous organizations (DAOs) to participate in decision-making processes and shape the
direction of the organization or network.

How Does Ether (ETH) Work?


As the second largest blockchain by market cap, Ethereum hosts an ever-expanding ecosystem of
decentralized applications (dApps) that facilitate peer-to-peer user interactions. Every action in
the Ethereum network — whether you’re creating a digital collectible or collateralizing a crypto
loan — involves a transaction, and each of these transactions requires a certain amount of
computing power. These transactions are paid for with ETH.

 The ETH fees that result from transacting on the Ethereum blockchain are referred to
as gas. In this sense, ETH is the fuel that powers the Ethereum network. This provides a
continued demand for ETH, as both service providers and end users on the Ethereum
network must continually purchase and spend ETH in order to interact with one another
via the network’s smart contract protocols.
 Among Ethereum users, gas costs are denoted in gwei, a denomination of ether equal to
0.000000001 ETH. The exact size of this cost per on-chain operation depends on the
computational effort required to complete that action, and can therefore be influenced by
how congested the network traffic is at the time the action is initiated.
 For the sake of transparency, approximated gas fees are typically communicated to a user
before they are prompted to initiate a transaction, and many services built on Ethereum
allow users to pay a higher gas fee than is recommended in order to expedite their
transaction or increase the likelihood that it will be successfully executed by the network.
Alternatively, since gas fees can fluctuate in accordance with network usage volatility, Ethereum
users who want to avoid paying excessive ether transaction fees can set a gas limit for their
transaction, which means that their proposed transaction will not be executed if the involved cost
surpasses a certain value.

ETH gas fees also act as a spam mitigation tool in the sense that nefarious actors who might
otherwise attempt to disrupt the system via a cascade of low-quality transactions are financially
deterred by the prospect of paying ETH gas fees.

17
Ether vs Bitcoin : How Is Ether Different from Bitcoin?
Purpose
 Most importantly, the overall aims of the networks are different. Bitcoin was created as a
secure peer-to-peer decentralized payment system, an alternative to traditional currencies.
 The Ethereum platform was created to facilitate contracts and applications, and ether is
the medium through which these transactions are made possible. Ether was never intended
to be an alternative currency or to replace other mediums of exchange, but it has become
one. Its original purpose was to facilitate and monetize the operations of the Ethereum
platform.
 Unlike Bitcoin, the total number of ether tokens does not have an absolute cap—it changes
and grows constantly according to demand. As a result, the Ethereum blockchain is
significantly larger than the Bitcoin blockchain, and it is expected to continue to outpace
Bitcoin in the future.

Below is the difference between Ethereum and Bitcoin:

Sl.No Key Terms Ether (ETH) Bitcoin (BTC)


1 Purpose Fuel for the Ethereum Digital currency/store of value
network
2 Blockchain Ethereum Bitcoin
3 Functionality Executes smart contracts Enables peer-to-peer
transactions
4 Supply Uncapped supply Capped supply of 21 million
5 Consensus Transitioning to Proof of Proof of Work (PoW)
Mechanism Stake (PoS)
6 Transaction Speed Faster Slower
7 Use Cases DApps, DeFi, Tokenization Store of value, transactions

Value Benefits of Ether


 Utility and Versatility: Ether offers utility beyond being a traditional cryptocurrency. It
serves as the fuel for executing smart contracts and enables the creation of decentralized
applications (DApps). This versatility positions Ether as a valuable asset in the evolving
blockchain landscape.
 Thriving Ecosystem: Ethereum boasts a vibrant and rapidly growing ecosystem. It attracts
developers, entrepreneurs, and investors, fostering innovation and creating numerous
opportunities for collaboration and value creation. The thriving ecosystem contributes to the
long-term value potential of Ether.
 Interoperability: Ether’s tokenization capability, such as Wrapped Ether (WETH), allows
it to seamlessly interact with other blockchain platforms. This interoperability opens doors
for cross-chain applications, liquidity pools, and decentralized finance (DeFi) protocols,
expanding the reach and utility of Ether.
 Liquidity and Market Presence: Ether is one of the most widely recognized and traded
cryptocurrencies in the market. Its high liquidity facilitates easy buying, selling, and
conversion, enabling users to access and move value efficiently within the Ethereum
ecosystem and beyond.

18
 Network Effects and Community: Ethereum benefits from a strong and active community
of developers, enthusiasts, and stakeholders. The collective efforts and collaborations within
the Ethereum community contribute to the network effects, driving adoption, innovation, and
the overall value of Ether.
 Decentralization and Security: As a cryptocurrency native to a decentralized blockchain
platform, Ether offers security and immutability. It operates on a distributed network of
nodes, reducing the risk of censorship, single points of failure, and unauthorized alterations,
providing users with increased trust and confidence.
 Potential for Growth and Adoption: Ether’s early adoption and continued development
make it well-positioned for potential future growth. As more industries embrace blockchain
technology and decentralized applications, Ether’s value may increase as it becomes an
integral part of innovative solutions across various sectors.

1.6 THE ETHEREUM NETWORK

What is Ethereum Network?


Ethereum is a decentralized platform that supports smart contracts, programs that execute
exactly as intended with no chance of fraud or outside influence. This blockchain may be
customized. It enables users to start ICOs and develop decentralized applications (dapps).
These applications are powered by a specially developed blockchain, a potent worldwid e
shared infrastructure that can transfer value and reflect property ownership .

Overview:
 Vitalik Buterin, a programmer, proposed Ethereum in 2013. The network went live in 2015,
with an initial supply of 72 million coins, after being crowdfunded in 2014.
 The Ethereum Virtual Machine (EVM) can run decentralized programs and execute scripts.
Ethereum is used for decentralized banking, the production and distribution of non-fungible
tokens (NFTs), and many ICOs.
 After Bitcoin, Ethereum is quoted as the second most prevalent crypto-currency. Unlike
Bitcoin, Ethereum is proposed to be much more than simply a means of exchange or a store
of value.
 Ethereum, on the other hand, refers to itself as a decentralized computer network based on
blockchain technologies. Ethereum is built on top of a blockchain network. A blockchain is
a transparent, distributed public ledger that verifies and records all transactions. Everyone
on the Ethereum network has an exact copy of this ledger, which allows them to view all
previous transactions.
 The Ethereum network allows users to build and run apps, smart contracts, and other
transactions. These features are not available in Bitcoin.
 It is only used as a medium of exchange and a store of cash. There is no boundary on how
much Ether tokens can be produced while Bitcoin can only deliver 21 million coins.
 All, regardless of context or location, have access to digital money and data-friendly
resources thanks to Ethereum. It’s the technology that powers the ether (ETH) and thousands
of other apps available today.
 The Ethereum Virtual Machine (EVM) is run by Ethereum clients, which may be built in any
popular programming language.

19
Types of Ethereum Network
There are three types of Ethereum networks — the public mainnet, the private mainnet, and the
testnet. According to Ethereum Foundation’s research center, a new hybrid network called Whisper
Network is under development.
i. Public mainnet : The public Ethereum network has two variations: Homestead and
Metropolis. The first one was launched in March 2015 via a hard fork which resulted in a
different set of network parameters that enabled smart contract transactions.
In 2016, the Foundation planned another hard fork called Metropolis to improve efficiency and
flexibility when dealing with transactions and smart contracts on the blockchain.
With the new hard fork come both the public mainnet (Metropolis) and the testnet (Ropsten).
ii. Private mainnet: In a private Ethereum network, membership is controlled and limited to
certain users who are carefully selected by administrators. It is used to protect against malicious
attacks and limit access only to trusted parties — which makes it an ideal solution for
companies looking to develop applications based on cryptocurrency.
Private networks can be built in-house or hosted by a third-party service provider such as
Microsoft Azure or Amazon Web Services.
iii. Testnet: The testnet is used by those who want to experiment with their code before launching
it on the mainnet. Users who want to try out the testnet can create a new node and join the
network — or they can connect their private networks to the public testnet.
A functional public testnet is a necessary component of an Ethereum-based app as most
developers use it to test their apps, smart contracts, and other solutions based on blockchain
technology.
iv. Whisper Network (sharding): The Whisper Network was originally developed as a platform
for private messaging between users in an Ethereum-based app or decentralized application
(dapp).
To understand how the Whisper Network works, it is necessary to have a basic understanding
of “sharding”. The network is made up of shards that are linked together by the use of complex
cryptography. Each of these shards can contain multiple nodes and are collectively updated by
their leader nodes at specific intervals. The Whisper Network uses a combination of high-speed
encryption developed by the Ethereum Foundation, sharding technology, and distributed
storage solutions.

Components of Ethereum Network


Ethereum network is an ever-evolving rich ecosystem that comprises numerous components that
define the basis and functionality of decentralized applications (DApps) and smart contracts.
The Ethereum network is build on a blockchain, which is a distributed ledger that records
transactions across a network of computers (basically a digital ledger).

Components of Ethereum Network:


Component-1: Nodes

There are two types of nodes in an Ethereum network. They are as follows.
1. Mining Node: These nodes are responsible for writing all the transactions that have occurred
in the Ethereum network in the block.

20
2. Ethereum Virtual Machine Node: These are the nodes in the Ethereum network in which
Smart Contracts (it is a type of contract between supporter and developer in which there are
a set of rules based on which both the parties agree to interact with each other. The agreement
will be automatically executed when the pre-defined rules are met.) are implemented. By
default, this node utilizes a 30303 port number for the purpose of communication among
themselves.
3. Seed Node
4. Peer Node

Component-2: Ether
 Just like we have money to do the exchange of goods in real world, we need Ethers to
exchange data or perform any kind of operation in Ethereum Blockchain. Ether is a type of
cryptocurrency used in the Ethereum network just like a bitcoin is used in a blockchain
network. It is a peer-to-peer currency, similar to Bitcoin. It tracks and promotes each
transaction in the network.
 It is the second-largest cryptocurrency in the world. The first one is Bitcoin. Other
cryptocurrencies can be used to get ether tokens, but vice versa is not true.
 It means that ether tokens can’t be interchanged by other cryptocurrencies to render
computing power for Ethereum transactions. Ether is paid as a commission for any execution
that affects the state of Ethereum.
 It is used in the Ethereum algorithm as an incentive for miners who connect blocks to the
blockchain using a proof-of-work method.
 It is the only currency that can be used to pay transaction costs, which go to miners as well.
The block reward, as well as transaction fees, provide miners with an opportunity to keep the
blockchain rising.
 Aside from paying for transactions, ether is often used to purchase gas, which is used to pay
for the computation of any transaction on the Ethereum network.

Component-3: Gas
 Gas is an internal currency of the Ethereum network. We need gas to run applications on the
Ethereum network, much as we need gas to run a vehicle.
 To complete every transaction on the Ethereum network, a consumer must first make a
payment—send out ethers—and the intermediate monetary value is known as gas.
 Gas is a unit of measurement on the Ethereum network for the computing power used to
execute a smart contract or a transaction.
 The price of gas is very low compared to Ether. The execution and resource utilization costs
are predetermined in Ethereum in terms of Gas units, called gwei.

Component-4: Ethereum Accounts


There are two types of Ethereum accounts. They are as follows.
1. Externally owned account (EOA): These accounts are used to store transactions.

2. Contract account: As the name itself suggests, these accounts store the details of Smart
Contracts.

21
Component-5:Nonce
For externally owned accounts, nonce means the number of transactions via this account. For a
contract account, nonce means the number of contracts generated via this account.

Component-6: Storage Root


It is the main root node of a Merkle tree. Hash of all details of the account is stored here. The
root of the Merkle tree is the verification of all transactions.

Component-7: Algorithm Used


 Ethash
The intended PoW algorithm for Ethereum 1.0 is Ethash. It’s the most recent version of
Dagger-Hashimoto, however, it’s no longer proper to call it that because many of the
algorithms’ initial characteristics have been dramatically altered in the previous month of
study and development. Since ethereum transitioned to Proof of Stake (PoS) in 2022, ethash
has become legacy and the PoS Algorithm used is – “Clique”.

Component-8: Execution Client


These are core components that act as the heart of ethereum, and facilitates transaction
processing, maintaining state, and ensuring every node is following the consensus rules. Here
are key responsibilities
 Handling the transactions sent to the ethereum network.
 Keeping track of current state of the blockchain, syncing with the overall networks that
involves account balances, smart contract execution and block information
 Validating blocks and ensuring they adhere to the ethereum network’s agreed upon rules
Some examples are Geth, Nethermind, Besu etc.

Component-9: Consensus Client


A consensus client is a software that implements the Proof-of-Stake Algorithm and helps the
blockchain network ensure that all the nodes agree on the state of the blockchain. It has the
following key responsibilities
 Transaction Validation: Ensuring that any transaction made over the ethereum network
adhere to the rules and guidelines set
 Block Proposal: Block proposal is the process of organizing a set of valid transaction into
groups and then broadcasting them to the ethereum network for proposal as including them
in the network.
Algorithm:
The algorithm follows the following general path as follows.
1. There is a seed for each block that may be determined by reading over the block headers till
that point.
2. A 16 MB pseudo-random cache may be computed from the seed. The cache is saved by light
clients.
3. We can construct a 1 GB dataset from the cache, with the condition that each item in the
dataset is dependent on just a few cache items. The dataset is stored by full clients and miners.
The dataset expands linearly over time.

22
4. Taking random slices of the dataset and hashing them together is what mining is all about.
Verification may be done with little memory by utilizing the cache to renew just the parts of
the dataset that you require, requiring just the cache to be stored.

1.7 MINING
What is Crypto Mining?
Crypto mining simply refers to the process of generating new digital coins or adding blocks in
the chain. It can be achieved by solving a complex mathematical problem with the help of a
sophisticated crypto-mining hardware device such as ASICs (Application-specific integrated
circuits).

What is Bitcoin Mining?

Bitcoin Mining is the process of verifying bitcoin transactions and storing them in a
blockchain(ledger). It is a computer process that creates new bitcoin in addition to tracking
Bitcoin transactions. Bitcoin mining is a computation-intensive process that uses complicated
computer code to generate a secure cryptographic system. The bitcoin miner is the person who
solves mathematical puzzles (also called proof of work) to validate the transaction.
Why do Bitcoin Needs to Be Mined?
Mining solves these problems by making the below illicit activities extremely expensive and
resource-intensive.
 Bitcoin is a digital currency where there are chances of copying, counterfeiting, or
double-spending the same coin more than once.
 It is more beneficial and cost-effective to join the network as a miner than to try to
undermine it.

Why Does Bitcoin Needs Miners?


Bitcoin miners are very essential for the smooth functioning of the bitcoin network for the
following reasons:
 Miners’ job is just like auditors i.e. to verify the legitimacy of the bitcoin transactions.
 Miners help to prevent the double-spending problem.
 Miners are minting the currency. In the absence of miners, Bitcoin as the network would
still exist and be usable but there would be no additional bitcoin.

Why Mine Bitcoins?


There are several pros of mining a bitcoin:
 Mining bitcoin helps support the Bitcoin ecosystem.
 Bitcoin mining helps miners to earn rewards in form of bitcoins.
 It is the only way to release new cryptocurrencies into circulation.
 It is used to check counterfeiting and double spending.

23
Types of Bitcoin Mining
A bitcoin can be mined mainly in 3 ways.
 GPU Mining: In this process, coins are mined with the help of a graphics card.
 CPU mining: In this process, coins are mined with the help of a central processing unit.
 ASIC mining: ASICs (application-specific integrated circuits) is one of the most widely
used bitcoin mining methods that work on a specific algorithm.

How does Bitcoin Mining Work?


The nodes of the blockchain network are based on the concept that no one in the network can be
trusted. Proof of work is accepted by nodes to validate any transaction. Proof of work involves
doing hefty calculations to find a 32-bit hash value called nonce to solve the mathematical
puzzle. The miners create new blocks by abiding by the fact that the transaction volume must be
less than 21 million. 21 million is the total number of bitcoins that can be generated. The verified
transaction gets a unique identification code and is linked with the previous verified transaction.

Fig.1.5 Bitcoin Mining Process


 The bitcoin mining process involves solving complex mathematical calculations that
consume high electricity and require special powerful computers. The miner that becomes
able to find the solution to the problem first is awarded the bitcoin, and this process of
guessing the correct solution (hash) is known as proof of work. The miners must guess the
valid number as soon as they can using powerful computers; this process becomes more
complex as new miners add to the network.
 All these calculations can be done by computer hardware called ASICs (Application-specific
integrated circuits). This computing hardware is quite expensive and can cost around $
10,000 or even more. Also, this hardware is highly power-consuming, and thus, many
environmental activists are against bitcoin mining.
 As a miner gets successful in adding a bitcoin to the blockchain, he receives 6.25 bitcoin in
return. For example, if a bitcoin is available to trade at $ 10,000, the miner will receive $
62,500.
Bitcoin miners:
Within the bitcoin network there are a group of people which are called miners and their role is
to process and confirm transactions. Anybody can apply to be a miner, and you could run the
client yourself.

24
Role of bitcoin miners:

 The role of the miners is to process and confirm transactions to chain together the blocks of
transactions.
 Typically, these miners use very powerful computers that are specifically designed to mine
bitcoin transactions, and the way they do that is by actually solving math problems and
resolving cryptography issues, because every one of these transactions need to be
cryptographically encoded and secured.
 These mathematical problems are what actually ensures that the data is secure and nobody
is tampering with that data.
For the miners to earn rewards from verifying the bitcoin Transactions, two things must be
ensured:
 The miners must verify the one-megabyte size of the transaction.
 For the addition of a new block of transaction in the blockchain, miners must have the
ability to solve complex computational maths problems called proof for work by finding
a 64-bit hexadecimal hash value.

Example:
Let’s understand this with the help of an example-

Fig.1.6. Process of Bitcoin Mining

 Suppose Alice wants to transfer 10 BTC to Bob.


 Now the transaction data of A is shared with the miners from the memory pool. A
memory pool is a place where an unconfirmed or unverified transaction waits for its
confirmation.
 Miners start competing with themselves to solve the mathematical riddle in order to
validate and verify the transaction using proof of work.
 The miner who solves the problem first shares his result with other nodes(miners).

25
 Once maximum nodes agree with the solution, the transaction block is verified and is
then added to the blockchain.
 At the same time, the miner who solved the puzzle gets a reward of 6.25 bitcoins.
 Now, after the addition of the transaction block, the 10 BTC associated with the
transaction data is transferred to Bob from Alice.

Components of bitcoin:
There are four components
of bitcoin:
i. Software
ii. Cryptography
iii. Hardware
iv. Gaming theory

Software: Bitcoin is basically a software that defines how a bitcoin gets transferred. It identifies
what are the rules of a valid bitcoin. That software at its core uses cryptography and bitcoin is a
cryptocurrency.
Cryptography: As a cryptocurrency it uses cryptography to regulate the transfer of bitcoin
between parties as well as creation of new units of bitcoin. So, if it wasn’t for cryptography,
bitcoin would simply not be possible. All this needs to run on hardware.
Hardware: This hardware is composed of thousands of miners around the world running their
computers.
Gaming Theory: The final component that ties it all together is gaming theory. Because bitcoin
in essence is truly a game that is run by these miners around the world.

Requirements to Mine Bitcoin

In past, users of the system used to mine bitcoins using their home computers but as the
technology has improved, this is no longer the case. The general time a bitcoin network takes to
verify a new transaction is 10min. Within that time, there are more than one million miners
competing with each other to find the hash value. When there is more computing power working
together to mine for bitcoins, the difficulty level of mining increases. Therefore, in order to mine
bitcoins, the user must possess-
 Specialized mining hardware is called “application-specific integrated circuits,” or ASICs.
 A Bitcoin mining software to join the Blockchain network.
 Powerful GPU (graphics processing unit).

How to Start Mining Bitcoin?


The following steps display the ways to mine bitcoins:
1. Profit calculation: One must, first of all, calculate the profit by taking hardware costs,
electricity costs, and bitcoin costs into consideration.

26
2. Buying the Mining Hardware: After ensuring the feasibility of mining bitcoins, the user
must purchase mining hardware like ASICs.
3. Mining Software: For proper access to bitcoin, mining software provides a pathway to
join the Blockchain network. There are lots of free mining software available online.
4. Installing Bitcoin Wallet: After the user receives bitcoins as a reward for mining, the
bitcoins are to be kept in the bitcoin wallet.
5. Joining a Mining Pool: This increases the possibility of mining bitcoins efficiently.

What is a Bitcoin Mining Rig?


A bitcoin mining Rig is a set of hardware that miners use to mine a bitcoin. A CPU, GPU, ASICs,
and FPGA are some of the most common Bitcoin mining rigs. A miner can use any one of these
hardware devices to mine a bitcoin or any other cryptocurrency.
Is Bitcoin Mining Legal?
The legalization of Bitcoin is subject of matter to each country’s norms and regulations. In some
countries, such as the USA, UK, and Canada, bitcoin mining is legal. While on the other hand,
there are many other countries where bitcoin is illegal, such as Bangladesh, Egypt, Morroco,
Nepal, Qatar, and China. However, many countries haven’t cleared their stand on bitcoin mining.
Also, even though it’s legal in the US, there are many states in the USA where Bitcoin mining
is still illegal.
Risks Associated with Bitcoin Mining
 The volatile bitcoin prices are the primary area of concern while investing in bitcoin
mining. As the price of bitcoin goes up and down very frequently, and thus there is a high
risk in investing in bitcoin. Also, in past years, bitcoin has been trading at $ 20,000 and
has risen to only $ 69,000.
 Another factor that increases the risk in bitcoin mining is government regulations. In
many countries, still, cryptocurrency is not legal as the government doesn’t have control
over its regulation. Some countries and many countries have not yet clarified their stand
on bitcoin.
How is bitcoin created?
 Bitcoin miners process transactions and secure the network using specialized hardware,
therefore the miners are rewarded in bitcoin which is a key component of bitcoin.
 Because money in bitcoin is not created like you create normal fiat currency(like euros,
dollars, rupees, etc)
 The way bitcoin is created is by rewarding these miners for their work in solving these math
and cryptography problems. That reward is currently 12.5 bitcoins. That is how new bitcoins
are created.

Factors influencing the price of bitcoin:


1. The supply of bitcoin and market demand for it.
2. The cost of producing a bitcoin through the mining process.
3. The rewards issued to bitcoin miners for verifying transactions to the blockchain.
4. The number of competing cryptocurrencies.
5. The exchanges it trades on.
6. Regulations governing its sale.
7. Its internal governance.

27
1.8 HISTORY OF ETHEREUM

 2013: Ethereum was first described in Vitalik Buterin’s white paper in 2013 with the goal of
developing decentralized applications.
 2014: In 2014, EVM was specified in a paper by Gavin Wood, and the formal development
of the software also began.
 2015: In 2015, Ethereum created its genesis block marking the official launch of the
platform.
 2018: In 2018, Ethereum took second place in Bitcoin in terms of market capitalization.
 2021: In 2021, a major network upgrade named London included Ethereum improvement
proposal 1559 and introduced a mechanism for reducing transaction fee volatility.
 2022: In 2022, Ethereum has shifted from PoW(Proof-of-Work ) to PoS( Proof-of-Stake)
consensus mechanism, which is also known as Ethereum Merge. It has reduced Ethereum’s
energy consumption by ~ 99.95%.

1.9 COMMUNITY

What does the crypto community mean?


A crypto community is a group of individuals who are all about crypto, DeFi projects,
and blockchain. It provides the place to people can freely discuss about cryptos, layer-2 projects,
and NFT collection between who are interested in this domain.

But what’s the importance of crypto communities?


 The traditional financial system has all things in control of centralized authorities and
financial institutions; users have no say in the workings or rules of the system itself.
 The decentralized nature of blockchains gives those rights back to users- making them the
ones to decide a course of action. For this, we need something to unite or hold all interested
individuals and contributors to projects, which is why the crypto communities are here.
 Crypto communities exist in multiple forms- online discussion forums, chat rooms, discord
channels, Subreddits, Twitter communities, and other social platforms.
 For example, the Ethereum blockchain has a community dedicated to its network users,
developers, and investors, where they can chat on various subjects, project’s future
roadmap, or contribute to the network itself.

How do crypto communities work?


 Cryptos can be intricate, and the crypto communities make a cool space for anyone into
crypto stuff. The main ideology is to create a safe and welcoming place for all those curious
minds and crypto enthusiasts out there, but not limited to hanging out.
 These communities make hubs of learning and teamwork, where people can share
experiences and learnings, and start-ups can freely seek out investors.
 Crypto communities are kicked off by “community owners” who set things up, run them,
and have full access to everything within the community.
 Community managers take charge of different parts of the community, like moderators
and Shillers.
 Moderators ensure the convo stays within community guidelines and draw out spammers.
Shillers are responsible for keeping the vibe alive of the community; they do so by

28
promoting cryptos, organizing giveaways, shouting out to active members, and sharing
new information.
Before joining crypto communities, the person should read the guidelines properly. Most
communities provide clear and defined rules- not strict ones, so all members can enjoy the essence
of community without any conflict.

Benefits of joining crypto community


1. Market Insights: Joining a crypto community will give you a hangout place with similar
people and keep you updated on project development. Most crypto communities share new
trends, advancements, products, etc., to help you stay ahead and take action on time.
2. Learnings: These communities are made of crypto newbies, investors, traders, developers,
marketers, and others. So, if you ever get stuck on a topic, you’ll have experts available to
make things easier for you.
3. Networking: They allow you to connect with industry experts, well-known investors, and
developers. This can help you hold partnerships, collaborate, or build a project from scratch.
4. Technical Support: Crypto communities have a specific room for beginners or even
advanced users if they encounter bugs or face any issues. Community members also share
tips, and cheat sheets to help each other navigate such issues.
5. Exclusive Perks: Some crypto communities share exclusive access to events, offers,
giveaways, discounts, and even free access to products to keep members engaged.

Risks in crypto communities


As the saying goes, nothing comes without trade-offs, crypto communities also have their own
risks that you should know about.
Firstly, crypto communities are typically open to everyone, that means with genuine crypto
enthusiasts, scammers, and bots can also join the channel. These scammers can directly message
you, impersonating a contributor like a community. They often offer you benefits and share links
that can potentially risk your private information or wallet private keys, scamming you out of
funds.
There are other communities as well that might seem promising at first glance, but they are hidden
rug pulls. Simply, community members will create hype around the project and its future to pull
out investors’ money. So, one should always research thoroughly and watch out for all traps and
facts to make informed decisions while investing.

How to Join a Crypto Community?


Once you’ve decided on a crypto project community you want to check out, you can join them via
links on the project’s official sources. Here are a few platforms where you can interact with crypto
communities:
 Twitter: This place is the first stop for projects to share any relevant news and information.
You can participate in ongoing conversation threads and openly share your ideas with others.
 Telegram: You can search specific terms, coins, and projects on Telegram to explore public
communities. Here, you will have to look out for whether the community is actually genuine
and not a scam.
 Discord: This is the ultimate platform for crypto communities, here, you’ll have dedicated
rooms for every topic like technicals, marketers, etc, voice channels, and more. You can join
discord communities through invite links available on the project website.

29
 Reddit: You can find almost every topic relating to crypto on this platform, from beginners to
advanced, and it’s also a place where meme coins are born. You can follow up on specific
subreddits or tags to keep up with the latest news and developments.

Top Crypto Communities in 2023


 DeFi Million: It’s one of the well-known telegram communities among crypto traders, where
you can discuss specific crypto assets and receive free trade signals. Another thing this
community is known for is the pump and dump game, where investors buy tokens in bulk,
rocketing the price and selling it together for profit.
 ICO speaks: If you’re looking for a place to discuss tokens, coins, upcoming coin offerings,
airdrops, and token sales- then this group is best for all needs. ICO speaks also features
marketing services for new tokens to gain exposure in the market.
 Crypto hub: This group is a go-to place for beginners where they can start to explore more
of the crypto space. It features comprehensive guides and theme channels on subjects like
how to start trading, best wallets, new Ethereum projects, and more.
 Bitcoin Beginners: This forum has over thousands of members, and it’s specifically
about Bitcoin. It’s a nice group to gain insights and data on Bitcoin and get guidance on how
to begin in the crypto industry.
 Bitinning: Launched by popular Indian web3 educator Kashif Raza, this group is a wealth
of web3 learning and educational resources. Here, you will receive updates on podcasts and
interviews conducted by Kashif.

1.10 THE ETHEREUM FOUNDATION (EF)


The Ethereum Foundation is a non-profit entity that dedicates efforts to maximize the
development of Ethereum as a technology and community around the world.
About the Foundation:
The Ethereum Foundation (EF) is a non-profit organization dedicated to supporting Ethereum. The
EF describes itself as “not a tech company, or a ‘normal‘ non-profit. Just as Ethereum requires
new concepts and technologies, it has spawned new kinds of organizations. We are at the frontier
of a new kind of organization: one that supports a blockchain, without controlling it.” In other
words: The Ethereum Foundation is an organization dedicated to fostering and driving forward
Ethereum’s vision of a decentralized world without claiming ownership over Ethereum.

Nevertheless, until today the EF is the most influential organization within the Ethereum
ecosystem and its actions are closely followed across the crypto universe.

The EF’s mission is to secure Ethereum’s long-term success. It allocates resources to critical
projects, funds research, development, and education out of its massive treasury, is a valued voice
within the Ethereum community, and advocates for Ethereum to the world outside of blockchains.
Its goal is to empower developers to create next-generation decentralized protocols and lay the
foundation for a more free and trustless internet.

30
Who controls the Ethereum foundation?

The Ethereum Foundation is run by an executive board consisting of three people. Aya Miyaguchi
serves as the foundation’s executive director, with Vitalik Buterin and Patrick Storchenegger
completing the board. The foundation works closely with developer teams and the Ethereum
community.

The EF has no control over Ethereum but can allocate the foundation’s resources according to its
vision for Ethereum. Since a solo mission by the EF is likely to fail, the EF has to stay in close
contact with the Ethereum community to make sure their interests are aligned.

Who founded the Ethereum foundation?

The Ethereum Foundation was created in the summer of 2014 by Vitalik Buterin, Gavin Wood,
and other members of the Ethereum founding team. The non-profit organization was created to
govern the development efforts of Ethereum and to manage the organization’s treasury.

In February of 2014, the Ethereum team had already founded Ethereum Switzerland Ltd., a
registered company based in Zug, Switzerland, to manage the development of Ethereum under a
legal structure. To further fund the project, the team decided to conduct an online public crowd
sale — generally referred to as an ICO, which stands for Initial Coin Offering — from July to
August 2014. In this sale, investors could buy 2,000 Ether for 1 Bitcoin.

How much Eth does the ethereum foundation have?


According to their annual report, the Ethereum Foundation owns 0.297% of the total Ether supply,
which is approximately 350,000 Ether. The latest numbers can always be checked on EF’s
Ethereum wallet on Etherscan.

Additionally, the EF owns $300 million in non-crypto assets, which are mainly held in fiat
currencies. This ensures that the EF has sufficient resources and liquidity in case of a multi-year
market downturn without having to sell its ETH at unfavorable prices. The cash position has been
built by selling part of the foundation’s ETH holdings over recent years. Vitalik has proven to have
an exceptional ability to time the market, as he managed to convince the EF board twice to sell
large ETH positions at the market top, right before prices collapsed again.
How does the Ethereum foundation make money?

Ether, Ethereum’s native coin, was pre-mined at the launch of the Ethereum network on July 30,
2015. In total, 72 million Ether were created that day. Sixty million Ether went to the investors
that participated in the public pre-sale the year before, another 6 million were given to the creators
and developers of Ethereum, and the remaining 6 million Ether was deposited with the Ethereum
Foundation.

Since that day, the Ethereum Foundation has financed all its activities with this initial Ether
donation. Technically, the Ethereum Foundation does not currently make any money or receive
any cash flows from the Ethereum network. Nevertheless, in U.S.-dollar terms, the foundation is
much better off than at the beginning, thanks to the strong appreciation of Ether.

31
While the amount of Ether in their wallet is steadily decreasing, their treasury measured in U.S.
dollars has been steadily increasing. As long as the Ether price is appreciating, the foundation will
be able to sustain itself for many years to come. And with Ethereum’s switch from Proof-of-Work
to Proof-of-Stake, the foundation will be able to stake parts of its Ether holdings on the network
to generate a steady return in ETH, which might even be enough to pay for all their expenses in
the future.

What are Ethereum foundation grants?


Over the years, the EF has experimented with different strategies to move the Ethereum ecosystem
forward. This has led to a layered model, where many different groups are being involved in
decision-making about where to allocate resources and how to further develop Ethereum.
 The first layer are EF teams. These are groups that work within the EF to contribute directly
to the Ethereum ecosystem.
 The second layer are Grants. These are teams outside of the EF that are funded by the EF
for a specific purpose.
 The third layer are Delegated Domain Allocators. These outsider groups help to make
decisions about what to fund within specific domains.
 The final layer is Third-Party Funding. The EF gives money directly to outside third-party
groups and lets them decide how to allocate it effectively.
Ethereum Foundation, a Swiss nonprofit organization, is a worldwide team of passionate
developers. The Ethereum Foundation’s mission is to promote and support Ethereum platform and
base layer research, development and education to bring decentralized protocols and tools to the
world that empower developers to produce next generation decentralized applications (dapps), and
together build a more globally accessible, more free and more trustworthy Internet.

Ethereum Foundation Features


 Smart money, smart wallet.
 The Ethereum Wallet is a gateway to decentralized applications on the Ethereum
blockchain.
 It allows you to hold and secure ether and other crypto-assets built on Ethereum, as well as
write, deploy and use smart contracts.

Ethereum Foundation Services


 Build Unstoppable Applications. Ethereum is a decentralized platform that runs smart
contracts: applications that run exactly as programmed without any possibility of
downtime, censorship, fraud or third-party interference.
 Learn Solidity, A New Language for Smart Contracts. Create a tradeable digital token
that can be used as a currency, a representation of an asset, a virtual share, a proof of
membership or anything at all.
 Kickstart a Project with a Trustless Crowdsale. You can build a crowdfund to pre-sell
a product, a crowdsale to sell virtual shares in a blockchain organization, and an auction of
a limited number of items.
 Create a Democratic Autonomous Organization. You can build a virtual organization
where members vote on issues, a transparent association based on shareholder voting, your
own country with an unchangeable constitution, and a better delegative democracy.

32
 The role of this foundation is to dedicate efforts to promote the adoption, development
and research of solutions on Ethereum. But it also dedicates efforts to promoting
technologies related to this ecosystem.
Ethereum Foundation Philosophy
 The main philosophical ideal that drives the Ethereum Foundation is to maximize value
and all that Ethereum represents to the world. An ideal that they have maintained since its
inception and that they have been cultivating together with the community that contributes
and supports the Ethereum project.
 It has an important role in making decisions about the evolution of the cryptocurrency. But
very especially, in those related to research, development and community cultivation that
favors the ecosystem.
 The Ethereum Foundation has created and maintained a philosophy accepted by all its
parts, in order to encourage decentralization, free expression of ideas, coordination and
leadership within the project, organizing the project following the development model
"Bazar ”(Like that of free software projects like LibreOffice or the Linux kernel), instead
of“ Cathedral ”(like most proprietary software or free software projects like GCC).
With the "Bazaar" development model, what is sought is that people can see, review and improve
the project in a completely autonomous way, present their improvements, discuss them and include
them if they are really profitable or solve a problem for everyone within the company. community.
Something that in the "Cathedral" model would be quite difficult to achieve, due to the existence
of well-defined tasks and roles for each of the parts of the project that limit their access or work
within it.
In fact, the Ethereum Foundation represents its philosophy in four parts which are:
1. Instead of capturing opportunities, we distribute opportunities to others.
2. Rather than being defensive when others create value, we are delighted.
3. We don't want to import more; we try to import less.
4. Ultimately, any philosophy is only as good as the choices it inspires.

1.11 SMART CONTRACTS


Smart Contract:
A Smart Contract (or cryptocontract) is a computer program that directly and automatically
controls the transfer of digital assets between the parties under certain conditions. A smart
contract works in the same way as a traditional contract while also automatically enforcing the
contract. Smart contracts are programs that execute exactly as they are set up(coded,
programmed) by their creators. Just like a traditional contract is enforceable by law, smart
contracts are enforceable by code.
 The bitcoin network was the first to use some sort of smart contract by using them to transfer
value from one person to another.
 The smart contract involved employs basic conditions like checking if the amount of value
to transfer is actually available in the sender account.
33
 Later, the Ethereum platform emerged which was considered more powerful, precisely
because the developers/programmers could make custom contracts in a Turing-complete
language.
 It is to be noted that the contracts written in the case of the bitcoin network were written in
a Turing-incomplete language, restricting the potential of smart contracts implementation in
the bitcoin network.
 There are some common smart contract platforms like Ethereum, Solana,
Polkadot, Hyperledger fabric, etc.

History:
In 1994, Nick Szabo, a legal scholar, and a cryptographer recognized the application of a
decentralized ledger for smart contracts. He theorized that these contracts could be written in
code which can be stored and replicated on the system and supervised by the network of
computers that constitute the blockchain. These smart contracts could also help in transferring
digital assets between the parties under certain conditions.

Features of Smart Contracts


The following are some essential characteristics of a smart contract:
1. Distributed: Everyone on the network is guaranteed to have a copy of all the conditions of
the smart contract and they cannot be changed by one of the parties. A smart contract is
replicated and distributed by all the nodes connected to the network.
2. Deterministic: Smart contracts can only perform functions for which they are designed only
when the required conditions are met. The final outcome will not vary, no matter who
executes the smart contract.
3. Immutable: Once deployed smart contract cannot be changed, it can only be removed as
long as the functionality is implemented previously.
4. Autonomy: There is no third party involved. The contract is made by you and shared
between the parties. No intermediaries are involved which minimizes bullying and grants
full authority to the dealing parties. Also, the smart contract is maintained and executed by
all the nodes on the network, thus removing all the controlling power from any one party’s
hand.
5. Customizable: Smart contracts have the ability for modification or we can say customization
before being launched to do what the user wants it to do.
6. Transparent: Smart contracts are always stored on a public distributed ledger called
blockchain due to which the code is visible to everyone, whether or not they are participants
in the smart contract.
7. Trustless: These are not required by third parties to verify the integrity of the process or to
check whether the required conditions are met.
8. Self-verifying: These are self-verifying due to automated possibilities.
9. Self-enforcing: These are self-enforcing when the conditions and rules are met at all stages.

Capabilities of Smart Contracts


1. Accuracy: Smart contracts are accurate to the limit a programmer has accurately coded them
for execution.
2. Automation: Smart contracts can automate the tasks/ processes that are done manually.

34
3. Speed: Smart contracts use software code to automate tasks, thereby reducing the time it
takes to maneuver through all the human interaction-related processes. Because everything
is coded, the time taken to do all the work is the time taken for the code in the smart contract
to execute.
4. Backup: Every node in the blockchain maintains the shared ledger, providing probably the
best backup facility.
5. Security: Cryptography can make sure that the assets are safe and sound. Even if someone
breaks the encryption, the hacker will have to modify all the blocks that come after the block
which has been modified. Please note that this is a highly difficult and computation-intensive
task and is practically impossible for a small or medium-sized organization to do.
6. Savings: Smart contracts save money as they eliminate the presence of intermediaries in the
process. Also, the money spent on the paperwork is minimal to zero.
7. Manages information: Smart contract manages users’ agreement, and stores information
about an application like domain registration, membership records, etc.
8. Multi-signature accounts: Smart contracts support multi-signature accounts to distribute
funds as soon as all the parties involved confirm the agreement.

How Do Smart Contracts Work?

A smart contract is just a digital contract with the security coding of the blockchain.
 It has details and permissions written in code that require an exact sequence of events to take
place to trigger the agreement of the terms mentioned in the smart contract.
 It can also include the time constraints that can introduce deadlines in the contract.
 Every smart contract has its address in the blockchain. The contract can be interacted with
by using its address presuming the contract has been broadcasted on the network.
The idea behind smart contracts is pretty simple. They are executed on a basis of simple logic,
IF-THEN for example:
 IF you send object A, THEN the sum (of money, in cryptocurrency) will be transferred to
you.
 IF you transfer a certain amount of digital assets (cryptocurrency, for example, ether,
bitcoin), THEN the A object will be transferred to you.
 IF I finish the work, THEN the digital assets mentioned in the contract will be transferred
to me.
Note: The WHEN constraint can be added to include the time factor in the smart contracts. It
can be seen that these smart contracts help set conditions that have to be fulfilled for the terms
of the contract agreement to be executed. There is no limit on how much IF or THEN you can
include in your intelligent contract.

35
Smart Contract Working

1.7. Process of Smart contract

 Identify Agreement: Multiple parties identify the cooperative opportunity and desired
outcomes and agreements could include business processes, asset swaps, etc.
 Set conditions: Smart contracts could be initiated by parties themselves or when certain
conditions are met like financial market indices, events like GPS locations, etc.
 Code business logic: A computer program is written that will be executed automatically
when the conditional parameters are met.
 Encryption and blockchain technology: Encryption provides secure authentication and
transfer of messages between parties relating to smart contracts.
 Execution and processing: In blockchain iteration, whenever consensus is reached between
the parties regarding authentication and verification then the code is executed and the
outcomes are memorialized for compliance and verification.
 Network updates: After smart contracts are executed, all the nodes on the network update
their ledger to reflect the new state. Once the record is posted and verified on the blockchain
network, it cannot be modified, it is in append mode only.

Applications of Smart Contracts

1. Real Estate: Reduce money paid to the middleman and distribute between the parties
actually involved. For example, a smart contract to transfer ownership of an apartment once
a certain amount of resources have been transferred to the seller’s account(or wallet).
2. Vehicle ownership: A smart contract can be deployed in a blockchain that keeps track of
vehicle maintenance and ownership. The smart contract can, for example, enforce vehicle
maintenance service every six months; failure of which will lead to suspension of driving
license.
3. Music Industry: The music industry could record the ownership of music in a blockchain.
A smart contract can be embedded in the blockchain and royalties can be credited to the
owner’s account when the song is used for commercial purposes. It can also work in
resolving ownership disputes.
36
4. Government elections: Once the votes are logged in the blockchain, it would be very hard
to decrypt the voter address and modify the vote leading to more confidence against the ill
practices.
5. Management: The blockchain application in management can streamline and automate
many decisions that are taken late or deferred. Every decision is transparent and available to
any party who has the authority(an application on the private blockchain). For example, a
smart contract can be deployed to trigger the supply of raw materials when 10 tonnes of
plastic bags are produced.
6. Healthcare: Automating healthcare payment processes using smart contracts can prevent
fraud. Every treatment is registered on the ledger and in the end, the smart contract can
calculate the sum of all the transactions. The patient can’t be discharged from the hospital
until the bill has been paid and can be coded in the smart contract.

Example Use cases:


1. Smart contracts provide utility to other contracts. For example, consider a smart contract that
transfers funds to party A after 10 days. After 10 days, the above-mentioned smart contract
will execute another smart contract which checks if the required funds are available at the
source account(let’s say party B).
2. They facilitate the implementation of ‘multi-signature’ accounts, in which the assets are
transferred only when a certain percentage of people agree to do so
3. Smart contracts can map legal obligations into an automated process.
4. If smart contracts are implemented correctly, can provide a greater degree of contractual
security.

Advantages of Smart Contracts

1. Recordkeeping: All contract transactions are stored in chronological order in the blockchain
and can be accessed along with the complete audit trail. However, the parties involved can
be secured cryptographically for full privacy.
2. Autonomy: There are direct dealings between parties. Smart contracts remove the need for
intermediaries and allow for transparent, direct relationships with customers.
3. Reduce fraud: Fraudulent activity detection and reduction. Smart contracts are stored in the
blockchain. Forcefully modifying the blockchain is very difficult as it’s computation-
intensive. Also, a violation of the smart contract can be detected by the nodes in the network
and such a violation attempt is marked invalid and not stored in the blockchain.
4. Fault-tolerance: Since no single person or entity is in control of the digital assets, one-party
domination and situation of one part backing out do not happen as the platform is
decentralized and so even if one node detaches itself from the network, the contract remains
intact.
5. Enhanced trust: Business agreements are automatically executed and enforced. Plus, these
agreements are immutable and therefore unbreakable and undeniable.
6. Cost-efficiency: The application of smart contracts eliminates the need for
intermediaries(brokers, lawyers, notaries, witnesses, etc.) leading to reduced costs. Also
eliminates paperwork leading to paper saving and money-saving.

37
Challenges of Smart Contracts

1. No regulations: A lack of international regulations focusing on blockchain technology(and


related technology like smart contracts, mining, and use cases like cryptocurrency) makes
these technologies difficult to oversee.
2. Difficult to implement: Smart contracts are also complicated to implement because it’s still
a relatively new concept and research is still going on to understand the smart contract and
its implications fully.
3. Immutable: They are practically immutable. Whenever there is a change that has to be
incorporated into the contract, a new contract has to be made and implemented in the
blockchain.
4. Alignment: Smart contracts can speed the execution of the process that span multiple parties
irrespective of the fact whether the smart contracts are in alignment with all the parties’
intention and understanding.

Differences between Smart Contracts and Traditional Contracts


Factor Smart Contracts Traditional Contracts
Legally binding only if they are in
A legally binding agreement that
Legality compliance with the applicable
is enforceable in court.
laws.
Automatically executed and
Executed and enforced through
Execution enforced when the terms of the
the court system.
contract are met.
Can be validated by anyone in the Valid only if both parties agree
Validity
blockchain network. and sign the contract.
Easily modified and amended
Modification Difficult to modify once deployed. with mutual consent of both
parties.
Records stored on a blockchain Records stored in paper form or
Record Keeping
and can be viewed publicly. digitally, not publicly available.
Require the use of third-party
Cost-effective due to the removal
Cost intermediaries, making them more
of third-party intermediaries.
expensive.
Highly secure as they are stored on Less secure as they are stored in
Security
a blockchain. paper form or digitally.
Highly transparent as all involved Not transparent as only the parties
Transparency
parties can view the blockchain. involved can view the agreement.
Tracing activities is difficult as the
All activities are traceable on the
Traceability contract is stored in paper form or
blockchain.
digitally.
Automated and accurate due to the Manual and prone to errors due to
Accuracy
use of code. human involvement.

38
A Simple Smart Contract:
Smart contracts form the basis for all dApps built on the blockchain, and they're typically written
in custom languages such as Solidity (for Ethereum) or Cadence (for Flow).
They tend to be much simpler than traditional programs, but the risks are much higher - a
single smart contract bug can lead to millions of dollars being drained in minutes!

The tools you need to code and deploy your first smart contract, including:
Metamask: A software cryptocurrency wallet used to interact with the Ethereum blockchain,
that will allow you to pay for the gas to publish your transaction.
Solidity: An object-oriented programming language for implementing smart contracts on
Ethereum.
Hardhat: An Ethereum development environment that allows you to compile Solidity
contracts, test contracts on a dev network, and view Solidity stack traces.
Etherscan: An online blockchain explorer that allows you to view transactions, blocks, and
wallet states on a public blockchain.
Alchemy: A web3 developer platform that allows you to connect with the rest of the Ethereum
network via free nodes.

Different Smart Contract Platforms


While most smart contracts are built on Ethereum, other blockchains support smart contracts too.
This includes Solana (SOL), Polkadot (DOT), BNB Chain, and more. However, Ethereum
remains the most popular smart contract protocol.

There are different languages for smart contract deployment.


 Solidity is a programming language designed to allow developers to create smart contracts.
Solidity is based on existing programming languages like C++, JavaScript, and Python.
Solidity runs on the Ethereum virtual machine (EVM).
 Rust is a fast and memory-efficient programming language that is used to build scalable
protocols. Rust supports smart contract blockchains such as Solana, Polkadot, and Near
blockchain. JavaScript is a general-purpose programming language that is mostly used by
developers new to the blockchain space to enable them to start building decentralized
products quickly. The programming language is used in Hyperledger Fabric, Solana, or the
Icon blockchain.
 Vyper is a Python-like programming language that is contract-oriented and targets the
Ethereum virtual machine (EVM). Vyper was built to improve on the security issues of
Solidity.
 Finally, Yul is an intermediate programming language that is used by Solidity and
addresses the needs of different backends. Yul is already used in most Ethereum-based
projects.

39
How to Create Your First Smart Contract?
Steps to Create and Deploy a Smart Contract
Step 1: Connect to the Ethereum network.
You can connect to the Ethereum mainnet by downloading and installing a MetaMask wallet on
your Chrome browser and enabling it. Once you have completed the setup, proceed to connect it
to the Ethereum mainnet.

Step 2: Choose a test network.


You will find a list of test networks in your Metamask wallet. Select one, which will be used to
test the smart contract you are building. The test networks include:

 Robsten Test network


 Rinkeby Test network
 Kovan Test network
 Goerli Test network.

Step 3: Fund your wallet with Testnet ETH.


Eventually, when you are ready to test your smart contract, you will need to have Testnet ETH in
your wallet. Fortunately, the process of adding Testnet ETH in MetaMask is straightforward. Click
on the “Deposit” and “Get Ether” buttons under the Test Faucet and proceed with the instructions.

Step 4: Use the Remix browser to write your smart contract.


You can use the editor in Remix browser IDE to write your smart contract in Solidity. Remix
browser is the best option for writing smart contracts as it comes with several features and is
usually used to write basic smart contracts.

Step 5: Create a .sol extension file.


Open the Remix Browser and click on the (+) icon on the left side to create a .sol extension. This
makes any programmed file solidity-compatible.

Step 6: Complete your smart contract code.


Choose a version of the compiler from the Remix browser and compile the solidity smart contract
code.

Step 7: Deploy the smart contract.


Deploy the smart contract on your selected Ethereum test network by clicking on the deploy button
on the Remix browser. Once the transaction is complete, the address of the smart contract will
appear on the right-hand side of the Remix browser.

40
Step 8: Make smart contract ready to go live.
To prepare a smart contract to go live on a blockchain, procedures such as testing or auditing are
strongly recommended, besides other considerations. Once reassured that the smart contract is
ready to hit the market, the smart contract can be deployed to the Ethereum mainnet.

1.12 DAPPS
What is DApp?
A decentralized application (DApp) is a type of distributed, open source software application that
runs on a peer-to-peer (P2P) blockchain network rather than on a single computer. DApps are
similar to other software applications that are supported on a website or mobile device, but they're
P2P supported. DApps are considered part of Web3, the present evolution of the World Wide Web.
 DApps in blockchain are ostensibly similar to any relative web or mobile app. However, this
relates more to their front-end, while under the hood as part of their back-end, are decentralization
and smart contracts.
 The decentralized nature of DApps means that, once a developer has released a
DApp's codebase, others can build on top of it. The app is not controlled by a single
authority. DApp development creates a variety of applications, including those for
decentralized finance, web browsing, gaming and social media.
 DApps are built on a decentralized network supported by a blockchain distributed ledger.
The use of blockchain means a DApp can process data through distributed networks and
execute transactions. DApps are often built using the Ethereum platform.
 Distributed ledger technologies, such as the Ethereum blockchain, have helped popularize
DApps. The major advantages of DApps are that they're always accessible and have no
single point of failure.

How DApps work?


A dApp has a backend code running on a decentralized peer-to-peer network. It can also have a
frontend code and a user interface that can be written in any language just as it is done for normal
applications. The front end can be hosted on any decentralized server like IPFS.
Decentralized apps have the following three key attributes:
 Open source. This requires the codebase to be available to all users for evaluation, and
changes require a consensus of the majority of users.
 Decentralized storage. Data is stored on decentralized blocks.
 Cryptographic support. The decentralized blocks of data are validated and proven true.

dApps work in a manner similar to normal applications except for the few differences that are
discussed below:
The dApp working has the following features:
 Decentralized: A dApp operates on Ethereum which is an open public decentralized
platform.
 Deterministic: dApps perform the same function irrespective of the environment in which
they are executed.
 Turing complete: dApps can perform any action given the required resources.

41
 Isolated: dApps are executed in an Ethereum Virtual Machine which is a virtual environment
that ensures that even if there is a bug in the smart contract, it won’t hamper the normal
functioning of the blockchain network.

 DApps are stored and executed on a blockchain system, commonly using the Ethereum
network. Apps are validated with cryptographic tokens, which are needed for application
access.
 DApps are similar to conventional apps in the front-end code they use to render a webpage.
But their back-end code is different; it runs on a decentralized peer network. This removes
DApps from the control of a single authority.
 While centralized servers and databases support a traditional application, a smart
contract stored on a blockchain supports a DApp. Ethereum is the most popular blockchain
for running smart contracts, which enforce rules defined in the code and mediate
transactions. A smart contract consists of the back end only and is often just a small part
of the whole DApp. Therefore, creating a decentralized app on a smart contract system
requires combining several smart contracts and using third-party systems for the front end.
 The blockchain that a smart contract runs on is a ledger of data records stored in blocks as
opposed to a central location. The blocks of data remain dispersed across distributed
locations; all the data blocks are linked and ruled by cryptographic validation in the
ecosystem.
 Not all DApps work on standard web browsers; some may work only on websites with
customized code to open that specific application.

Most Common Platforms for Creating DApps

There are many Blockchain platforms created by various companies. While the most popular
and commonly heard one is Bitcoin, there are many others that are used to create dApps. These
Blockchain platforms are further used as a base to create dApps. So let’s see some of these now:
1. Ethereum: Ethereum is the most popular decentralized, open-source blockchain in the world
currently. It is used as the base for many Blockchain projects, including more than 2500
dApps. In fact, Ethereum is only second to Bitcoin in terms of its market value. Ethereum
also has a native cryptocurrency known as BTH which is their version of Bitcoin. All in all,
this is an excellent option for creating a dApp although it’s a bit expensive.
2. NEO: NEO is also a decentralized, open-source blockchain that aims to create a smart
economy. It is also called the Chinese Ethereum and provides better options for scalability
in dApps as compared to other Blockchain platforms. NEO is currently less popular than
Ethereum with only about 100 dApps built using this technology. It’s also quite expensive
and can even charge higher fees than Ethereum in some cases.
3. TRON: TRON is a comparatively new Blockchain platform as compared to Ethereum or
NEO. However, it’s quite popular and may even become a competitor to Ethereum in the
future. TRON is particularly famous for gaming applications and gambling sites. There are
around 1500 dApps created using this platform which makes it an excellent choice.

42
Popular DApps

Below are some of the popular dApps:


1. CryptoKitties: CryptoKitties is a fun app that is used for entertainment. You can buy kitties
on the app using cryptocurrency and then breed and sell them at a profit. Apparently, cute
cats are popular everywhere, even on Blockchain because CryptoKitties was once
responsible for 10% of Ethereum transactions daily.
2. OpenSea: Open Sea is a dApp that encourages interaction between various games based on
Blockchain. Gamers can exchange their collectibles from any cryptocurrency-based game on
OpenSea. Currently, this dApp supports collectibles from Ethereum only, but they plan to
expand in the future.
3. WINk: WINk is the most popular dApp for gambling-based games in the market. It included
everything from poker to dice games to sports betting. WINk is based on the TRON platform
and the winners in betting get WIN tokens which can then be exchanged for BTT which is a
sort of cryptocurrency like Bitcoin.
4. IPSE: IPSE or InterPlanetary Search Engine is actually a search engine with Blockchain as
its base. IPSE is based on the EOS blockchain and it uses the InterPlanetary File System
(IPFS) which is an improvement over HTTP on the internet. A big advantage of IPSE over
other conventional search engines is that it guarantees security and privacy on the internet.
5. Blockchain Cuties: For anyone interested in CryptoKitties, Blockchain Cuties is a great
option. It allows you to focus on multiple cue animals like puppies, bear cubs, lizards, etc.
apart from kitties. Blockchain Cuties is a dApp that is accessible using multiple Blockchain
platforms like Ethereum, NEO, TRON, etc., unlike CryptoKitties which favors Ethereum
only.

Benefits of decentralized applications


Decentralized applications provide several benefits, including the following:
 Fault tolerance. If a single network is working, a decentralized platform can remain available,
though performance may be severely hampered. Unable to target a centralized network, a
hacker would struggle to attack enough nodes to take down a DApp.
 Data integrity. Data stored on a blockchain is immutable and secure because
blockchain consensus algorithms ensure data stored in the blockchain is resistant to change.
 Flexible platform. The flexibility of Ethereum blockchain accommodates quick development
of DApps for different industries.
 User privacy. Users need not submit personal information to DApps to use app-specific
functionality.
 Verifiable behavior: Smart contracts can be analyzed and are guaranteed to execute in
predictable ways without a need from monitoring or involvement from a central authority.

dApp Architecture
Below are the components of the dApp architecture:
 Ethereum blockchain.
 Smart Contracts.
 Ethereum Virtual Machine (EVM).
 Front-end.

43
Let’s discuss the components in detail: The following Fig.1.8.diagram shows what the actual
architecture of DApp looks like:
 1. Ethereum blockchain: Ethereum is a decentralized and open-source blockchain
platform that establishes a peer-to-peer network that securely executes and verifies
application code, called smart contracts. Decentralized applications have their backend
code (smart contracts) running on a decentralized network and not a centralized server.
DApps use the Ethereum blockchain for data storage.
 2. Smart Contracts: DApps use smart contracts to define the state changes happening
on the blockchain. A smart contract is a collection of code and data that resides at a
specific address on the Ethereum Blockchain and runs on the Ethereum blockchain. They
are written in high-level languages such as Solidity and Vyper.

Fig. 1.8. DApp Architecure


 3. Ethereum Virtual Machine(EVM): The Ethereum Virtual Machine is the global
virtual computer that executes the logic defined in the smart contracts and processes the
state changes that happen on this Ethereum network.
 4. Front-end: The front-end is the part of the DApps users can see and interact with such
as the graphical user interface(GUI), but the front-end also communicates with the
application logic defined in smart contracts.

44
Communication between Frontend and Smart Contract on Ethereum
To invoke functions the front end needs to communicate with smart contracts. But Ethereum is
a decentralized network. Every node in the Ethereum network keeps a copy of all states on the
Ethereum Virtual machine, including the data and code associated with every smart contract.

It is required to interact with one of these nodes to interact with the data and the code on the
blockchain. This is because any node can broadcast a request for a transaction to be executed on
the EVM. Then the job of a miner is to execute the transaction and propagate the resulting state
change to the network. The transaction can be broadcasted in two ways:
1. Set up the node which runs the Ethereum blockchain software.
2. Use nodes provided by third-party services.

Why Use Third-party Services?


When third-party services are used there is no need to run a full node yourself. Setting up a new
Ethereum node on the server can take much time. Moreover, more nodes need to be added to
expand your infrastructure and the cost of storing the full Ethereum blockchain goes up as DApp
scales. The nodes one connects with to interact with the blockchain are often called “providers.”

Fig.1.9. Communication Between Frontend and Smart Contract On Ethereum

45
 Ethereum provider (i.e. nodes) implements a JSON-RPC specification. This ensures that
there’s a uniform set of methods when our frontend applications want to interact with the
blockchain.
 One can read the state stored on the blockchain once connected to the blockchain through a
provider.
 But if one wants to write to the state before one can submit the transaction to the blockchain
there’s one more thing that needs to be done and the thing is “sign” the transaction using the
private key.
 Whenever the front end needs the user to sign a transaction, it calls on Metamask. Here
Metamask plays the role of the signer.

The role of Metamask in Dapp Architecture

 Metamask is a browser plugin that serves as an Ethereum wallet. we know that the Ethereum
blockchain is a network and we need a special browser extension to connect that network.
 Metamask will allow us to connect the blockchain with our personal account and interact
with the smart contract.
 A user’s private keys are stored by Metamask in the browser, and when a user wants to write
to the state, the user needs to “sign” the transaction using the private key.

Fig.1.10. Role of metamask in DApp architecture

 Metamask acts both as a provider and a signer because Metamask provides a connection to
the blockchain (as a “provider”) and since it needs it to sign transactions that’s why it is also
a signer.

Drawbacks of decentralized applications


Decentralized applications also have the following weaknesses:
 Maintenance. Fixes require the use of a consensus mechanism to ensure agreement among all
peers in the blockchain-based network, which complicates DApp maintenance, debugging and
updates.
 Scale. Decentralized networks are harder to scale than centralized ones.
 Network congestion. If a DApp uses too many resources, it can bog down the whole network.
 User experience. Developers can have difficulty creating a user-friendly experience for DApp
end users. With a DApp, users need a public and private key to log in versus a username and
password for a traditional app.

46
 Performance Overhead: There is a lot of performance overhead to achieve the level of
security, transparency, and integrity that Ethereum desires. Even the proof-of-work takes a
lot of time and computational resources.
 Centralization: Developing user-friendly, developer-friendly applications on top of
Ethereum may end up developing a centralized service. Centralization may eliminate all the
good features of the blockchain over the traditional model.

DApp scams
The decentralized nature of DApps makes it difficult to track scams and hold perpetrators
accountable. Users must exercise caution to avoid dApp scams such as the following:
 Ponzi schemes and fake initial coin offerings, which are the cryptocurrency equivalent of
an initial public offering.
 Phishing attacks that trick users into revealing sensitive financial information.
 Malware and data theft.
 Exit scams where DApps build trust with a community and solicit fundraising before
abandoning a project with users' investments and data.
 Pump and dump schemes in which traders create excitement and hype around a DApp to drive
the price to an unsustainable price before selling their shares and crashing the stock.
 Smart contract vulnerabilities that can enable attackers to drain funds from a contract.

Comparing centralized vs. decentralized apps


Centralized apps operate on servers controlled by a single entity, meaning the application software
is owned and controlled by its owner or company. In contrast, DApps use blockchain and P2P
networks that work without a central authority.
With centralized apps, users have separate versions of the app and communicate with one another
through a company's server. With DApps, users communicate directly with one another. This
communication includes financial transactions executed without intermediaries and cross-chain
bridge communication.

Fig.1.11. Comparison between centralized vs. decentralized apps

47
Examples and use cases of DApps
Thousands of DApps have been developed and are in use. The following are three examples:
 Chainlink is middleware that provides tamper-proof inputs, outputs and computations for
Oracle networks. Google uses it for its BigQuery platform-as-a-service data warehouse.
 TraceDonate is a service that connects charities and donors to beneficiaries with the goal of
building trust that donations reach those in need. Funds are kept in a digital wallet and let the
donor track how the donation is spent.
 Minds is a DApp-based social media platform that runs on open source code and encrypts all
personal data that users send.

Here are some common ways DApps is used:


 Financial services. DApps facilitate crypto and other P2P financial transactions, enabling
secure, efficient cross-border payments and decentralized lending.
 Gaming. Blockchain-based games let players trade in-game assets as non-fungible tokens,
which are secured on the blockchain, providing verifiable ownership and scarcity.
 Social networks. Decentralized social media platforms empower users by giving them control
over their data and eliminating the risk of censorship. DApp platforms, like Hooked, let users
interact and share content without any central authority.
 Supply chain management. DApps can improve supply chain management by providing
transparency and traceability. Blockchain-based approaches enable real-time tracking of
goods, preventing fraud and ensuring the authenticity of products.
 Music. DApp services, such as Audius. rewards users with social tokens for uploading original
music, interacting with other musicians and sharing songs online. Users can buy songs with
their social tokens, which also double as governance tokens that let them vote on proposed
changes to Audius.
 Identity verification. Blockchain-based DApps securely store and verify identity information,
eliminating the need for centralized databases. They support voter registration, passport
applications and other identity-dependent processes.
 Healthcare. DApps also securely store and share patient records, facilitating interoperability
among healthcare providers and enabling secure collaboration.

1.13. DAOs (Decentralized Autonomous Organization)

What is a DAO?
The acronym DAO comes from “Decentralized Autonomous Organization”. A DAO is a type of
organization that is managed and controlled by smart contracts. These contracts are
computational algorithms in the blockchain network that determine the protocols or rules of
collaboration of each party involved. The use of blockchain allows these organizations to be
autonomous, transparent and secure.

Origin of the DAO


 DAO stands for Decentralized Autonomous Organization.
 A decentralized autonomous organization is decentralized, autonomous, and an
organization- as the name already suggests. It is a whole organization that is automated. It
stores rules and processes in code. DAOs are often stateless and distributed over millions of
computers. No single government could decide to take it down.

48
 The concept of a DAO was first proposed by Bit Shares, Steemit, and EOS (Block. one)
founder Dan Larimer in the year 2015, and was further refined in the year 2016 by
Ethereum’s Vitalik Buterin.
 In 1997, Professor Werner Dilger, presented his work “Decentralized autonomous
organization of the intelligent home according to the principle of the immune system”. This
is considered the first time that the concept of DAOs was exposed.
 In the project, although blockchain technology did not yet exist, Dilger defined the bases of
the DAO as a self-sustaining and autonomous system.
 It wasn’t until 2013 that someone talked about this concept. It was Daniel Larimer, founder
of BitShares and Steem, who spoke about Decentralized Autonomous Companies (DAC) in
the Let’s Talk Bitcoin!
 In 2015, Vitalik Buterin relaunched the concept with the launch of Ethereum. The Ethereum
network allowed for the first time to create advanced transparent and immutable codes. This
was the first big step in creating real DAOs.

Fig.1.12. Representation of DAO


Components of DAO:
1. No central legal entity: In DAO, there is no central legal entity, this means that no single
entity is responsible for regulating the project.
2. Self-enforcing code: Smart contracts are created and extensively tested to make sure
important details are not overlooked.
3. Token acts as an incentive for validators: Tokens are used in DAO for validators to
motivate them and to ensure active, fair, and quick participation.

Why do we Need of DAO?


Beginning an association with somebody that includes financing and cash requires a great deal
of confidence in the individuals you’re working with. Yet, it’s difficult to believe somebody
you’ve just at any point associated with on the web. With DAOs you do not need to trust the
other individual within the gathering, simply the DAO’s code, which is 100% straightforward
and evident by anybody. This opens up countless new freedoms for worldwide joint effort and
coordination.

49
Traditional Organization Vs DAO

S No. DAO Traditional Organizations


Casting a ballot is needed by Depending on the structure, changes can be
1 individuals for any progressions to requested from the sole party, or casting a
be implemented. ballot might be advertised.
Votes were counted, and results If casting a ballot is permitted, votes are
2 were carried out consequently counted inside, and the result of casting a
without a believed intermediary. ballot should be taken care of physically.
3 Completely democratized. Usually progressive.
Administrations offered are taken Requires human taking care of, or halfway
4 care of consequently in a controlled mechanization, inclined to
decentralized way. control.
All activity is transparent and fully Activity is typically private, and limited to
5
public. the public.

Steps for Launching a DAO

There are three major steps for launching a DAO:


1. Smart Contract Creation: In this step, a developer or a group of developers create a smart
contract behind the DAO. It is very important for the developer to extensively test the smart
contracts before launching to make sure that they do not overlook important details. After
launch, only the rules set can be changed through the governance system.
2. Funding: After smart contracts are created and launched, the DAO needs to determine a way
to receive funding. Sometimes, the tokens are sold to raise funds. These tokens give holders
voting rights.
3. Deployment: Once everything is set up and on track, the DAO needs to be deployed on the
blockchain. From this point onwards, stakeholders decide the future of the organization. The
developers who created the smart contracts, no longer influence the project.

Fig.1.13. Steps for launching a DAO


DAO Examples
Here are some examples illustrating how DAO can be utilized:
1. DASH: The well-known computerized money Dash is an illustration of a decentralized
independent association in light of the manner in which it is represented and the manner in
which its planning framework is organized.
2. A cause: One can acknowledge enrollment and gifts from anybody on the planet and the
gathering can choose how they to spend gifts.

50
3. A consultant organization: One can make an organization of workers for hire who pool
their assets for office spaces and programming memberships.
4. Adventures and awards: It is possible to make an endeavor store that pools speculation
capital and decisions on dares to back. Reimbursed cash could later be rearranged among
DAO individuals.

How Do DAOs Work?

So far we are using people to “store” information instead. In order to know how much hiring a
new person would cost? – There is a person answerable in the human resources department.
Similarly, to get movement costs repaid?- There is a separate person responsible for this in the
accounting.

Fig.1.14. Creation of DAO


DAOs are based on protocols (smart contracts) stored in blockchain technology. Consequently,
these organizations are autonomous, transparent and secure.
Below we see the steps to follow for the creation and maintenance of a decentralized autonomous
organization:
1. Creation of smart contracts: The organization developers, first of all, must define and code
the smart contracts that will serve as the basis of the DAO.
2. Define the governance of the organization: Secondly, developers need to define governance
tokens. These will allow determine the rules of monetization, rewards or penalties.
3. Launch of the DAO: Once the smart contracts are implemented, the DAO is launched with the
same stakes so that there is no imbalance of power. The amount of tokens that a user has will
determine the weight in the voting.
4. Possible changes in the rules of the DAO: In the event that the community wants to change
the DAO rules, it can only be done through a community vote. That is, in a decentralized way.
Also, potential money raised by the DAO cannot be spent unless it is approved by the community.
Since the smart contracts are on the blockchain network, any member will have access to these
contracts.
 In a DAO, there is a code for that. Computers will take over much of the decision-making
and operations we see nowadays. The final control, however, is still with humans, the

51
shareholders. Shareholders have voting rights just like in regular corporations. They dictate
the general direction and accept or decline initiatives.
 The general idea is to bring the benefits of blockchain technology to management.
 The blockchain is immutable, precise, and consistent. It is also transparent and open so that
anyone could review companies. Strong consistency makes DAOs reliable business partners.
 Such an organization is also harder to put under pressure. It will be difficult to ban it from
operating somewhere. As it is controlled by the organization members and not influenced by
a central government authority to put under pressure.

DAO Membership

There are various models for DAO membership. Membership can decide how casting ballot
functions and other key pieces of the DAO.
1. Token-based membership: Normally completely permissionless, contingent upon the token
utilized. For the most part, these administration tokens can be exchanged for permissionless on
a decentralized trade. Others should be procured by giving liquidity or another ‘evidence of
work’. In any case, just holding the symbolic awards admittance to casting a ballot. Ordinarily
used to administer expansive decentralized conventions as well as tokens themselves.
Example: MakerDAO’s token MKR is generally accessible on decentralized trades. So anybody
can become tied up with having cast a ballot power on the Maker convention’s future.
2. Share-based membership: Offer-based DAOs are more allowed, yet at the same time very
open. Any imminent individuals can present a proposition to join the DAO, typically offering
recognition of some worth as tokens or work. Offers to address direct democratic force and
possession. Individuals can exit whenever with their proportionate portion of the depository.
Regularly utilized for all the nearer sew, human-driven associations like foundations, laborer
assemblages, and venture clubs. Can administer conventions and tokens too.
Example: MolochDAO is centered around financing Ethereum projects. They require a
proposition for enrollment so the gathering can evaluate whether you have the important mastery
and funding to make educated decisions about possible grantees. You can’t simply purchase
admittance to the DAO on the open market.

Ethereum and DAOs


Ethereum is the ideal establishment for DAOs for various reasons:
 Ethereum’s own agreement is conveyed and set up enough for associations to trust the
organization.
 The agreement code can’t be changed once live, even by its proprietors. This permits the
DAO to run by the principles it was modified with.
 Agreements can send/get reserves. Without this, there is a need for a believed delegate to
oversee a bunch of reserves.
 The Ethereum people group has demonstrated to be more synergistic than cutthroat, taking
into consideration best practices and emotionally supportive networks to arise rapidly.

52
Benefits of DAOs
A DAO can do the following:
 Automate the financial processes associated with a distributed organization;
 Speed up the fundraising process for a new idea;
 Ensure that everyone gets a fair vote in the organization;
 Streamline distribution of returns and gains; and
 Improve visibility into rules for allocating investments and decisions.

Downsides/Risk of DAOs
However, a DAO carries these downsides and risks:
 Automated smart contracts can be difficult to change when a problem is discovered.
 Hackers can discover loopholes to legally misappropriate funds against the interests of
shareholders.
 Participants can pay high transaction fees of up to $100 per transaction in early DAOs.
 Humans are still required to execute physical and legal processes, which can thwart the intent
of the DAO.
 Governments are still sorting out the legal status of DAOs, which presents tax and legal risks
for investors.

Advantages of DAO
1. Decentralization: DAO emphasizes being driven by a collective rather than an individual.
With DAO, participants have a much stronger say in the organization’s direction.
2. Community Driven: DAOs make it easy for communities worldwide to connect and build
a prospering vision together. DAO is accessible to Individuals who may have had the
opportunity in the past to connect and work together.
3. Principle-agent dilemma: One of the main advantages of DAO is that it provides a solution
for the principle-agent dilemma. This dilemma is a conflict in priorities between a person
(principle) and the entities making decisions on their behalf (agent). One of the common
examples of this is problems between Stakeholders and CEOs. DAO solves this problem
through community governance. Here, principles don’t have to trust agents who work on
their behalf instead they work as a part of a group whose incentives are aligned.

Disadvantages of DAO
This section lists some of the disadvantages of DAO:
1. Security: DAO can be launched with just a few lines of code and given the immense tech
stack a well-run DAO requires to operate effectively thus security remains a vulnerability as
it requires significant technical expertise and it is expensive to keep best security practices
implemented.
2. Slow Decision Making: With DAO scaling there comes an issue of getting everyone to vote
on proposals in a timely manner and with different time zones and investor priorities, keeping
DAO participants up to date can be challenging.
3. The Bikeshedding Effect: Parkinson’s Law of Triviality states that the amount of time spent
discussing an issue in an organization is inversely related to its importance in the scheme of
things. This is also known as bike-shedding. It can have a negative impact on personal
productivity as it causes inefficient management of time.

53
4. No legitimate structure for circulating DAOs: DAOs can be circulated across different
locales, and there’s no legitimate structure for them. Any lawful issues that might emerge
will probably require those required to manage various territorial laws in a convoluted fight
in court. In July 2017, for instance, the United States Securities and Exchange Commission
gave a report not really settled that the DAO sold protections as tokens on the Ethereum
blockchain without approval, disregarding bits of protection law in the country.

Future of DAO

The DAO as initially imagined had not returned as of mid-2020. Regardless, interest in
decentralized independent associations as a more extensive gathering keeps on developing.
While there are many waiting concerns and potential issues with respect to lawfulness, security,
and construction, a few investigators and financial backers accept that this kind of association
will ultimately come to conspicuousness, maybe in any event, supplanting customarily organized
organizations.
Criticism of DAO
There are likewise a couple of drawbacks to DAO:
1. One significant issue of being open-source is that securing business insider facts will end up
being more troublesome.
2. Additionally, potential hackers can more easily detect weak spots in the system as they can
openly access the source code. In rare cases, they could even slip their pieces of code into
the software without being detected by the community. That way they could create their own
loopholes.

1.14. QUICK START OVERVIEW OF REMIX USING JAVASCRIPT VM.

What is Remix-IDE?
The Remix is an Integrated Development Environment(IDE) for developing smart contracts in
Solidity programming language. The IDE can be used to write, compile, and debug the Solidity
code. It was written in JavaScript and supports testing, debugging and deploying smart contracts,
and much more. Remix-IDE can be accessed in many different ways:
1. You can use it online in any browser of your choice, by entering the
URL: https://remix.ethereum.org/ in the browser.
2. Or you can install it in your own system using this link.
3. The third way is to use Mist (the Ethereum Dapp browser).

The JavaScript VM in Remix

The JavaScript VM is a simulated Blockchain Environment that only exists in your browser. It
also only exists as long as you keep the browser-tab open. Close it or reload it, you start from
scratch.
On the positive side: it's super fast! No waiting for Transactions to be mined. No complicated
setup. It's just there and it works out of the box

54
On the negative side: There's only limited ways to connect to it. Once you reload everything is
gone (non persistant). Sometimes things in the browser simulation work, which won't work on a
real blockchain.
smart contract in solidity using remix-ide which is a browser-based IDE. So let’s get started
with our first simple “Hello World” program.
1. Open the remix-ide in your browser by typing: https://remix.ethereum.org/
2. You will be presented with following screen:

3. Click on the “file explorer” icon onto the left side bar (indicated by blue arrow in the
above picture).
4. Select Solidity in the Environment and click + symbol right to the browser.

5. Type the file name “HelloWorld.sol” and enter the following code into it

55
// My First Smart Contract
pragma solidity >=0.5.0 <0.7.0;
contract HelloWorld {
function get()public pure returns (string memory){
return 'Hello Contracts';
}
}

6. Once done click the icon just below the “file explorer” icon as shown below:

7. You will be presented with following screen:


Click “Compile HelloWorld.sol”. Leave rest setting as it is.

56
8. Once compiled successfully click the icon below “Solidity Compiler” that is “Deploy
and run transactions”. You will be welcomed by next screen:

9. Without changing any of the values as shown above just click “Deploy” button to deploy
your smart contract. Once deployed you will find your smart contract just below

in “Deployed Contracts” heading:


10. Click “>” before your contract you will see a button “get” below as our contract has get
function that returns a string. Click get button and you will get :

pragma solidity >= 0.8.2 <0.9.0;

contract HelloWorld{

57
string userInput;

function set(string memory finalValue) public


{
userInput = finalValue;
}

function get() public view returns(string memory){


return userInput;
}
}

11. After clicking the ‘>’ in the Deployed Contracts section a drop down menu will be opened
which will consist of two methods. Set and Get.

12. Now beside the set method we can see a blank box appears which asks for a string value.
Here we will type whatever we will like to print / show. Then click on set. In the terminal
user can see another transaction happened. Then click on get, and the string we passed
will be visible below.

Now, Solidity code executed in the remix environment.

58

You might also like