Chapter 3
Smart Contracts
Smart Contracts
• Ethereum Networks
• What is a Smart Contract?
• Ethereum Virtual Machine, Ether, Gas
• DApps
• Decentralized Autonomous Organizations (DAO)
• Hard and Soft Forks
• Initial Coin Offerings
• Demo of Smart Contracts
Introduction
• A smart contract is a computer program or a transaction protocol
which is intended to automatically execute, control or document
legally relevant events and actions according to the terms of a
contract or an agreement.
• The objective of smart contracts are the reduction of need in trusted
inter-mediators, arbitrations and enforcement costs, fraud losses, as
well as the reduction of malicious and accidental exceptions.
• Smart contracts are simply programs stored on a Blockchain that run
when predetermined conditions are met.
Ethereum Networks
• Ethereum is a decentralized blockchain platform that
establishes a peer-to-peer network that securely executes and
verifies application code, called smart contracts
• Ethereum is the hottest cryptocurrency in the Blockchain at
present. Cryptocurrency is the word that’s used to describe
decentralized digitized currencies.
• The first cryptocurrency was created in 2008 known as Bitcoin.
Ethereum is relatively new cryptocurrency and was invented in
2013.
Ethereum network on a World Map
Ethereum Networks
• With the Ethereum Blockchain , rather than Bitcoin the miners will work to
earn Ether or ETH.
• ETH is the fuel that needed to run the Ethereum network.
• Ethereum is a technology that is home to digital money, global payments
and applications.
• Ethereum is a Blockchain platform with its own cryptocurrency, called
Ether(ETH) and solidity is its own programming language.
• The network’s users can create, publish, monetize and use applications on
the platform and use its Ether cryptocurrency as payment.
• Ethereum Blockchain allows building decentralized apps defined by smart
contracts.
Ethereum Networks
• The node of the network run the Ethereum Virtual Machine(EVM)
and execute the instructions according to the smart contracts.
Ethereum nodes run the EVM to maintain consensus across the
Blockchain.
• The idea behind Ethereum was created by Vitalik Buterin.
• An Ethereum network has all the nodes connected to each other
using the P2P network and each node keep the latest copy of the
Ethereum Blockchain ledger.
• The three types of Blockchain nodes are mining nodes , full nodes
and light node.
What is a smart contract?
• Smart contracts are simply programs stored on a blockchain
that run when predetermined conditions are met. They
typically are used to automate the execution of an agreement
so that all participants can be immediately certain of the
outcome, without any intermediary's involvement or time loss.
How smart contracts work
• Smart contracts work by following simple “if/when…then…” statements that
are written into code on a blockchain. A network of computers executes the
actions when predetermined conditions have been met and verified. These
actions could include releasing funds to the appropriate parties, registering
a vehicle, sending notifications, or issuing a ticket. The blockchain is then
updated when the transaction is completed. That means the transaction
cannot be changed, and only parties who have been granted permission
can see the results.
• Within a smart contract, there can be as many stipulations as needed to
satisfy the participants that the task will be completed satisfactorily. To
establish the terms, participants must determine how transactions and their
data are represented on the blockchain, agree on the “if/when...then…”
rules that govern those transactions, explore all possible exceptions, and
define a framework for resolving disputes.
• Then the smart contract can be programmed by a developer – although
increasingly, organizations that use blockchain for business provide
templates, web interfaces, and other online tools to simplify structuring
smart contracts.
Benefits of smart contracts
• Speed, efficiency and accuracy
• Once a condition is met, the contract is executed immediately.
Because smart contracts are digital and automated, there’s no
paperwork to process and no time spent reconciling errors that
often result from manually filling in documents.
Benefits of smart contracts
• Trust and transparency
• Because there’s no third party involved, and because encrypted
records of transactions are shared across participants, there’s
no need to question whether information has been altered for
personal benefit.
Benefits of smart contracts
• Security
• Blockchain transaction records are encrypted, which makes
them very hard to hack. Moreover, because each record is
connected to the previous and subsequent records on a
distributed ledger, hackers would have to alter the entire chain
to change a single record.
Benefits of smart contracts
• Savings
• Smart contracts remove the need for intermediaries to handle
transactions and, by extension, their associated time delays and
fees.
Ethereum Virtual Machine(EVM)
• The Ethereum Virtual Machine (EVM) is a powerful, sandboxed
virtual stack embedded within each full Ethereum node, responsible
for executing contract bytecode. Contracts are typically written in
higher level languages, like Solidity, then compiled to EVM bytecode.
• This means that the machine code is completely isolated from the
network, filesystem or any processes of the host computer. Every
node in the Ethereum network runs an EVM instance which allows
them to agree on executing the same instructions. The EVM is
Turing complete, which refers to a system capable of performing any
logical step of a computational function. JavaScript, the
programming language which powers the worldwide web, widely
uses Turing completeness.
• Ethereum Virtual Machines have been successfully implemented in
various programming languages including C++, Java, JavaScript,
Python, Ruby, and many others.
EVM
Architecture of Ethereum
Ether(ETH)
• Ether is the transactional token that facilitates operations on the Ethereum
network.
• While ether can be thought of as the cryptocurrency of the Ethereum
network, metaphorically speaking, it is more accurate to refer to it as the
"fuel" of the network.
• The Ethereum technology uses blockchain development to replace the
storage of consumer data, including financial records, by third-party
internet companies.
• Ether is the world’s second-largest virtual currency by market capitalization
as of 2021; it is second only to Bitcoin (BTC), according to market value.
• Ethereum developers started working on shifting the network from a proof-
of-work (PoW) system to a proof-of-stake (PoS) system in 2017; the new
underlying network is known as Ethereum 2.0 and it has yet to be fully
released
Gas
• On the Ethereum blockchain, gas refers to the cost necessary
to perform a transaction on the network. Miners set the price
of gas based on supply and demand for the computational
power of the network needed to process smart contracts and
other transactions.
• Transaction fee=Total gas used* gas price
DApps
• Decentralized applications (dApps) are digital applications or
programs that exist and run on a blockchain or peer-to-
peer (P2P) network of computers instead of a single computer.
• DApps (also called "dapps") are outside the purview and control
of a single authority.
• DApps—which are often built on the Ethereum platform—can
be developed for a variety of purposes including gaming,
finance, and social media.
DApps
• Decentralized applications—also known as "dApps" or
"dapps"—are digital applications that run on a blockchain
network of computers instead of relying on a single computer.
• Because dApps are decentralized, they are free from the control
and interference of a single authority.
• Benefits of dApps include the safeguarding of user privacy, the
lack of censorship, and the flexibility of development.
• Drawbacks include the potential inability to scale, challenges in
developing a user interface, and difficulties in making code
modifications.
Decentralized Autonomous Organizations
(DAO)
• One of the major features of digital currencies is that they
are decentralized.
• This means they are not controlled by a single institution like a
government or central bank, but instead are divided among a variety
of computers, networks, and nodes.
• In many cases, virtual currencies make use of this decentralized
status to attain levels of privacy and security that are typically
unavailable to standard currencies and their transactions.
• Inspired by the decentralization of cryptocurrencies, a group of
developers came up with the idea for a decentralized autonomous
organization, or DAO, in 2016.
Decentralized Autonomous Organizations
(DAO)
Decentralized Autonomous Organization
(DAO)
• The DAO was an organization created by developers to
automate decisions and facilitate cryptocurrency transactions.
• In June 2016, due to programming errors and attack vectors,
hackers attacked the DAO, accessing 3.6 million ETH.
• Digital exchange currencies de-listed the DAO token in
September 2016.
Hard and Soft Forks
• Cryptocurrencies like Bitcoin (BTC) and Ethereum (ETH) are powered by a decentralized open-
source software called a blockchain. A fork is a change to the blockchain’s underlying protocol. A
blockchain fork is an important upgrade to the network and can either represent a radical change or
a minor one and can be initiated by developers or community members.
• It requires node operators — machines connected to the blockchain that help validate transactions
on it — to upgrade to the latest version of the protocol. Every node has a copy of the blockchain
and ensures new transactions do not contradict its history.
• A hard fork is a radical upgrade that can make previous transactions and blocks either valid or
invalid and requires all validators in a network to upgrade to a newer version. It’s not backward-
compatible.
• A soft fork is an upgrade to the software that is backward-compatible and has validators in an older
version of the chain see the new version as valid.
Hard Fork
• A hard fork refers to a radical change to the protocol of a
blockchain network that effectively results in two branches, one
that follows the previous protocol and one that follows the new
version.
• In a hard fork, holders of tokens in the original blockchain will be
granted tokens in the new fork as well, but miners must choose
which blockchain to continue verifying.
• A hard fork can occur in any blockchain, and not only Bitcoin
(where hard forks have created Bitcoin Cash and Bitcoin SV,
among several others, for example).
Soft Fork
• In blockchain technology, a soft fork is a change to the
software protocol where only previously valid transaction
blocks are made invalid. Because old nodes will recognize the
new blocks as valid, a soft fork is backwards-compatible.
Initial Coin Offerings
• An initial coin offering (ICO) is the cryptocurrency industry's
equivalent to an initial public offering (IPO). A company seeking
to raise money to create a new coin, app, or service can launch
an ICO as a way to raise funds.
• Interested investors can buy into an initial coin offering to
receive a new cryptocurrency token issued by the company.
This token may have some utility related to the product or
service that the company is offering, or it may just represent a
stake in the company or project.
Initial Coin Offerings
• Initial coin offerings are a popular way to raise funds for products
and services usually related to cryptocurrency.
• ICOs are similar to initial public offerings, but coins issued in an ICO
can also have utility for a software service or product.
• Some ICOs have yielded massive returns for investors. Numerous
others have turned out to be fraudulent or have performed extremely
poorly.
• To participate in an ICO, you usually need to first purchase a more
established digital currency, plus have a basic understanding of
cryptocurrency wallets and exchanges.
• ICOs are, for the most part, completely unregulated, so investors
must exercise a high degree of caution and diligence when
researching and investing in ICOs.
Working of ICO

Chapter 3.pptx

  • 1.
  • 2.
    Smart Contracts • EthereumNetworks • What is a Smart Contract? • Ethereum Virtual Machine, Ether, Gas • DApps • Decentralized Autonomous Organizations (DAO) • Hard and Soft Forks • Initial Coin Offerings • Demo of Smart Contracts
  • 3.
    Introduction • A smartcontract is a computer program or a transaction protocol which is intended to automatically execute, control or document legally relevant events and actions according to the terms of a contract or an agreement. • The objective of smart contracts are the reduction of need in trusted inter-mediators, arbitrations and enforcement costs, fraud losses, as well as the reduction of malicious and accidental exceptions. • Smart contracts are simply programs stored on a Blockchain that run when predetermined conditions are met.
  • 4.
    Ethereum Networks • Ethereumis a decentralized blockchain platform that establishes a peer-to-peer network that securely executes and verifies application code, called smart contracts • Ethereum is the hottest cryptocurrency in the Blockchain at present. Cryptocurrency is the word that’s used to describe decentralized digitized currencies. • The first cryptocurrency was created in 2008 known as Bitcoin. Ethereum is relatively new cryptocurrency and was invented in 2013.
  • 5.
  • 6.
    Ethereum Networks • Withthe Ethereum Blockchain , rather than Bitcoin the miners will work to earn Ether or ETH. • ETH is the fuel that needed to run the Ethereum network. • Ethereum is a technology that is home to digital money, global payments and applications. • Ethereum is a Blockchain platform with its own cryptocurrency, called Ether(ETH) and solidity is its own programming language. • The network’s users can create, publish, monetize and use applications on the platform and use its Ether cryptocurrency as payment. • Ethereum Blockchain allows building decentralized apps defined by smart contracts.
  • 8.
    Ethereum Networks • Thenode of the network run the Ethereum Virtual Machine(EVM) and execute the instructions according to the smart contracts. Ethereum nodes run the EVM to maintain consensus across the Blockchain. • The idea behind Ethereum was created by Vitalik Buterin. • An Ethereum network has all the nodes connected to each other using the P2P network and each node keep the latest copy of the Ethereum Blockchain ledger. • The three types of Blockchain nodes are mining nodes , full nodes and light node.
  • 10.
    What is asmart contract? • Smart contracts are simply programs stored on a blockchain that run when predetermined conditions are met. They typically are used to automate the execution of an agreement so that all participants can be immediately certain of the outcome, without any intermediary's involvement or time loss.
  • 11.
    How smart contractswork • Smart contracts work by following simple “if/when…then…” statements that are written into code on a blockchain. A network of computers executes the actions when predetermined conditions have been met and verified. These actions could include releasing funds to the appropriate parties, registering a vehicle, sending notifications, or issuing a ticket. The blockchain is then updated when the transaction is completed. That means the transaction cannot be changed, and only parties who have been granted permission can see the results. • Within a smart contract, there can be as many stipulations as needed to satisfy the participants that the task will be completed satisfactorily. To establish the terms, participants must determine how transactions and their data are represented on the blockchain, agree on the “if/when...then…” rules that govern those transactions, explore all possible exceptions, and define a framework for resolving disputes. • Then the smart contract can be programmed by a developer – although increasingly, organizations that use blockchain for business provide templates, web interfaces, and other online tools to simplify structuring smart contracts.
  • 12.
    Benefits of smartcontracts • Speed, efficiency and accuracy • Once a condition is met, the contract is executed immediately. Because smart contracts are digital and automated, there’s no paperwork to process and no time spent reconciling errors that often result from manually filling in documents.
  • 13.
    Benefits of smartcontracts • Trust and transparency • Because there’s no third party involved, and because encrypted records of transactions are shared across participants, there’s no need to question whether information has been altered for personal benefit.
  • 14.
    Benefits of smartcontracts • Security • Blockchain transaction records are encrypted, which makes them very hard to hack. Moreover, because each record is connected to the previous and subsequent records on a distributed ledger, hackers would have to alter the entire chain to change a single record.
  • 15.
    Benefits of smartcontracts • Savings • Smart contracts remove the need for intermediaries to handle transactions and, by extension, their associated time delays and fees.
  • 16.
    Ethereum Virtual Machine(EVM) •The Ethereum Virtual Machine (EVM) is a powerful, sandboxed virtual stack embedded within each full Ethereum node, responsible for executing contract bytecode. Contracts are typically written in higher level languages, like Solidity, then compiled to EVM bytecode. • This means that the machine code is completely isolated from the network, filesystem or any processes of the host computer. Every node in the Ethereum network runs an EVM instance which allows them to agree on executing the same instructions. The EVM is Turing complete, which refers to a system capable of performing any logical step of a computational function. JavaScript, the programming language which powers the worldwide web, widely uses Turing completeness. • Ethereum Virtual Machines have been successfully implemented in various programming languages including C++, Java, JavaScript, Python, Ruby, and many others.
  • 17.
  • 18.
  • 19.
    Ether(ETH) • Ether isthe transactional token that facilitates operations on the Ethereum network. • While ether can be thought of as the cryptocurrency of the Ethereum network, metaphorically speaking, it is more accurate to refer to it as the "fuel" of the network. • The Ethereum technology uses blockchain development to replace the storage of consumer data, including financial records, by third-party internet companies. • Ether is the world’s second-largest virtual currency by market capitalization as of 2021; it is second only to Bitcoin (BTC), according to market value. • Ethereum developers started working on shifting the network from a proof- of-work (PoW) system to a proof-of-stake (PoS) system in 2017; the new underlying network is known as Ethereum 2.0 and it has yet to be fully released
  • 20.
    Gas • On theEthereum blockchain, gas refers to the cost necessary to perform a transaction on the network. Miners set the price of gas based on supply and demand for the computational power of the network needed to process smart contracts and other transactions. • Transaction fee=Total gas used* gas price
  • 21.
    DApps • Decentralized applications(dApps) are digital applications or programs that exist and run on a blockchain or peer-to- peer (P2P) network of computers instead of a single computer. • DApps (also called "dapps") are outside the purview and control of a single authority. • DApps—which are often built on the Ethereum platform—can be developed for a variety of purposes including gaming, finance, and social media.
  • 23.
    DApps • Decentralized applications—alsoknown as "dApps" or "dapps"—are digital applications that run on a blockchain network of computers instead of relying on a single computer. • Because dApps are decentralized, they are free from the control and interference of a single authority. • Benefits of dApps include the safeguarding of user privacy, the lack of censorship, and the flexibility of development. • Drawbacks include the potential inability to scale, challenges in developing a user interface, and difficulties in making code modifications.
  • 24.
    Decentralized Autonomous Organizations (DAO) •One of the major features of digital currencies is that they are decentralized. • This means they are not controlled by a single institution like a government or central bank, but instead are divided among a variety of computers, networks, and nodes. • In many cases, virtual currencies make use of this decentralized status to attain levels of privacy and security that are typically unavailable to standard currencies and their transactions. • Inspired by the decentralization of cryptocurrencies, a group of developers came up with the idea for a decentralized autonomous organization, or DAO, in 2016.
  • 25.
  • 26.
    Decentralized Autonomous Organization (DAO) •The DAO was an organization created by developers to automate decisions and facilitate cryptocurrency transactions. • In June 2016, due to programming errors and attack vectors, hackers attacked the DAO, accessing 3.6 million ETH. • Digital exchange currencies de-listed the DAO token in September 2016.
  • 27.
    Hard and SoftForks • Cryptocurrencies like Bitcoin (BTC) and Ethereum (ETH) are powered by a decentralized open- source software called a blockchain. A fork is a change to the blockchain’s underlying protocol. A blockchain fork is an important upgrade to the network and can either represent a radical change or a minor one and can be initiated by developers or community members. • It requires node operators — machines connected to the blockchain that help validate transactions on it — to upgrade to the latest version of the protocol. Every node has a copy of the blockchain and ensures new transactions do not contradict its history. • A hard fork is a radical upgrade that can make previous transactions and blocks either valid or invalid and requires all validators in a network to upgrade to a newer version. It’s not backward- compatible. • A soft fork is an upgrade to the software that is backward-compatible and has validators in an older version of the chain see the new version as valid.
  • 28.
    Hard Fork • Ahard fork refers to a radical change to the protocol of a blockchain network that effectively results in two branches, one that follows the previous protocol and one that follows the new version. • In a hard fork, holders of tokens in the original blockchain will be granted tokens in the new fork as well, but miners must choose which blockchain to continue verifying. • A hard fork can occur in any blockchain, and not only Bitcoin (where hard forks have created Bitcoin Cash and Bitcoin SV, among several others, for example).
  • 30.
    Soft Fork • Inblockchain technology, a soft fork is a change to the software protocol where only previously valid transaction blocks are made invalid. Because old nodes will recognize the new blocks as valid, a soft fork is backwards-compatible.
  • 32.
    Initial Coin Offerings •An initial coin offering (ICO) is the cryptocurrency industry's equivalent to an initial public offering (IPO). A company seeking to raise money to create a new coin, app, or service can launch an ICO as a way to raise funds. • Interested investors can buy into an initial coin offering to receive a new cryptocurrency token issued by the company. This token may have some utility related to the product or service that the company is offering, or it may just represent a stake in the company or project.
  • 33.
    Initial Coin Offerings •Initial coin offerings are a popular way to raise funds for products and services usually related to cryptocurrency. • ICOs are similar to initial public offerings, but coins issued in an ICO can also have utility for a software service or product. • Some ICOs have yielded massive returns for investors. Numerous others have turned out to be fraudulent or have performed extremely poorly. • To participate in an ICO, you usually need to first purchase a more established digital currency, plus have a basic understanding of cryptocurrency wallets and exchanges. • ICOs are, for the most part, completely unregulated, so investors must exercise a high degree of caution and diligence when researching and investing in ICOs.
  • 34.