SlideShare a Scribd company logo
1 of 14
Download to read offline
Studocu is not sponsored or endorsed by any college or university
BT unit 5 notes
Blockchain Technology (Savitribai Phule Pune University)
Studocu is not sponsored or endorsed by any college or university
BT unit 5 notes
Blockchain Technology (Savitribai Phule Pune University)
Downloaded by imran akhtar (imranakhtar351@gmail.com)
lOMoARcPSD|22844421
What is Ethereum
The Ethereum platform was launched in 2015 by Buterin and Joe Lubin,
founder of the blockchain software company ConsenSys.
•
Ethereum is a decentralized blockchain platform powered by blockchain
technology that establishes a peer-to-peer network that securely executes
and verifies application code, called smart contracts.
•
Cryptocurrency used is Ether (ETH).
•
Smart contracts allow participants to transact with each other without a
trusted central authority.
•
Transaction records are immutable, verifiable, and securely distributed
across the network, giving participants full ownership and visibility into
transaction data.
•
Transactions are sent from and received by user-created Ethereum
accounts.
•
A sender must sign transactions and spend Ether, Ethereum's native
cryptocurrency, as a cost of processing transactions on the network.
•
Ethereum can be used by anyone to create any secured digital technology.
•
It has a token designed to pay for work done supporting the blockchain,
but participants can also use it to pay for tangible goods and services if
accepted.
•
Ethereum is designed to be scalable, programmable, secure, and
decentralized.
•
It has risen to become the second-largest cryptocurrency by market value.
It is outranked only by Bitcoin.
•
Ethereum, like other cryptocurrencies, involves blockchain technology.
Imagine a very long chain of blocks.
•
All of the information contained in each block is added to every newly-
created block with new data. Throughout the network, an identical copy of
the blockchain is distributed.
•
This blockchain is validated by a network of automated programs that
reach a consensus on the validity of transaction information.
•
No changes can be made to the blockchain unless the network reaches a
consensus. This makes it very secure.
•
Consensus is reached using an algorithm commonly called a consensus
mechanism.
•
Blockchain Ethereum Platform using Solidity
05 January 2023 21:02
Unit 5 Page 1
Downloaded by imran akhtar (imranakhtar351@gmail.com)
lOMoARcPSD|22844421
Ethereum uses the proof-of-stake algorithm, where a network of participants
called validators create new blocks and work together to verify the
information they contain.
•
The blocks contain information about the state of the blockchain, a list of
attestations (a validator's signature and vote on the validity of the block),
transactions, and much more.
•
Ethereum owners use wallets to store their ether.
•
A wallet is a digital interface that lets you access your ether stored on the
blockchain.
•
Your wallet has an address, which is similar to an email address in that it is
where users send ether, much like they would an email.
•
Ether is not actually stored in your wallet. Your wallet holds private
keys you use as you would a password when you initiate a transaction.
•
You receive a private key for each ether you own. This key is essential for
accessing your ether.
•
Use cases:
Decentralized Finance (DeFi)
DeFi is a network of financial applications built on top of
blockchain networks.
-
It is different from existing financial networks because it is open
and programmable, operates without a central authority, and
enables developers to offer new models for payments, investing,
lending, and trading.
-
By using smart contracts and distributed systems, customers can
easily build secure decentralized financial applications.
-
Some popular DeFi platforms include Compound, Aave, UniSwap,
and MakerDAO.
-
1.
Non-Fungible Tokens (NFTs)
NFTs are unique and indivisible digital tokens that are useful for
proving the provenance of rare assets, both digital and tangible.
-
For example, NFTs can be used by an artist to tokenize their work
and ensure that their work is unique and belongs to them.
-
The ownership information is recorded and maintained on the
blockchain network.
-
NFTs are also gaining popularity in the gaming industry because
they allow interoperability between gaming platforms.
-
2.
•
Types of Ethereum Networks
Ethereum is a protocol that runs on thousands of computers simultaneously.
•
It uses blockchain technology to create distributed ledgers, which replace
websites like Facebook and YouTube by decentralizing the network among
users.
•
To have control over the shared blockchain, Ethereum employs different
types of networks called “clusters” that are composed of individual “nodes”
that are linked together in a peer-to-peer network.
•
Unit 5 Page 2
Downloaded by imran akhtar (imranakhtar351@gmail.com)
lOMoARcPSD|22844421
A node typically has an Ethereum client software running on it, and each
node has a full copy of all other nodes’ databases.
•
Therefore, each node can independently verify and query the blockchain,
which prevents malicious or rogue nodes from manipulating the shared
information.
•
There are two types of Ethereum networks — public and private. Each
network has its properties, uses, and limitations when it comes to transactions
and smart contracts on the blockchain.
Public Network:
Operates in an open environment that allows anyone in the world
with an internet connection to join and participate in the network.
-
Anyone may view, add and validate transactions as well as read
previously created transactions.
-
The inclusion of transactions and the network's status are decided by
consensus among peers.
-
Offers more opportunities for developers to deploy smart contracts
and other apps
-
Makes it easier for malicious actors to take over the network by
destroying or manipulating sensitive data.
-
Ethereum Mainnet -
It is the main public Ethereum blockchain that has real value,
real ETH and real consequences.
▪
Primary network at the moment.
▪
Mainnet is the primary public Ethereum production blockchain,
where actual-value transactions occur on the distributed ledger.
▪
When people and exchanges discuss ETH prices, they're talking
about Mainnet ETH.
▪
https://etherscan.io is the block explorer for Ethereum Mainnet
which displays extensive information of all the mined blocks
and other information.
▪
-
Ethereum Testnets -
In addition to Mainnet, there are public testnets.
▪
These are networks used by protocol developers or smart
contract developers to test both protocol upgrades as well as
potential smart contracts in a production-like environment
before deployment to Mainnet.
▪
You should test any contract code you write on a testnet before
deploying to Mainnet.
▪
Most testnets started by using a proof-of-authority consensus
mechanism.
▪
This means a small number of nodes are chosen to validate
transactions and create new blocks – staking their identity in the
process.
▪
Alternatively, some testnets started off using a proof-of-work
consensus mechanism with just a few permissioned miners.
▪
In Testnets, rewards are not given for proof-of-work mining.
▪
Sepolia and Goerli will be public proof-of-stake testnets used.
▪
-
1.
•
Unit 5 Page 3
Downloaded by imran akhtar (imranakhtar351@gmail.com)
lOMoARcPSD|22844421
ETH on testnets has no real value; therefore, there are no
markets for testnet ETH.
▪
Since you need ETH to actually interact with Ethereum, most
people get testnet ETH from faucets.
▪
Most faucets are webapps where you can input an address
which you request for dummy ETH to be sent to.
▪
Public Testnet Advantages:
A testnet node required substantially less data to sync and
store.
▪
In a few hours, a testnet node can sync completely.
▪
Test ether, which is needed for transactions and contract
deployment, has no value and is available for free from a
number of faucets.
▪
Testnets are public blockchains that have a large user base and
active contracts.
▪
-
Public Testnet Disadvantages:
Test ether is used instead of real money. Because there is
nothing at risk, you cannot evaluate security against actual
adversaries.
▪
Some features of a public blockchain are impossible to
evaluate in a real-world setting on a testnet.
▪
Testnets do not experience network congestion like the public
Mainnet sometimes does.
▪
-
Private Network:
An Ethereum network is a private network if its nodes are not
connected to a public network (i.e. Mainnet or a testnet).
-
In this context, private only means reserved or isolated, rather than
protected or secure.
-
Has many same benefits and drawbacks as the open testnet but it
also differs in some ways.
-
Advantages:
You mine the first block yourself and no syncing is done
▪
No need to obtain test ether, you 'award' mining rewards to
yourself that you can use for testing.
▪
No other users are there.
▪
Yours is the only contract in a network after you launch it.
▪
-
Disadvantages:
Because there are no other users, it operates differently from a
public blockchain. There is no competition for transaction
space or transaction sequencing.
▪
Being the only miner, makes mining more predictable and
prevents you from testing various situations that take place on
a public blockchain.
▪
Since there are no other contracts, you must deploy all
dependencies and contract libraries that you want to test.
▪
To test specific scenarios you cannot duplicate certain public
contracts and their addresses. e.g.: the DOA contract.
▪
-
2.
Unit 5 Page 4
Downloaded by imran akhtar (imranakhtar351@gmail.com)
lOMoARcPSD|22844421
Ethereum Virtual Machine (EVM)
Ethereum Virtual Machine (EVM) is designed as the runtime environment
for smart contracts in Ethereum.
•
It is sandboxed and isolated from the other parts of the system.
•
This means that any operation on EVM should not affect your data or
programs in any way, no matter how many times you call a particular
function on it.
•
An EVM is the runtime environment that executes Ethereum smart
contracts.
•
Ethereum contains its own Turing-complete scripting language, called
Solidity, and with this comes a need to execute this code.
•
Solidity code can be executed in Ethereum Virtual Machine (EVM).
•
It runs on top of the Ethereum network, meaning that all nodes reach a
consensus about what code should be executed at every given time.
•
It is the computer that stores data on blockchain, like bitcoin, but it also
executes code in smart contracts on the Ethereum network.
•
The machine is made to be able to run any kind of Crypto-contract that can
be built on Ethereum’s blockchain.
•
It does this by using a programming language called Solidity, which is
compiled into the EVM for execution.
•
The intention behind writing code on the Ethereum network is to create
smart contracts and programs that automatically execute things when certain
conditions are met.
•
If a term or condition is not met, the system can execute it in an “exit”
function as well.
•
The Ethereum Virtual Machine makes the process of creating new tokens on
Ethereum Blockchain easy.
•
Here, script means a set of instructions or an algorithm which tells the
computer what it needs to do in order for something to work properly.
•
The EVM requires that one has access over any network node so as to be
able to execute the desired commands and create new tokens on the
blockchain without any difficulties.
•
Smart contract have some computer code which facilitates the exchange of
money and information.
•
These contracts are predefined by the creator of the smart contract, in order
to ensure that a certain outcome will happen based on either what happens
or doesn’t happen.
•
In the Ethereum ecosystem, EVM plays a vital role by providing a platform
for decentralized applications (Dapps) to be built on top of it.
•
Ethereum Virtual Machine ensures that all transactions and smart contracts
made on the Ethereum blockchain are executed in correct and expected
manner as desired by the smart contract code. It serves as a platform for
applications to be executed on.
•
Unit 5 Page 5
Downloaded by imran akhtar (imranakhtar351@gmail.com)
lOMoARcPSD|22844421
Ethereum Virtual Machine (EVM) has two parts:
EVM (the part that runs solidity source code):
The EVM is written in C++ and uses LLVM as its compiler.
▪
It is a full-featured virtual machine with all the features that you
would want in a general purpose Smart Contract Virtual Machine,
such as support for multiple programming languages, security
features, runtime environments and more.
▪
It also allows you to write custom EVM bytecode .
▪
-
Uncles:
These are small pieces of smart contracts or data stored on the
blockchain.
▪
This is a useful feature because it allows for you to store metadata
about your program.
▪
EVM Assembly: This is the bytecode of EVM, which you can use as
your programming language.
▪
-
•
These are small pieces of smart contracts or data stored on the blockchain.
•
This is a useful feature because it allows one to store metadata about the
program.
•
Benefits:
Execute untrusted code without risking data:
One can execute untrusted code without putting the data at risk.
▪
EVM guarantees that its computations will not interfere with
anything else happening in the system or with the personal files.
▪
-
Can run complex smart contracts:
One can run complex smart contracts in EVM without worrying
about how they interact with each other.
▪
One can write them once and then run them on multiple platforms,
which allows for the creation of a single contract that runs on
multiple computing environments.
▪
-
Deterministic processing:
Smart contracts written on EVM have access to all of Ethereum’s
states at any given time, allowing for processing to happen in a
deterministic way and giving more guarantees about their
correctness.
▪
For example, one cannot make an infinite loop in EVM by calling
the same function twice. It would stop executing and return a finite
value.
▪
-
Distributed consensus:
One of the potential applications of Ethereum is to allow for
distributed consensus where everyone is running the same program
but from their own computers.
▪
-
Robust against failure:
This is a complex process because the network needs to be able to
come to a consensus at any given time.
▪
-
•
Unit 5 Page 6
Downloaded by imran akhtar (imranakhtar351@gmail.com)
lOMoARcPSD|22844421
This way, the system becomes more robust against failures of
individual nodes and you can update several nodes simultaneously
without worrying that they might end up disagreeing with each
other because of how code was written.
▪
Easy to write stateful contracts:
From a developer perspective, EVM is designed for writing smart
contracts as well as for creating DApps (decentralized
applications), which are programs running on distributed networks
in a way that ensures all of them are seeing the same version.
▪
It also makes it incredibly easy to write stateful contracts, which
need access to some kind of persistent storage.
▪
-
Downsides of EVM
High gas cost:
In Ethereum, all transactions require a fee to execute.
▪
These fees are called “gas”, and are paid in ETH tokens.
▪
Gas is priced at the moment of execution, and depends on the
complexity of executing a transaction.
▪
The more difficult the computation for a transaction, the higher its
gas cost will be.
▪
-
High gas price during network congestion:
During times when there is high network congestion due to many
transactions being pushed onto the blockchain, gas prices rise
because there are fewer transactions that can go through (the same
amount of computational power has to service more transactions).
▪
-
Technical expertise required:
Writing smart contracts and using EVM requires technical
expertise.
▪
It’s a Turing-complete system, which allows programmers to write
scripts in any programming language they wish.
▪
This can be excellent or disastrous, depending on the intention
behind the code being written.
▪
Programming languages are not inherently good or bad in their
nature; it all depends on who is using them and for what purpose.
▪
The downside of this technology is that it could create a lot of
complicated problems because with more power comes more
responsibility for the writer of code.
▪
-
•
Schematics of EVM:
•
Unit 5 Page 7
Downloaded by imran akhtar (imranakhtar351@gmail.com)
lOMoARcPSD|22844421
Introduction to Smart Contracts
Smart contracts are digital contracts stored on a blockchain that are
automatically executed when predetermined terms and 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.
•
They can also automate a workflow, triggering the next action when
conditions are met.
•
Smart contracts are a set of conditions written in the form of code that meet
the agreed criteria between two involved parties.
•
The code that resides on the blockchain is distributed and highly secure.
•
This piece of code, when executed, gets registered in the form of a
blockchain transaction while ensuring the terms of the agreement are met.
•
This execution of smart contracts on the blockchain is immutable and
irreversible.
•
Hence, any smart contract execution is tracked from beginning to end of the
transaction cycle between the two parties involved.
•
It can be tracked chronologically in a transparent manner.
•
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.
•
Features:
Computer programs: They are simple computer programs.
1.
Immutable: Code cannot change after it is deployed.
2.
Deterministic: Given the circumstances of the transaction that triggered
the execution of the smart contract and the condition of the Ethereum
blockchain at the time of execution, the outcome of the execution of a
smart contract is the same for each user who runs it.
3.
EVM context: They operate with a very limited execution context. They
can access some information about the most recent blocks, the context
of the transaction that called them, and their own state.
4.
•
Unit 5 Page 8
Downloaded by imran akhtar (imranakhtar351@gmail.com)
lOMoARcPSD|22844421
Most smart contracts are created using a high-level language like Solidity.
•
However they need to be compiled into the low-level bytecode that the
EVM uses before they can be used.
•
They are then deployed on the Ethereum network after being created via a
unique contract created transaction.
•
Contracts only take effect when a transaction calls them.
•
Examples: Property rights, intellectual property, banking and insurance,
legal services, e-government, crowd funding, etc.
•
Types of smart contracts:
•
There are three types of self-executing contracts based on their applications.
Smart legal contracts: These contracts are legally enforceable and
require the parties to fulfil their contractual obligations. Failure to do
so may result in strict legal actions against them.
1.
Decentralized autonomous organizations: These are blockchain
communities that are bound to specific rules coded into blockchain
contracts combined with governance mechanisms. Hence, any action
taken by the community members gets replaced by a self-enforcing
code.
2.
Application logic contracts: These contracts contain an application
based code that remains in sync with other blockchain contracts. It
enables communication across different devices, such as the merger of
the Internet of Things with BT.
3.
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.
-
1.
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.
-
2.
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.
-
3.
Savings:
Smart contracts remove the need for intermediaries to handle
transactions and, by extension, their associated time delays and
fees.
-
4.
•
Unit 5 Page 9
Downloaded by imran akhtar (imranakhtar351@gmail.com)
lOMoARcPSD|22844421
Swarm (Decentralized Storage Platform)
Swarm is one of the latest projects to be built on Ethereum and is perhaps
the central piece of the entire decentralised ecosystem.
•
Swarm is a distributed storage platform and content distribution service, a
native base layer service of the Ethereum web3 stack.
•
Swarm is a censorship-resistant, permissionless, decentralised peer-to-peer
storage and communication platform.
•
Developed by Gavin Wood, Vitalik Buterin.
•
The main purpose of Swarm is to be a decentralised store for dApp code,
user data, blockchain data, and state data.
•
Swarm sets out to provide various base layer services for Web 3.0. Services
include node-to-node messaging, media streaming, decentralised database
services, and scalable state-channel infrastructure for decentralised service
economies.
•
It is a self-reliant system which is implemented through smart contracts
powered by Ethereum Blockchain and BZZ token.
•
It is basically a giant DHT (Distributed Hash Table) which acts as a
database where nodes or peers can discover where the data is stored.
•
Many modern decentralized protocols like IPFS (Inter Planetary File
System) and BitTorrent use DHT as a storage solution.
•
There are three main components that make up the Swarm decentralised
storage system:
Chunks:
Official unit of storage used in Swarm
-
These are pieces of data of limited size (max 4KB) that act as the
basic unit of storage and retrieval in Swarm.
-
Chunks are linked to unique addresses.
-
1.
Reference:
This is a unique identifier of a file that allows clients to retrieve
and access the content.
-
2.
Manifest:
This is a data structure describing file collections.
-
Each document defines its path, unique cryptographic hash, and its
content type.
-
Corresponding content hashes allows for URL-based content
retrieval.
-
3.
•
Unit 5 Page 10
Downloaded by imran akhtar (imranakhtar351@gmail.com)
lOMoARcPSD|22844421
Unit 5 Page 11
Downloaded by imran akhtar (imranakhtar351@gmail.com)
lOMoARcPSD|22844421
Whisper (Decentralized Messaging Platform)
Whisper is a decentralized peer-to-peer messaging, censor-resistant
communication protocol that allows communication between DApps.
•
It provides a simple API that we can use to send an encrypted message
through the Ethereum blockchain and receive and decrypted messages with
the hash key.
•
Goal is to make privacy an option for everyone.
•
It is a secure communication service, equipped with a built-in wallet,
capable of transferring and managing digital assets on the messenger.
•
Two nodes in a whisper network can communicate with each other without
leaving ant single traceable evidence to traffic analysers or peers, even
though these peers are participants in the message routing process.
•
Unit 5 Page 12
Downloaded by imran akhtar (imranakhtar351@gmail.com)
lOMoARcPSD|22844421
Unit 5 Page 13
Downloaded by imran akhtar (imranakhtar351@gmail.com)
lOMoARcPSD|22844421

More Related Content

Similar to blockchain technology note-unit-5-notes.pdf for sppu engineering students

Ethereum Blockchain with Smart contract and ERC20
Ethereum Blockchain with Smart contract and ERC20Ethereum Blockchain with Smart contract and ERC20
Ethereum Blockchain with Smart contract and ERC20Truong Nguyen
 
blockchain technology -unit-3-notes.pdf for engineering students
blockchain technology -unit-3-notes.pdf for engineering studentsblockchain technology -unit-3-notes.pdf for engineering students
blockchain technology -unit-3-notes.pdf for engineering studentsimranakhtar83
 
Blockchain types architecture
Blockchain types architectureBlockchain types architecture
Blockchain types architectureSKMohamedKasim
 
Blockchain, Bitcoin and Ethereum's Smart Contract
Blockchain, Bitcoin and Ethereum's Smart ContractBlockchain, Bitcoin and Ethereum's Smart Contract
Blockchain, Bitcoin and Ethereum's Smart ContractPrashant Shahi
 
Ethereum and the $50m Heist
Ethereum and the $50m HeistEthereum and the $50m Heist
Ethereum and the $50m HeistLaurence Kirk
 
How to Write & Deploy a Smart Contract
How to Write & Deploy a Smart ContractHow to Write & Deploy a Smart Contract
How to Write & Deploy a Smart ContractAll Things Open
 
Introduction to Ethereum
Introduction to EthereumIntroduction to Ethereum
Introduction to EthereumTerek Judi
 
Blockchain and BPM - Reflections on Four Years of Research and Applications
Blockchain and BPM - Reflections on Four Years of Research and ApplicationsBlockchain and BPM - Reflections on Four Years of Research and Applications
Blockchain and BPM - Reflections on Four Years of Research and ApplicationsIngo Weber
 
Blockchain Tech Approach Whitepaper
Blockchain Tech Approach WhitepaperBlockchain Tech Approach Whitepaper
Blockchain Tech Approach WhitepaperProperty Bihar
 
EcoSummit 2016 in Berlin Presentation - ConsenSys / RWE
EcoSummit 2016 in Berlin Presentation - ConsenSys / RWEEcoSummit 2016 in Berlin Presentation - ConsenSys / RWE
EcoSummit 2016 in Berlin Presentation - ConsenSys / RWEJohn Lilic
 
What Are Crypto Tokens & How Crypto Tokens Work?
What Are Crypto Tokens & How Crypto Tokens Work?What Are Crypto Tokens & How Crypto Tokens Work?
What Are Crypto Tokens & How Crypto Tokens Work?Blockchain Council
 
Ethereum (Blockchain Network)
Ethereum (Blockchain Network)Ethereum (Blockchain Network)
Ethereum (Blockchain Network)Qais Ammari
 
Top benefits to incur when you buy ethereum with Canadian dollars
Top benefits to incur when you buy ethereum with Canadian dollarsTop benefits to incur when you buy ethereum with Canadian dollars
Top benefits to incur when you buy ethereum with Canadian dollarsBitcoin Wallet Canada
 
Blockchains
BlockchainsBlockchains
BlockchainsIan Blum
 
Blockchain technology.docx
Blockchain technology.docxBlockchain technology.docx
Blockchain technology.docxaymenabbaci
 

Similar to blockchain technology note-unit-5-notes.pdf for sppu engineering students (20)

Ethereum Blockchain with Smart contract and ERC20
Ethereum Blockchain with Smart contract and ERC20Ethereum Blockchain with Smart contract and ERC20
Ethereum Blockchain with Smart contract and ERC20
 
blockchain technology -unit-3-notes.pdf for engineering students
blockchain technology -unit-3-notes.pdf for engineering studentsblockchain technology -unit-3-notes.pdf for engineering students
blockchain technology -unit-3-notes.pdf for engineering students
 
Blockchain types architecture
Blockchain types architectureBlockchain types architecture
Blockchain types architecture
 
Blockchain, Bitcoin and Ethereum's Smart Contract
Blockchain, Bitcoin and Ethereum's Smart ContractBlockchain, Bitcoin and Ethereum's Smart Contract
Blockchain, Bitcoin and Ethereum's Smart Contract
 
crypto ppt.ppt
crypto ppt.pptcrypto ppt.ppt
crypto ppt.ppt
 
Ethereum and the $50m Heist
Ethereum and the $50m HeistEthereum and the $50m Heist
Ethereum and the $50m Heist
 
How to Write & Deploy a Smart Contract
How to Write & Deploy a Smart ContractHow to Write & Deploy a Smart Contract
How to Write & Deploy a Smart Contract
 
What is ethereum
What is ethereumWhat is ethereum
What is ethereum
 
Introduction to Ethereum
Introduction to EthereumIntroduction to Ethereum
Introduction to Ethereum
 
Blockchain and BPM - Reflections on Four Years of Research and Applications
Blockchain and BPM - Reflections on Four Years of Research and ApplicationsBlockchain and BPM - Reflections on Four Years of Research and Applications
Blockchain and BPM - Reflections on Four Years of Research and Applications
 
Blockchain Tech Approach Whitepaper
Blockchain Tech Approach WhitepaperBlockchain Tech Approach Whitepaper
Blockchain Tech Approach Whitepaper
 
Blockchain
Blockchain Blockchain
Blockchain
 
Blockchain (1).pptx
Blockchain (1).pptxBlockchain (1).pptx
Blockchain (1).pptx
 
EcoSummit 2016 in Berlin Presentation - ConsenSys / RWE
EcoSummit 2016 in Berlin Presentation - ConsenSys / RWEEcoSummit 2016 in Berlin Presentation - ConsenSys / RWE
EcoSummit 2016 in Berlin Presentation - ConsenSys / RWE
 
What Are Crypto Tokens & How Crypto Tokens Work?
What Are Crypto Tokens & How Crypto Tokens Work?What Are Crypto Tokens & How Crypto Tokens Work?
What Are Crypto Tokens & How Crypto Tokens Work?
 
Ethereum bxl
Ethereum bxlEthereum bxl
Ethereum bxl
 
Ethereum (Blockchain Network)
Ethereum (Blockchain Network)Ethereum (Blockchain Network)
Ethereum (Blockchain Network)
 
Top benefits to incur when you buy ethereum with Canadian dollars
Top benefits to incur when you buy ethereum with Canadian dollarsTop benefits to incur when you buy ethereum with Canadian dollars
Top benefits to incur when you buy ethereum with Canadian dollars
 
Blockchains
BlockchainsBlockchains
Blockchains
 
Blockchain technology.docx
Blockchain technology.docxBlockchain technology.docx
Blockchain technology.docx
 

Recently uploaded

(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...ranjana rawat
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSCAESB
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)Suman Mia
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSRajkumarAkumalla
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSSIVASHANKAR N
 

Recently uploaded (20)

(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentation
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
 

blockchain technology note-unit-5-notes.pdf for sppu engineering students

  • 1. Studocu is not sponsored or endorsed by any college or university BT unit 5 notes Blockchain Technology (Savitribai Phule Pune University) Studocu is not sponsored or endorsed by any college or university BT unit 5 notes Blockchain Technology (Savitribai Phule Pune University) Downloaded by imran akhtar (imranakhtar351@gmail.com) lOMoARcPSD|22844421
  • 2. What is Ethereum The Ethereum platform was launched in 2015 by Buterin and Joe Lubin, founder of the blockchain software company ConsenSys. • Ethereum is a decentralized blockchain platform powered by blockchain technology that establishes a peer-to-peer network that securely executes and verifies application code, called smart contracts. • Cryptocurrency used is Ether (ETH). • Smart contracts allow participants to transact with each other without a trusted central authority. • Transaction records are immutable, verifiable, and securely distributed across the network, giving participants full ownership and visibility into transaction data. • Transactions are sent from and received by user-created Ethereum accounts. • A sender must sign transactions and spend Ether, Ethereum's native cryptocurrency, as a cost of processing transactions on the network. • Ethereum can be used by anyone to create any secured digital technology. • It has a token designed to pay for work done supporting the blockchain, but participants can also use it to pay for tangible goods and services if accepted. • Ethereum is designed to be scalable, programmable, secure, and decentralized. • It has risen to become the second-largest cryptocurrency by market value. It is outranked only by Bitcoin. • Ethereum, like other cryptocurrencies, involves blockchain technology. Imagine a very long chain of blocks. • All of the information contained in each block is added to every newly- created block with new data. Throughout the network, an identical copy of the blockchain is distributed. • This blockchain is validated by a network of automated programs that reach a consensus on the validity of transaction information. • No changes can be made to the blockchain unless the network reaches a consensus. This makes it very secure. • Consensus is reached using an algorithm commonly called a consensus mechanism. • Blockchain Ethereum Platform using Solidity 05 January 2023 21:02 Unit 5 Page 1 Downloaded by imran akhtar (imranakhtar351@gmail.com) lOMoARcPSD|22844421
  • 3. Ethereum uses the proof-of-stake algorithm, where a network of participants called validators create new blocks and work together to verify the information they contain. • The blocks contain information about the state of the blockchain, a list of attestations (a validator's signature and vote on the validity of the block), transactions, and much more. • Ethereum owners use wallets to store their ether. • A wallet is a digital interface that lets you access your ether stored on the blockchain. • Your wallet has an address, which is similar to an email address in that it is where users send ether, much like they would an email. • Ether is not actually stored in your wallet. Your wallet holds private keys you use as you would a password when you initiate a transaction. • You receive a private key for each ether you own. This key is essential for accessing your ether. • Use cases: Decentralized Finance (DeFi) DeFi is a network of financial applications built on top of blockchain networks. - It is different from existing financial networks because it is open and programmable, operates without a central authority, and enables developers to offer new models for payments, investing, lending, and trading. - By using smart contracts and distributed systems, customers can easily build secure decentralized financial applications. - Some popular DeFi platforms include Compound, Aave, UniSwap, and MakerDAO. - 1. Non-Fungible Tokens (NFTs) NFTs are unique and indivisible digital tokens that are useful for proving the provenance of rare assets, both digital and tangible. - For example, NFTs can be used by an artist to tokenize their work and ensure that their work is unique and belongs to them. - The ownership information is recorded and maintained on the blockchain network. - NFTs are also gaining popularity in the gaming industry because they allow interoperability between gaming platforms. - 2. • Types of Ethereum Networks Ethereum is a protocol that runs on thousands of computers simultaneously. • It uses blockchain technology to create distributed ledgers, which replace websites like Facebook and YouTube by decentralizing the network among users. • To have control over the shared blockchain, Ethereum employs different types of networks called “clusters” that are composed of individual “nodes” that are linked together in a peer-to-peer network. • Unit 5 Page 2 Downloaded by imran akhtar (imranakhtar351@gmail.com) lOMoARcPSD|22844421
  • 4. A node typically has an Ethereum client software running on it, and each node has a full copy of all other nodes’ databases. • Therefore, each node can independently verify and query the blockchain, which prevents malicious or rogue nodes from manipulating the shared information. • There are two types of Ethereum networks — public and private. Each network has its properties, uses, and limitations when it comes to transactions and smart contracts on the blockchain. Public Network: Operates in an open environment that allows anyone in the world with an internet connection to join and participate in the network. - Anyone may view, add and validate transactions as well as read previously created transactions. - The inclusion of transactions and the network's status are decided by consensus among peers. - Offers more opportunities for developers to deploy smart contracts and other apps - Makes it easier for malicious actors to take over the network by destroying or manipulating sensitive data. - Ethereum Mainnet - It is the main public Ethereum blockchain that has real value, real ETH and real consequences. ▪ Primary network at the moment. ▪ Mainnet is the primary public Ethereum production blockchain, where actual-value transactions occur on the distributed ledger. ▪ When people and exchanges discuss ETH prices, they're talking about Mainnet ETH. ▪ https://etherscan.io is the block explorer for Ethereum Mainnet which displays extensive information of all the mined blocks and other information. ▪ - Ethereum Testnets - In addition to Mainnet, there are public testnets. ▪ These are networks used by protocol developers or smart contract developers to test both protocol upgrades as well as potential smart contracts in a production-like environment before deployment to Mainnet. ▪ You should test any contract code you write on a testnet before deploying to Mainnet. ▪ Most testnets started by using a proof-of-authority consensus mechanism. ▪ This means a small number of nodes are chosen to validate transactions and create new blocks – staking their identity in the process. ▪ Alternatively, some testnets started off using a proof-of-work consensus mechanism with just a few permissioned miners. ▪ In Testnets, rewards are not given for proof-of-work mining. ▪ Sepolia and Goerli will be public proof-of-stake testnets used. ▪ - 1. • Unit 5 Page 3 Downloaded by imran akhtar (imranakhtar351@gmail.com) lOMoARcPSD|22844421
  • 5. ETH on testnets has no real value; therefore, there are no markets for testnet ETH. ▪ Since you need ETH to actually interact with Ethereum, most people get testnet ETH from faucets. ▪ Most faucets are webapps where you can input an address which you request for dummy ETH to be sent to. ▪ Public Testnet Advantages: A testnet node required substantially less data to sync and store. ▪ In a few hours, a testnet node can sync completely. ▪ Test ether, which is needed for transactions and contract deployment, has no value and is available for free from a number of faucets. ▪ Testnets are public blockchains that have a large user base and active contracts. ▪ - Public Testnet Disadvantages: Test ether is used instead of real money. Because there is nothing at risk, you cannot evaluate security against actual adversaries. ▪ Some features of a public blockchain are impossible to evaluate in a real-world setting on a testnet. ▪ Testnets do not experience network congestion like the public Mainnet sometimes does. ▪ - Private Network: An Ethereum network is a private network if its nodes are not connected to a public network (i.e. Mainnet or a testnet). - In this context, private only means reserved or isolated, rather than protected or secure. - Has many same benefits and drawbacks as the open testnet but it also differs in some ways. - Advantages: You mine the first block yourself and no syncing is done ▪ No need to obtain test ether, you 'award' mining rewards to yourself that you can use for testing. ▪ No other users are there. ▪ Yours is the only contract in a network after you launch it. ▪ - Disadvantages: Because there are no other users, it operates differently from a public blockchain. There is no competition for transaction space or transaction sequencing. ▪ Being the only miner, makes mining more predictable and prevents you from testing various situations that take place on a public blockchain. ▪ Since there are no other contracts, you must deploy all dependencies and contract libraries that you want to test. ▪ To test specific scenarios you cannot duplicate certain public contracts and their addresses. e.g.: the DOA contract. ▪ - 2. Unit 5 Page 4 Downloaded by imran akhtar (imranakhtar351@gmail.com) lOMoARcPSD|22844421
  • 6. Ethereum Virtual Machine (EVM) Ethereum Virtual Machine (EVM) is designed as the runtime environment for smart contracts in Ethereum. • It is sandboxed and isolated from the other parts of the system. • This means that any operation on EVM should not affect your data or programs in any way, no matter how many times you call a particular function on it. • An EVM is the runtime environment that executes Ethereum smart contracts. • Ethereum contains its own Turing-complete scripting language, called Solidity, and with this comes a need to execute this code. • Solidity code can be executed in Ethereum Virtual Machine (EVM). • It runs on top of the Ethereum network, meaning that all nodes reach a consensus about what code should be executed at every given time. • It is the computer that stores data on blockchain, like bitcoin, but it also executes code in smart contracts on the Ethereum network. • The machine is made to be able to run any kind of Crypto-contract that can be built on Ethereum’s blockchain. • It does this by using a programming language called Solidity, which is compiled into the EVM for execution. • The intention behind writing code on the Ethereum network is to create smart contracts and programs that automatically execute things when certain conditions are met. • If a term or condition is not met, the system can execute it in an “exit” function as well. • The Ethereum Virtual Machine makes the process of creating new tokens on Ethereum Blockchain easy. • Here, script means a set of instructions or an algorithm which tells the computer what it needs to do in order for something to work properly. • The EVM requires that one has access over any network node so as to be able to execute the desired commands and create new tokens on the blockchain without any difficulties. • Smart contract have some computer code which facilitates the exchange of money and information. • These contracts are predefined by the creator of the smart contract, in order to ensure that a certain outcome will happen based on either what happens or doesn’t happen. • In the Ethereum ecosystem, EVM plays a vital role by providing a platform for decentralized applications (Dapps) to be built on top of it. • Ethereum Virtual Machine ensures that all transactions and smart contracts made on the Ethereum blockchain are executed in correct and expected manner as desired by the smart contract code. It serves as a platform for applications to be executed on. • Unit 5 Page 5 Downloaded by imran akhtar (imranakhtar351@gmail.com) lOMoARcPSD|22844421
  • 7. Ethereum Virtual Machine (EVM) has two parts: EVM (the part that runs solidity source code): The EVM is written in C++ and uses LLVM as its compiler. ▪ It is a full-featured virtual machine with all the features that you would want in a general purpose Smart Contract Virtual Machine, such as support for multiple programming languages, security features, runtime environments and more. ▪ It also allows you to write custom EVM bytecode . ▪ - Uncles: These are small pieces of smart contracts or data stored on the blockchain. ▪ This is a useful feature because it allows for you to store metadata about your program. ▪ EVM Assembly: This is the bytecode of EVM, which you can use as your programming language. ▪ - • These are small pieces of smart contracts or data stored on the blockchain. • This is a useful feature because it allows one to store metadata about the program. • Benefits: Execute untrusted code without risking data: One can execute untrusted code without putting the data at risk. ▪ EVM guarantees that its computations will not interfere with anything else happening in the system or with the personal files. ▪ - Can run complex smart contracts: One can run complex smart contracts in EVM without worrying about how they interact with each other. ▪ One can write them once and then run them on multiple platforms, which allows for the creation of a single contract that runs on multiple computing environments. ▪ - Deterministic processing: Smart contracts written on EVM have access to all of Ethereum’s states at any given time, allowing for processing to happen in a deterministic way and giving more guarantees about their correctness. ▪ For example, one cannot make an infinite loop in EVM by calling the same function twice. It would stop executing and return a finite value. ▪ - Distributed consensus: One of the potential applications of Ethereum is to allow for distributed consensus where everyone is running the same program but from their own computers. ▪ - Robust against failure: This is a complex process because the network needs to be able to come to a consensus at any given time. ▪ - • Unit 5 Page 6 Downloaded by imran akhtar (imranakhtar351@gmail.com) lOMoARcPSD|22844421
  • 8. This way, the system becomes more robust against failures of individual nodes and you can update several nodes simultaneously without worrying that they might end up disagreeing with each other because of how code was written. ▪ Easy to write stateful contracts: From a developer perspective, EVM is designed for writing smart contracts as well as for creating DApps (decentralized applications), which are programs running on distributed networks in a way that ensures all of them are seeing the same version. ▪ It also makes it incredibly easy to write stateful contracts, which need access to some kind of persistent storage. ▪ - Downsides of EVM High gas cost: In Ethereum, all transactions require a fee to execute. ▪ These fees are called “gas”, and are paid in ETH tokens. ▪ Gas is priced at the moment of execution, and depends on the complexity of executing a transaction. ▪ The more difficult the computation for a transaction, the higher its gas cost will be. ▪ - High gas price during network congestion: During times when there is high network congestion due to many transactions being pushed onto the blockchain, gas prices rise because there are fewer transactions that can go through (the same amount of computational power has to service more transactions). ▪ - Technical expertise required: Writing smart contracts and using EVM requires technical expertise. ▪ It’s a Turing-complete system, which allows programmers to write scripts in any programming language they wish. ▪ This can be excellent or disastrous, depending on the intention behind the code being written. ▪ Programming languages are not inherently good or bad in their nature; it all depends on who is using them and for what purpose. ▪ The downside of this technology is that it could create a lot of complicated problems because with more power comes more responsibility for the writer of code. ▪ - • Schematics of EVM: • Unit 5 Page 7 Downloaded by imran akhtar (imranakhtar351@gmail.com) lOMoARcPSD|22844421
  • 9. Introduction to Smart Contracts Smart contracts are digital contracts stored on a blockchain that are automatically executed when predetermined terms and 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. • They can also automate a workflow, triggering the next action when conditions are met. • Smart contracts are a set of conditions written in the form of code that meet the agreed criteria between two involved parties. • The code that resides on the blockchain is distributed and highly secure. • This piece of code, when executed, gets registered in the form of a blockchain transaction while ensuring the terms of the agreement are met. • This execution of smart contracts on the blockchain is immutable and irreversible. • Hence, any smart contract execution is tracked from beginning to end of the transaction cycle between the two parties involved. • It can be tracked chronologically in a transparent manner. • 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. • Features: Computer programs: They are simple computer programs. 1. Immutable: Code cannot change after it is deployed. 2. Deterministic: Given the circumstances of the transaction that triggered the execution of the smart contract and the condition of the Ethereum blockchain at the time of execution, the outcome of the execution of a smart contract is the same for each user who runs it. 3. EVM context: They operate with a very limited execution context. They can access some information about the most recent blocks, the context of the transaction that called them, and their own state. 4. • Unit 5 Page 8 Downloaded by imran akhtar (imranakhtar351@gmail.com) lOMoARcPSD|22844421
  • 10. Most smart contracts are created using a high-level language like Solidity. • However they need to be compiled into the low-level bytecode that the EVM uses before they can be used. • They are then deployed on the Ethereum network after being created via a unique contract created transaction. • Contracts only take effect when a transaction calls them. • Examples: Property rights, intellectual property, banking and insurance, legal services, e-government, crowd funding, etc. • Types of smart contracts: • There are three types of self-executing contracts based on their applications. Smart legal contracts: These contracts are legally enforceable and require the parties to fulfil their contractual obligations. Failure to do so may result in strict legal actions against them. 1. Decentralized autonomous organizations: These are blockchain communities that are bound to specific rules coded into blockchain contracts combined with governance mechanisms. Hence, any action taken by the community members gets replaced by a self-enforcing code. 2. Application logic contracts: These contracts contain an application based code that remains in sync with other blockchain contracts. It enables communication across different devices, such as the merger of the Internet of Things with BT. 3. 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. - 1. 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. - 2. 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. - 3. Savings: Smart contracts remove the need for intermediaries to handle transactions and, by extension, their associated time delays and fees. - 4. • Unit 5 Page 9 Downloaded by imran akhtar (imranakhtar351@gmail.com) lOMoARcPSD|22844421
  • 11. Swarm (Decentralized Storage Platform) Swarm is one of the latest projects to be built on Ethereum and is perhaps the central piece of the entire decentralised ecosystem. • Swarm is a distributed storage platform and content distribution service, a native base layer service of the Ethereum web3 stack. • Swarm is a censorship-resistant, permissionless, decentralised peer-to-peer storage and communication platform. • Developed by Gavin Wood, Vitalik Buterin. • The main purpose of Swarm is to be a decentralised store for dApp code, user data, blockchain data, and state data. • Swarm sets out to provide various base layer services for Web 3.0. Services include node-to-node messaging, media streaming, decentralised database services, and scalable state-channel infrastructure for decentralised service economies. • It is a self-reliant system which is implemented through smart contracts powered by Ethereum Blockchain and BZZ token. • It is basically a giant DHT (Distributed Hash Table) which acts as a database where nodes or peers can discover where the data is stored. • Many modern decentralized protocols like IPFS (Inter Planetary File System) and BitTorrent use DHT as a storage solution. • There are three main components that make up the Swarm decentralised storage system: Chunks: Official unit of storage used in Swarm - These are pieces of data of limited size (max 4KB) that act as the basic unit of storage and retrieval in Swarm. - Chunks are linked to unique addresses. - 1. Reference: This is a unique identifier of a file that allows clients to retrieve and access the content. - 2. Manifest: This is a data structure describing file collections. - Each document defines its path, unique cryptographic hash, and its content type. - Corresponding content hashes allows for URL-based content retrieval. - 3. • Unit 5 Page 10 Downloaded by imran akhtar (imranakhtar351@gmail.com) lOMoARcPSD|22844421
  • 12. Unit 5 Page 11 Downloaded by imran akhtar (imranakhtar351@gmail.com) lOMoARcPSD|22844421
  • 13. Whisper (Decentralized Messaging Platform) Whisper is a decentralized peer-to-peer messaging, censor-resistant communication protocol that allows communication between DApps. • It provides a simple API that we can use to send an encrypted message through the Ethereum blockchain and receive and decrypted messages with the hash key. • Goal is to make privacy an option for everyone. • It is a secure communication service, equipped with a built-in wallet, capable of transferring and managing digital assets on the messenger. • Two nodes in a whisper network can communicate with each other without leaving ant single traceable evidence to traffic analysers or peers, even though these peers are participants in the message routing process. • Unit 5 Page 12 Downloaded by imran akhtar (imranakhtar351@gmail.com) lOMoARcPSD|22844421
  • 14. Unit 5 Page 13 Downloaded by imran akhtar (imranakhtar351@gmail.com) lOMoARcPSD|22844421