Unit - IV
Unit - IV
ETHEREUM
ETHEREUM
Ether cryptocurrency/tokens
The EVM
Smart contracts
KEYS AND ADDRESSES
The private key is generated randomly and is kept secret
public key is derived from the private key.
Addresses are derived from the public keys which are a 20-
bytes code used to identify accounts.
The process of key generation and address derivation is
described here:
2. Public key is then derived from this private key using ECDSA
recovery function.
CodeHash: Empty string as EOA does not have any associated code.
Storage: Empty string as EOA does not have any data to store.
CONTRACT ACCOUNTS (CAS)
the blockchain.
It can either be sent via a smart contract or from an external actor in the
Messages only exist in the execution environment and are never stored.
Ethereum environment.
4 Elements :
The post-transaction state: state after the transaction has been
executed. It is encoded as a byte array.
Gas used: total amount of gas used in the block that contains the
transaction receipt. The value is taken immediately after the transaction
execution is completed. The total gas used is expected to be a non-negative
integer.
Set of logs: Log entries contain the logger's address, a series of log topics,
and the log data.
The bloom filter: created from the information contained in the set of
element is likely to be in a set. It's used to Search for and retrieve data,
Uncles:
These are small pieces of smart contracts or data stored on the
blockchain.
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.
EVM participates in block creation and transaction execution.
In block creation, EVM sets standards for managing the state from
block to block. These states are stored in a Merkle Tree and hold the
ground truth state for Ethereum.
In transaction execution, the EVM executes tasks (e.g., function
calls to a smart contract) by interpreting the instructions in Opcodes.
To get the data into bytecode, use a programming language such as
Solidity (i.e., the native programming language for smart contracts)
to compile and deploy the smart contract using bytecode.
When the EVM executes tasks, it is limited to the amount of gas
provided by the transaction and the overall limitations of the EVM.
Gas is a unit of measure for computing power on Ethereum.
EVM ARCHITECTURE
TYPES OF SPACE IN THE EVM
Stack:
last-in, first-out container with a fixed size and maximum depth of
1,024 items to which values can be pushed and popped.
Each stack item is 256 bits long. This was chosen to facilitate the
Keccak- 256 hash scheme and elliptic- curve computations.
Memory:
This is a volatile and expandable word-addressed byte array.
Key/value store:
This is a word-addressable word array.
used as the long term account storage for the smart contract.
web3.js library
allows interaction with the node in the ethereum
network
DECENTRALIZED APPLICATION (DAPP)
Dapp is an application that uses smart contracts.
Dapp provides a user-friendly interface to smart contracts
Dapp main components are smart contract and files for web
user interface front-end/back-end
DAPP CREATION WORKFLOW
HOW DOES ETHEREUM WORK?
When a transaction triggers a smart contract all the nodes of the network will
All the nodes will run the EVM as part of the block verification, where the nodes will
go through the transactions listed in the block and runs the code as triggered by the
All the nodes on the network must perform the same calculations for keeping their
ledgers in sync.
If the total amount of gas needed to process the transaction is less than or equal to
the gas limit then the transaction will be processed and if the total amount of the gas
needed is more than the gas limit then the transaction will not be processed the fees
Thus it is safe to send transactions with the gas limit above the estimate to increase
VARIOUS ETHEREUM CLIENTS
Parity written in rust
Geth written in Go
part in frontier
Mine Ether
Unlock Account
Start mining
Transfer funds
Add fees
Contract creation
Cloud Mining
POOL MINING
Pool Mining is the easiest and fastest way to get started with
Ethereum Mining.
Miners will work along with other people together in a single pool.
Rewards will be shared by everyone in the pool.
Important Factors to be considered before joining a Pool are:
Pool size
Minimum Payout
Pool fee
Pool size is the factor that determines the number of blocks you
find in the Ethereum network and its share rewards. As the
number of miners increases, the chances to get rewards also
increase.
Minimum Payout is the minimum amount of Ethereum you need
to mine before it gets credited to your wallet.
Pools with large Minimum Payouts are not beneficial as you will
have to wait in the same pool for a longer period before getting
your reward.
Pool fee is the amount to be paid to continue using the pool.
This amount is percentage-based, on the amount of Ethereum
you are mining. It mainly varies between 1% to 3%
SOLO MINING
network.
The miner then verifies and validates the requested transaction and
all transactions.
Blockchain Network.
Burned fee
Miner Reward = Block reward+ gas fee+ uncle block reward – burned
fee