0% found this document useful (0 votes)
10 views

Module 4

Uploaded by

shettyprachi16
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

Module 4

Uploaded by

shettyprachi16
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 74

Foundations of Blockchain Technology

CSE 2019

Module - 4

Department of Computer Science Engineering


School of Engineering

CSE2019_Foundations of Blockchain Technology


Module 4 : Smart Contracts

Topics
• Introduction to Ethereum

• Ethereum network

• Components of Ethereum ecosystem

• Smart contracts

[10Hrs]
[Understand]

CSE2019_Foundations of Blockchain Technology


• It was created by Russian-Canadian programmer Vitalik Buterin in 2013, and
launched in 2015.
• Ethereum has become a major player in the world of cryptocurrency and blockchain
technology, with its native cryptocurrency, ether, being the second-largest
cryptocurrency by market capitalization after Bitcoin.
• Ethereum is a decentralized blockchain platform, that establishes a peer-to-peer
network that securely executes and verifies application code, called smart
contracts. Smart contracts allow participants to transact with each other without a
trusted central authority.

CSE2019_Foundations of Blockchain Technology


CSE2019_Foundations of Blockchain Technology
Turing complete means using conditional statements and loops to program smart
contracts.

CSE2019_Foundations of Blockchain Technology


CSE2019_Foundations of Blockchain Technology
CSE2019_Foundations of Blockchain Technology
Gas

• Gas is a unit of account within the EVM used in the calculation of the
transaction fee, which is the amount of ETH a transaction's sender must pay
to the network to have the transaction included in the blockchain.

CSE2019_Foundations of Blockchain Technology


Virtual machine
• The Ethereum Virtual Machine (EVM) is the runtime environment for transaction execution in
Ethereum.
• It includes, among other things, a stack, memory, gas balance, program counter, and the
state (including contract code).
• The EVM is stack-based, in that most instructions pop operands from the stack and push the
result to the stack.

• EVMs have been implemented in; C++, C#, Go, Haskell, Java, JavaScript, Python, Ruby,
Rust, Elixir, Erlang

CSE2019_Foundations of Blockchain Technology


Accounts
• There are two types of accounts on Ethereum: user accounts (also known as externally-
owned accounts) and contracts.

Ether
• Ether (ETH) is the cryptocurrency generated in accordance with the Ethereum protocol as a reward to
validators in a proof-of-stake system for adding blocks to the blockchain.
• Ether is represented in the state as an unsigned integer associated with each account, this being the
account's ETH balance denominated in wei (1018 wei = 1 ether).

CSE2019_Foundations of Blockchain Technology


What is Ethereum?
• Ethereum is an open-software platform which allows users to build a range of
decentralized applications.

• Ethereum is an open-source platform that uses blockchain technology, to create and run
decentralized digital applications, or "dapps" that enable users to make agreements
and conduct transactions directly with each other to buy, sell and trade goods and
services without a middleman.

• Ethereum is often referred to as the second most popular cryptocurrency, after


Bitcoin.

• But unlike Bitcoin—and most other virtual currencies— Ethereum is intended/proposed to


be much more than simply a medium of exchange or a store of value. Instead, Ethereum
calls itself a decentralized computing network built on blockchain technology.

CSE2019_Foundations of Blockchain Technology


• Ethereum operates via a global network of computers that work together as a
supercomputer.
• The network assembles and runs smart contracts - applications that are, in
theory, independent from any third-party interference or censorship, as the
blockchain is resistant to tampering.
• Smart contracts run exactly as programmed, greatly reducing the risk of fraud,
and are self-executing, like an automat or vending machine that carries out the
contract terms digitally.

CSE2019_Foundations of Blockchain Technology


What are the differences between Ethereum and Bitcoin?

• Ethereum’s blockchain technology is similar to bitcoins, however Bitcoin only uses


one specific application of blockchain technology. Ultimately, it’s an electronic cash
system that enables online bitcoin payments.

• The Ethereum blockchain does track ownership of digital currency, but also focuses
on running the programming code of a range of decentralized applications.

CSE2019_Foundations of Blockchain Technology


CSE2019_Foundations of Blockchain Technology
CSE2019_Foundations of Blockchain Technology
DAPP DAO
• Decentralized • A Decentralized Autonomous
Applications—
Organization, sometimes called a
also known as "dApps" or decentralized autonomous corporation,
"dapps"—are digital is an organization managed in whole or
applications that run on a in part by decentralized computer
blockchain network of program, with voting and finances
computers, instead of relying handled through a blockchain. In
general terms, DAOs are member-
on a single computer. owned communities without centralized
• dApps are free from the control leadership.
and interference of a single
authority.

CSE2019_Foundations of Blockchain Technology


CSE2019_Foundations of Blockchain Technology
Real-World Applications of Ethereum

• Voting Systems
Voting systems are adopting Ethereum. The results of polls are
publicly available, ensuring a transparent and fair democratic
process by eliminating voting malpractices.

• Banking Systems
Ethereum is getting adopted widely in banking systems because
with Ethereum’s decentralized system; it is challenging for hackers
to gain unauthorized access. It also allows payments on an
Ethereum-based network, so banks are also using Ethereum as a
channel to make remittances and payments.

CSE2019_Foundations of Blockchain Technology


• Shipping

Deploying Ethereum in shipping helps with the tracking of cargo and prevents goods
from being misplaced or counterfeited. Ethereum provides the provenance and
tracking framework for any asset required in a typical supply chain.

• Agreements

With Ethereum smart contracts, agreements can be maintained and executed


without any alteration. So in an industry that has fragmented participants, is subject
to disputes, and requires digital contracts to be present, Ethereum can be used as a
technology for developing smart contracts and for digitally recording the
agreements and the transactions based on them.

CSE2019_Foundations of Blockchain Technology


CSE2019_Foundations of Blockchain Technology
Ethereum's components include:

1.Transactions

2.Consensus Rules

3.Consensus Algorithms

4.State Machine

5.Data structures

6.Economic Security

7.Software Clients

CSE2019_Foundations of Blockchain Technology


What are the components of Ethereum
ecosystem?

Components of the Ethereum ecosystem:

• Keys and addresses.

• Accounts.

• Transactions and messages.

• Ether cryptocurrency/tokens.

CSE2019_Foundations of Blockchain Technology


CSE2019_Foundations of Blockchain Technology
CSE2019_Foundations of Blockchain Technology
What is Ethereum Network?
• Ethereum is a decentralized blockchain platform, that establishes a peer-to-peer
network that securely executes and verifies application code, called smart
contracts.
• Smart contracts allow participants to transact with each other without a trusted
central authority.

CSE2019_Foundations of Blockchain Technology


CSE2019_Foundations of Blockchain Technology
CSE2019_Foundations of Blockchain Technology
What is Ethereum Private
What is Ethereum main Network?
network?
An Ethereum Private
Mainnet is the primary Network is a completely
public Ethereum production private Blockchain which is
blockchain, where actual- isolated from the Main
value transactions occur on Ethereum network. Ethereum
the distributed ledger. When Private Network is mainly
people and exchanges created by Organizations to
What is a Test Net? restrict the read permissions
discuss ETH prices, they're
An Ethereum testnet is a collection of the Blockchain. Only the
talking about Mainnet ETH.
of nodes that are used to test the nodes with the right
Ethereum protocol. Tests are run permissions will be able to
on the testnets to ensure that the access this Blockchain.
protocol is working as expected.

CSE2019_Foundations of Blockchain Technology


CSE2019_Foundations of Blockchain Technology
EOA

• As an EOA, the state simply stores the account’s Balance in ether


and a sequence number is used to prevent transaction replay
attacks.
• On the other hand, it stores the contract's code and its storage in a
key-value database.
Externally Owned Accounts (EOA)

• Managed by Human
• Account creation incurs/gains no cost
• Can transfer Ether (ETH) to other accounts
• Can send messages (i.e. send transactions) to smart contracts

CSE2019_Foundations of Blockchain Technology


Contract Accounts

What is a contract account?


• A contract account has an associated code that executes when it receives a transaction
from an EOA.
• When a contractor has accepted a contract, a separate account is opened for each
contract, bringing together all the costs relating to a particular contract.
• A serial number is assigned to each contract, which is known as a contract account.
Contract Accounts
• Managed by Code (e.g. Solidity)
• Account creation might incur/gains cost
• Can do both- transfer Ether as well as create Smart Contract accounts

CSE2019_Foundations of Blockchain Technology


CSE2019_Foundations of Blockchain Technology
CSE2019_Foundations of Blockchain Technology
CSE2019_Foundations of Blockchain Technology
CSE2019_Foundations of Blockchain Technology
CSE2019_Foundations of Blockchain Technology
CSE2019_Foundations of Blockchain Technology
CSE2019_Foundations of Blockchain Technology
CSE2019_Foundations of Blockchain Technology
CSE2019_Foundations of Blockchain Technology
CSE2019_Foundations of Blockchain Technology
Sample Code

CSE2019_Foundations of Blockchain Technology


CSE2019_Foundations of Blockchain Technology
CSE2019_Foundations of Blockchain Technology
Example

CSE2019_Foundations of Blockchain Technology


Decentralized Application (DAPP)

• Decentralized apps are digital applications or programs that are


based on Blockchain and fundamentally different from normal
applications. Unlike normal applications that run on Centralized
servers, that belong to the company which owns them, DApps run
on a Decentralized peer-to-peer (P2P) network that is based
on Blockchain.

CSE2019_Foundations of Blockchain Technology


CSE2019_Foundations of Blockchain Technology
DAPP

What is Ethereum DApp?

These are Decentralized applications that are developed


using the Ethereum platform and are powered by it.
Ethereum dApps use smart contracts for their logic. They
are deployed on the Ethereum network and use the
platform's blockchain for data storage.

CSE2019_Foundations of Blockchain Technology


Categories of Ethereum DAPP
• DApps are divided into numerous Categories:

Exchanges, Businesses, Gambling, Games,


Finance, Development, Storage, Wallet,
Governance, Property, Identity, Media, Social,
Security, Energy, Insurance, Health, etc.,

CSE2019_Foundations of Blockchain Technology


Why dApp is used?
• dApp Uses. dApps have been developed to decentralize a
range of functions and applications and eliminate
intermediaries.
• DApps have also been developed to enable secure,
blockchain-based voting and governance.
• Examples include self-executing financial contracts, multi-
user games, and social media platforms.

CSE2019_Foundations of Blockchain Technology


Top 10 Most Popular DApps
• Top 10 Most Popular DApps
• Uniswap.
• Compound.
• OpenSea.
• Yearn Finance.
• MakerDAO.
• NBA Top Shot.
• Curve.
• Step App. Step App is a popular Move to Earn app that allows you
to earn while exercising.

CSE2019_Foundations of Blockchain Technology


CSE2019_Foundations of Blockchain Technology
CSE2019_Foundations of Blockchain Technology
CSE2019_Foundations of Blockchain Technology
CSE2019_Foundations of Blockchain Technology
CSE2019_Foundations of Blockchain Technology
Advantages of dApps

1. Fault tolerance: As dApps work on a decentralized platform, if a single node is working the network
will be still; available but the performance will be severely downgraded.
2. Privacy: Users don’t need to submit real-world identity or any personal information to use any app-
specific functionality.
3. Data integrity: Data stored on the blockchain is immutable and tamper-proof due to the use of
consensus algorithms. Hackers cannot forge transactions and the data stored on the blockchain is
resistant to change.
4. Flexible platform: The Ethereum platform provides a flexible environment for easy development of
dApps.
5. 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.

CSE2019_Foundations of Blockchain Technology


Disadvantages of dApps
1. 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.
2. Maintenance: dApps are hard to maintain, debug and update, as the code or data published to the blockchain are
hard to modify and all bug fixes require consensus from all the peers on the network which is in most cases hard to
achieve in a timely manner.
3. Scalability: Decentralized networks are hard to scale than centralized networks.
4. User experience: It is quite hard for the developers to design a user-friendly dApp as it requires users to use the
public and private keys for login instead of the username and password that is being used in centralized
applications.
5. 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.
6. Network Congestion: There is an issue of network congestion while using a dApp as one dApp uses too many
computational resources, and the entire network gets backed up. If the number of transactions coming in is more
than the 10-15 transactions that are being processed in a second then unconfirmed transactions will pile up.

CSE2019_Foundations of Blockchain Technology


Decentralized Autonomous Organization (DAO)

• A decentralized autonomous organization (DAO), sometimes called a


decentralized autonomous corporation, is an organization managed in whole
or in part by decentralized computer program, with voting and finances
handled through a blockchain.
• In general terms, DAOs are member-owned communities without centralized
leadership.

CSE2019_Foundations of Blockchain Technology


• DAOs are not subjected to any central authority, corporate
leaders, or third-party decision-makers.
• DAOs can be defined as Decentralized Autonomous
Organizations, where the decisions are governed by proposals
and Voting so that everyone has a voice in the organization.
• Here, the decisions are made ground up and governed and
organized by a specific set of rules coded on a blockchain.

CSE2019_Foundations of Blockchain Technology


CSE2019_Foundations of Blockchain Technology
https://accubits.com/insights/what-are-the-different-types-of-daos/
• An Automated Market Maker (AMM) is a type of decentralized exchange (DEX) protocol, that
relies on a mathematical formula to price assets.
• A Grant DAO is a decentralized autonomous organization, that is funded by the community, to
provide grants to individuals and organizations that are making a positive impact in the world.
• A Social DAO is designed to be transparent, secure, and efficient. It is powered by blockchain
technology which allows, its members to securely and efficiently exchange data,
resources, and money. In a Social DAO, members are able to vote on decisions, and the
majority vote decides how the organization is run.
• A Collector DAO focuses on collecting funds so the community can bid on.

• A Venture DAO (sometimes called “investment DAO” or "venture capital DAO") is a


community of investors, who collaborate on the investment decision-making process and
support the collection of projects they invest in.
CSE2019_Foundations of Blockchain Technology
CSE2019_Foundations of Blockchain Technology
CSE2019_Foundations of Blockchain Technology
CSE2019_Foundations of Blockchain Technology
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.

CSE2019_Foundations of Blockchain Technology


CSE2019_Foundations of Blockchain Technology
What Is the Purpose of a DAO?

• A DAO is intended to improve the traditional management structure of many


companies.
• Instead of relying on a single individual or small collection of individuals to guide
the direction of the entity, a DAO intends/proposes to give every member a voice,
vote, and opportunity to propose initiatives.
• A DAO also strives to have strict governance that is dictated by code on a
blockchain.

CSE2019_Foundations of Blockchain Technology


CSE2019_Foundations of Blockchain Technology
Benefits of DAOs
• Decentralization. Decisions impacting the organization are made by a collection of individuals as opposed to a central
authority that is often vastly outnumbered by their peers. Instead of relying on the actions of one individual (CEO) or a small
DAO may face technical issues such as bugs, hacks, or network failures,
collection of individuals
which(Board of Directors), a DAO
can compromise itscan decentralize authority
functionality across a vastly larger range of users.
and security.
• Participation. Individuals within an entity may feel more empowered and connected to the entity when they have a
direct say and voting power on all matters. These individuals may not have strong voting power, but a DAO encourages
token holders to cast votes, burn tokens, or use their tokens in ways they think is best for the entity.
• Publicity. Within a DAO, votes are cast via blockchain and made publicly viewable. This requires users to act in ways they
feel is best, as their vote and their decisions will be made publicly viewable. This incentivizes actions that will benefit voters'
reputations and discourage acts against the community.
• Community. The concept of a DAO encourages people from all over the world to seamlessly come together to build a
single vision. With just an internet connection, tokenholders can interact with other owners wherever they may live.

https://101blockchains.com/pros-and-cons-of-dao/
Thank you

CSE2019_Foundations of Blockchain Technology

You might also like