Professional Documents
Culture Documents
1
MODULE 3 :Syllabus
Ethereum Blockchain
The Ethereum network, Components of the Ethereum ecosystem, Ethereum
Virtual Machine Execution Environment, Opcodes and their meaning,
Structure of a Block, Genesis Block, Merkle tree, Geth, Transactions,
Transaction receipts, Nonce, Gas - gasPrice, gasLimit, Ether, Mining, Wallets,
Ethereum network (main net, test net)
2
Module 3
Ethereum
Blockchain
Development
7
What is
Ethereum?
What is Ethereum?
Ethereum is the open source decentralized software program that allows you to
create and deploy applications.
What is Ethereum Blockchain ?
❖ Ethereum is an operating system for Decentralized Applications and smart
contracts. The cryptocurrency generated by the Ethereum blockchain is called
Ether.
❑ DApps are a tamper-proof and secure way to record contracts called smart contracts
12
The Ethereum blockchain
Components of the Ethereum ecosystem
The Ethereum Network
The Ethereum network is a peer-to-peer network where nodes participate in order to maintain the blockchain and contribute
to the consensus mechanism. Networks can be divided into three types, based on the requirements and usage.
The mainnet
The mainnet is the current live network of Ethereum. Its network ID is 1 and its chain ID is also 1. The network and chain IDs
are used to identify the network. This can be used to explore the Ethereum blockchain.
Testnets
There is a number of testnets available for Ethereum testing. The aim of these test blockchains is to provide a testing
environment for smart contracts and DApps before being deployed to the production live blockchain.
Private nets
As the name suggests, these are private networks that can be created by generating a new genesis block. This is usually the
case in private blockchain networks, where a private group of entities start their blockchain network and use it as a
permissioned or consortium blockchain.
The Ethereum Virtual Machine (EVM)
There are three main types of storage available for contracts and the EVM:
Memory: The first type is called memory or volatile memory, which is a word-addressed byte
array. When a contract finishes its code execution, the memory is cleared. It is akin to the
concept of RAM. write operations to the memory can be of 8 or 256 bits, whereas read
operations are limited to 256-bit words. Memory is unlimited but constrained by
gas fee requirements.
Storage: The other type is called storage, which is a key-value store and is permanently
persisted on the blockchain. Keys and values are each 256 bits wide. It is allocated to all
accounts on the blockchain. As a security measure, storage is only accessible by its own
respective CAs. It can be thought of as hard disk storage.
Stack: EVM is a stack-based machine, and thus performs all computations in a data area called
the stack. All in-memory values are also stored in the stack. It has a maximum depth of 1024
elements and supports the word size of 256 bits
The Ethereum Virtual Machine (EVM)
Execution environment
There are some key elements that are required by the execution environment to execute the code. The key
parameters are provided by the execution agent; for example, a transaction. These are listed as follows:
• The address of the sender of the transaction. This is the originating address of this execution (it can be different
• Input data or transaction data depending on the type of executing agent. This is a byte array; in the case of a
message call, if the execution agent is a transaction, then the transaction data is included as input data.
Execution environment
• The address of the account that initiated the code execution or transaction sender. This is the address of the
sender in case the code execution is initiated by a transaction; otherwise, it is the address of the account.
• The value or transaction value. This is the amount in Wei. If the execution agent is a transaction, then it is the
transaction value.
• The code to be executed presented as a byte array that the iterator function picks up in each execution cycle.
• The number of message calls or contract creation transactions (CALLs, CREATEs or CREATE2s) currently in
execution.
func(x): 3 gas
a = x + 1 30 gas
b = 20000 gas
hash(a) 20033
Mem[0] = gas
I want to run
func(1) How Much?
89
Blockchain and Ethereum architecture
How are blocks related to each other?
What is Genesis Block and why Genesis Block is needed?
The genesis block is the first block in any blockchain-based protocol. It is the basis on which additional blocks are
added to form a chain of blocks, hence the term blockchain.
Without Genesis Block, it would be really difficult for the miners to trust a blockchain and to know when and
how it started. This would be extremely impractical.
The Genesis Block
Geth
❖ Geth is the official client software provided by the Ethereum Foundation.
❖ It is written in the Go programming language. When you start geth, it connects to other Ethereum clients (also
❖ It will constantly communicate with other nodes to keep it’s copy of the blockchain up to date.
❖ It also has the ability to mine blocks and add transactions to the blockchain, validate the transactions in the
Bitcoin Ethereum
▪ Bitcoin is the first decentralised cryptocurrency created ▪ Ethereum was released in 2015 by a cryptocurrency
research and programmer named Vitalik Buterin
in 2009 by an unknown person named Satoshi
▪ A decentralised programmable platform which supports
Nakamoto
DApps (distributed applications) running smart contracts
• Transactions contain
• Recipient address
• Ether to send
• STARTGAS value
• GASPRICE value
Transaction (stored on blockchain)
• Transaction has a message, …here is snapshot from Remix, for the Ballot register()
decoded output {}
logs []
value 0 wei
MINING
IN
ETHEREUM
Mining
❑The Nonce is a random whole number, which is a 32-bit (4 byte) field, which is
adjusted by the miners, so that it becomes a valid number to be used for hashing
the value of block. Nonce is the number which can be used only once.
Nonce
Thank You