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

unit-5_blockchain-ethereum-platform-using-solidity-

blockchain

Uploaded by

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

unit-5_blockchain-ethereum-platform-using-solidity-

blockchain

Uploaded by

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

SNJB’s Late Sau. K. B. J.

College of Engineering
Subject :- Blockchain Technology

Unit 5
Blockchain Ethereum
Platform using Solidity

SNJB’s KBJ CoE | Civil | Computer | E&TC | Mechanical | AIDS | MBA | Visit Us @: www.snjb.org
SNJB’s Late Sau. K. B. J. College of Engineering

Outcome

CO4: Analyze the importance of blockchain in finding the


solution to the real-world problems.

CO5: Illustrate the Ethereum public blockchain platform

SNJB’s KBJ CoE | Civil | Computer | E&TC | Mechanical | AIDS | MBA | Visit Us @: www.snjb.org
SNJB’s Late Sau. K. B. J. College of Engineering

PO Mapping

PO1: Engineering Knowledge


PO2 : Problem Solving
PO3: design solution(Smart contract)
PO5: Modern Tool(Remix IDE)
PO12: lifelong learning(Job)

PSO1: Professional skills


PSO2: Problem solving

SNJB’s KBJ CoE | Civil | Computer | E&TC | Mechanical | AIDS | MBA | Visit Us @: www.snjb.org
SNJB’s Late Sau. K. B. J. College of Engineering

Syllabus
1. What is Ethereum 9.Swarm (Decentralized Storage
2. Types of Ethereum Networks Platform)
3. EVM (Ethereum Virtual 10. Whisper (Decentralized
Machine) Messaging Platform)
4. Introduction to smart contracts
5. Purpose and types of Smart Case Study:
Contracts Study Truffle Development
6. Implementing and deploying Environment
smart contracts using Solidity
SNJB’s Late Sau. K. B. J. College of Engineering

Ethereum
Ethereum is the second major innovation in
Blockchain since the invention of Bitcoin.
While Bitcoin can be described as a digital money.
Ethereum is a decentralized platform for
programming a digital money.
SNJB’s Late Sau. K. B. J. College of Engineering
What is Ethereum ??
● Ethereum is an open-source distributed computing platform for building
decentralized applications.
● Vitalik Buterin envisioned Ethereum as a platform for developers to write
programs on the blockchain.
● he used similar Blockchain designs & protocols as that of Bitcoin’s and improvised
it to support applications beyond currency issuance.
● Anyone across the globe can connect with Ethereum blockchain to develop a
program and can maintain the current state of the network, hence the term “World
Computer”.[1]
Ethereum
Founder
SNJB’s Late Sau. K. B. J. College of Engineering
SNJB’s Late Sau. K. B. J. College of Engineering
Ethereum
● Ethereum blockchain is an open-source global platform that supports
decentralized applications.
● It offers a programmability feature, coding is done in smart contracts.
● It runs its own currency named Ether and is abbreviated as ETH.
● It is a general-purpose blockchain capable of Executing code.[1]
● Ethereum split into two different blockchains in 2016 namely Ethereum(ETH),
and Ethereum Classic(ETC).

Blockchain Demo : Go PoW Vs PoS : View


SNJB’s Late Sau. K. B. J. College of Engineering
Working of Etherium
SNJB’s Late Sau. K. B. J. College of Engineering
Components of Ethereum
SNJB’s Late Sau. K. B. J. College of Engineering
Ethereum Component
1) Peer to peer network:

Ethereum blockchain is a peer to peer network, all computers or nodes are


connected with each clothes others

2) Nodes:

Any device whether a computer or a mobile, connected to the blockchain


containing the data are called nodes. All nodes are connected to each other.

3) Transactions:

The messages exchanged on the network are called transactions. A transaction


involves a value, a recipient, a sender, and a data [1]
SNJB’s Late Sau. K. B. J. College of Engineering
Ethereum Component
4) Consensus Rules:

The set of rules that is followed for considering the validity of a transaction and a
block in Ethereum called consensus rules.

5) Consensus Algorithm:

The consensus algorithm is the procedure to obtain agreement on the longest chain
in the distributed Ethereum network.

6) State Machine:

Ethereum transactions and state changes are processed by the state machine called
Ethereum Virtual Machine abbreviated as EVM.[1]
SNJB’s Late Sau. K. B. J. College of Engineering
Features of Ethereum

Ether Smart EVM


contracts

DAO DApp
SNJB’s Late Sau. K. B. J. College of Engineering
1. Ether
● Ether (ETH) is Ethereum cryptocurrency.
● It is used to pay for the computational resources and the transaction fees for any
transaction executed on the Ethereum network.
● Ether is also used to buy gas, which is used to pay for the computation of any
transaction made on the Ethereum network.
● if you want to deploy a contract on Ethereum, Gas is the execution fee paid
● Ether can be utilized for building decentralized applications, building smart
contracts, and making regular peer-to-peer payments.[3]
SNJB’s Late Sau. K. B. J. College of Engineering
GAS Ethereum
● Just like we need fuel to run a car, we need gas to run applications on the
Ethereum network.
● Paying out ethers, to get a transaction done, value given is called gas.
● Gas is a unit that measures the computational power required to run a smart contract
or a transaction.
SNJB’s Late Sau. K. B. J. College of Engineering
2. Smart Contract
● A smart contract is a simple computer program that facilitates the exchange of
any asset between two parties. Concept invent by Nick Szabo
● It could be money, shares, property, or any other digital asset that you want to
exchange.
● The contract consists primarily of the terms and conditions mutually agreed on
between the parties (peers).
● Smart contracts are written in programming languages such as Solidity and Vyper
● Compiled by the Ethereum Virtual Machine into bytecode and executed on the
blockchain.
SNJB’s Late Sau. K. B. J. College of Engineering
2. Smart Contract
● primary feature is that once it is executed, it cannot be altered(Immutable)
● The verification process for the smart contracts is carried out by anonymous parties
without the need for a centralized authority(decentralized)
● The transfer of any asset or currency is done in a transparent and trustworthy
manner,
● Once the transaction is successfully done, the accounts of the sender and receiver
are updated accordingly
SNJB’s Late Sau. K. B. J. College of Engineering
2. Smart Contract
SNJB’s Late Sau. K. B. J. College of Engineering
2. Smart Contract : Example
SNJB’s Late Sau. K. B. J. College of Engineering

Smart Contract:
Advantage

“Smart contracts help you


exchange property, shares, or
anything of value in a
transparent, conflict-free way
while avoiding the services of a
middleman.”
SNJB’s Late Sau. K. B. J. College of Engineering
Ethereum Virtual Machine (EVM)
● EVM is runtime environment for compiling and deploying Ethereum-based
smart contracts.
● EVM is the engine that understands the language of smart contracts, which are
written in the Solidity language
● The Ethereum virtual machine is the engine in which transaction code gets executed
● E.V.M. enables the development of thousands of different applications all on one
platform
● Contracts written in a smart contract-specific programming language are compiled
into ‘bytecode’, which an EVM can read and execute
SNJB’s Late Sau. K. B. J. College of Engineering
How EVM Work??
1) Transaction:
● Suppose person A wants to pay person B 10 ethers, The transaction will be sent to
the EVM using a smart contract for a fund transfer from A to B.
● To validate the transaction; the Ethereum network will perform the consensus
algorithm.
● The miner nodes on Ethereum will validate this transaction
● Once the transaction is confirmed, the ether will be debited from A’s wallet and will
be credited to B’s wallet
● In this process, the miners will charge a fee to validate transaction and will earn a
reward.
SNJB’s Late Sau. K. B. J. College of Engineering
How EVM Work??
SNJB’s Late Sau. K. B. J. College of Engineering
Ethereum
SNJB’s Late Sau. K. B. J. College of Engineering

Decentralized Autonomous Organization (DAO)


● A DAO is a digital organization that operates without hierarchical management; it
works in a decentralized and democratic fashion.
● Decision-making is not in the hands of a centralized authority but preferably in the hands
of certain designated authorities or a group or designated people as a part of an
authority.
● DAOs rely on smart contracts for decision-making—or, we can say, decentralized voting
systems—within the organization.
● So, before any organizational decision can be made, it must go through the voting system,
which runs on a decentralized application.
SNJB’s Late Sau. K. B. J. College of Engineering
Decentralized Autonomous Organization (DAO)
SNJB’s Late Sau. K. B. J. College of Engineering
Hard & Soft Fork
SNJB’s Late Sau. K. B. J. College of Engineering

● Wondering what can be built on Ethereum? Well,


Ethereum can be used to build some really cool
applications called DApps.
SNJB’s Late Sau. K. B. J. College of Engineering
Decentralized Applications(DApp)
● DApps are computer applications that operate over a blockchain
enabling direct interaction between end users and providers
● Eg. When you log in to Twitter,
● a web application gets displayed
● The page will call an API to access your data (your information)
which is centrally hosted in centralized database.
● If we transform this application into a decentralized application
when you log in
● The same web application gets rendered, but it calls a smart
contract-based API to fetch the information from the blockchain
SNJB’s Late Sau. K. B. J. College of Engineering
Decentralized Applications(DApp)
SNJB’s Late Sau. K. B. J. College of Engineering
Bitcoin vs Ether
Parameter Bitcoin(BTC) Ether (ETH)

Founded 2009 2015

Trading Digital currency Cryptocurrency,Smart


contract and other
exchange
Block Time 10 min 12 sec

Consensus Protocol Proof-of-Work Proof-of-Stake

Reward 12.5 BTC 3 ETH


SNJB’s Late Sau. K. B. J. College of Engineering
It’s Quiz Time
SNJB’s Late Sau. K. B. J. College of Engineering
Types of Ethereum Network

View View

Ether Transaction ● Rinkeby Faucet: View


SNJB’s Late Sau. K. B. J. College of Engineering
Implementing and deploying smart
contracts using Solidity
● Remix IDE : View

● Solidity :
● An object-oriented programming language
● It is used to design and implement smart contracts within the Ethereum Virtual
Platform and several other Blockchain platforms.
● Solidity is a statically-typed programming language
● Ethereum Solidity is a contract-oriented, high-level language with syntax like that of
JavaScript.
SNJB’s Late Sau. K. B. J. College of Engineering
Basics of Solidity
SNJB’s Late Sau. K. B. J. College of Engineering

*** First Program in Solidity ***

// SPDX-License-Identifier: MIT
// compiler version must be greater than or equal to 0.8.13
and less than 0.9.0
pragma solidity ^0.8.13;

contract HelloWorld {
string public greet = "Hello World!";
}
SNJB’s Late Sau. K. B. J. College of Engineering
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

*** contract Counter {


uint public count;
Second Program in
// Function to get the current count
Solidity function get() public view returns (uint) {
*** return count;
}

// Function to increment count by 1


function inc() public {
count += 1;
}
For more Examle
// Function to decrement count by 1
function dec() public {
https://solidity-by-example.org/ // This function will fail if count = 0
count -= 1;
}
}
SNJB’s Late Sau. K. B. J. College of Engineering
SWARM
● Swarm was created by Ethereum co-founder Gavin Wood
● Swarm is a distributed storage platform and content distribution service,
● The primary objective of Swarm is to provide a decentralized and redundant store for
dapp code and data as well as blockchain
● Swarm is also set out to provide various base layer services for web3, including
node-to-node messaging, media streaming, decentralised database services
● Chunks: Data stored on Swarm is split up into smaller blocks called chunks no larger
than 4KB. Chunks are identifiable via a 32-byte hash of the content they contain.
● Reference: A unique file identifier that facilitates the retrieval of data stored in
chunks for clients.
● Manifest: A data structure that allows for URL-based content retrieval.
SNJB’s Late Sau. K. B. J. College of Engineering
SWARM

Book of Swarm - “If the Ethereum blockchain is the CPU of the world computer then
Swarm is the hard disk.”
SNJB’s Late Sau. K. B. J. College of Engineering
Whisper( Decentralized Messaging Platform )
● Whisper provides decentralized peer-to-peer messaging capabilities to the Ethereum
network.
● Whisper is a communication protocol that DApps use to communicate with each
other.
● The data and routing of messages are encrypted within Whisper communications.
● Whisper is also designed to provide a communication layer that cannot be traced and
provides dark communication between parties.
● Blockchain can be used for communication, but that is expensive, and a consensus is
not really required for messages exchanged
SNJB’s Late Sau. K. B. J. College of Engineering
Whisper( Decentralized Messaging Platform )
SNJB’s Late Sau. K. B. J. College of Engineering
Case Study : Study Truffle Development Environment
● Truffle is a one-stop solution for building DApps: Compiling Contracts, Deploying
Contracts, Injecting it into a web app, Creating front-end for DApps and Testing.
Truffle Suite has three components:

1. Truffle : It is a Development Environment, Testing Framework for Ethereum


Blockchains
2. Ganache : Ganache is a personal Ethereum Blockchain used to test smart contracts
where you can deploy contracts, develop applications, run tests and perform other
tasks without any cost
3. Drizzle : Drizzle is a collection of libraries used to create easy and better front-end
for Ethereum DApps
SNJB’s Late Sau. K. B. J. College of Engineering
References
https://www.simplilearn.com/learn-blockchain-basics-skillup?utm_campaign=Skillup-Blockchain&utm_
medium=DescriptionFirstFold&utm_source=youtube…Certification

1. https://www.theengineeringprojects.com/2021/06/ethereum-blockchain.html
2. https://www.edureka.co/blog/what-is-ethereum/
3. https://www.simplilearn.com/tutorials/blockchain-tutorial/what-is-ethereum
4. https://originstamp.com/blog/what-is-ethereum-and-what-are-its-use-cases/
5. https://www.bitpanda.com/academy/en/lessons/how-do-hard-and-soft-forks-work/
6. Book : “Introducing Ethereum and Solidity” by Chris Dannen [ Apress ]
7. https://intellipaat.com/blog/tutorial/blockchain-tutorial/what-is-solidity/
8. https://www.bitcoinsuisse.com/news/what-is-swarm
9. https://hackernoon.com/a-brief-introduction-to-ethereum-swarm
10. https://www.oreilly.com/library/view/mastering-blockchain/9781788839044/179582cb-9b26-4f60-
b176-7e577ed9a325.xhtml
11. https://www.edureka.co/blog/developing-ethereum-dapps-with-truffle
12. https://moralis.io/truffle-explained-what-is-the-truffle-suite/
13. https://distinguished.io/blog/what-is-truffle-blockchain

You might also like