Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
22 views31 pages

Module 4 - Public Blockchain

Public blockchains are decentralized, transparent, and immutable networks that allow open participation, enabling anyone to access and contribute to the system. Ethereum, a prominent public blockchain, supports smart contracts and decentralized applications, utilizing a Proof of Stake consensus mechanism for enhanced energy efficiency. While public blockchains offer advantages like security and inclusivity, they face challenges such as scalability, energy consumption, and regulatory uncertainty.

Uploaded by

mabhijeet
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views31 pages

Module 4 - Public Blockchain

Public blockchains are decentralized, transparent, and immutable networks that allow open participation, enabling anyone to access and contribute to the system. Ethereum, a prominent public blockchain, supports smart contracts and decentralized applications, utilizing a Proof of Stake consensus mechanism for enhanced energy efficiency. While public blockchains offer advantages like security and inclusivity, they face challenges such as scalability, energy consumption, and regulatory uncertainty.

Uploaded by

mabhijeet
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 31

Module 4:- Public Blockchain

A public blockchain is a type of distributed ledger technology that is open to anyone,


allowing all participants to access, view, and contribute to the network without
needing permission from a central authority. This openness is one of its defining
characteristics, fostering a decentralized and transparent environment.

Key Characteristics

1. Decentralization: Public blockchains do not rely on a central authority or single


entity. Instead, they operate on a peer-to-peer network where multiple nodes validate
and record transactions.

2. Transparency: All transactions are visible to anyone who accesses the blockchain,
ensuring that data can be verified and audited by any participant.

3. Immutability: Once data is recorded on a public blockchain, it cannot be altered or


deleted easily, providing a secure and permanent record of transactions.

4. Consensus Mechanisms: Public blockchains use consensus algorithms, such as


Proof of Work (PoW) or Proof of Stake (PoS), to validate transactions and maintain
the integrity of the network.

5. Open Participation: Anyone can join the network, contribute to transaction


validation, and access the data stored on the blockchain, promoting inclusivity.

Advantages of Public Blockchains

1. Decentralization: No single entity controls the network, reducing the risk of


corruption or manipulation. This empowers users and promotes a trustless
environment.

2. Transparency: All transactions are publicly recorded on the blockchain, allowing


anyone to verify and audit them. This enhances accountability and trust among
participants.
3. Immutability: Once data is recorded on the blockchain, it cannot be altered or
deleted easily. This ensures a permanent and secure record of transactions.

4. Security: Public blockchains use advanced cryptographic techniques to secure data,


making them resistant to hacking and fraud. The decentralized nature further
enhances security against attacks.

5. Accessibility: Anyone can participate in the network, whether by viewing


transactions or contributing to the validation process. This inclusivity fosters a diverse
ecosystem.

Challenges and Limitations

1. Scalability: As the number of users and transactions increases, public blockchains


can experience slower transaction speeds and higher latency. This can hinder their
ability to handle large volumes of transactions effectively.

2. Energy Consumption: Consensus mechanisms like Proof of Work (PoW) require


significant computational power, leading to high energy consumption. This raises
environmental concerns and sustainability issues.

3. Privacy Concerns: While transparency is a strength, it can also pose privacy risks.
All transactions are visible on the blockchain, which may expose sensitive user
information.

4. Regulatory Uncertainty: The decentralized nature of public blockchains often


creates challenges in regulatory compliance. Governments are still developing
frameworks to address issues related to cryptocurrencies and blockchain technologies.

5. Vulnerability to Attacks: Although public blockchains are generally secure, they are
still susceptible to certain attacks, such as Sybil attacks or 51% attacks, where an
entity gains control over a majority of the network’s computational power.
Ethereum

Ethereum is a Blockchain network that introduced a built-in Turing-complete programming


language that can be used for creating various decentralized applications(also called Dapps). The
Ethereum network is fueled by its own cryptocurrency called ‘ether’.

● The Ethereum network is currently famous for allowing the implementation of smart
contracts. Smart contracts can be thought of as ‘cryptographic bank lockers’ which
contain certain values.

● These cryptographic lockers can only be unlocked when certain conditions are met.

● Unlike bitcoin, Ethereum is a network that can be applied to various other sectors.

● Ethereum is often called Blockchain 2.0 since it proved the potential of blockchain
technology beyond the financial sector.

● The consensus mechanism used in Ethereum is Proof of Stakes(PoS), which is more


energy efficient when compared to that used in the Bitcoin network, that is, Proof of
Work(PoW). PoS depends on the amount of stake a node holds.

Features of Ethereum

Now, have a look at the features of Ethereum that make it so different from other
cryptocurrencies.

● Ethereum ensures all the transactions in the Ethereum blockchain are


cryptographically more secure.
● All transactions performed under the Ethereum blockchain are immutable. That is,
once the data is written and stored, it cannot change. This makes it more difficult to
hack or manipulate.
● Ethereum has the largest developer community globally, which gives it a tremendous
advantage over other protocols.
● You can instantly connect the applications built on Ethereum to hundreds of different
protocols like finance and marketing, known as money legos.

1. Smart contracts: Ethereum allows the creation and deployment of smart contracts.
Smart contracts are created mainly using a programming language called solidity.
Solidity is an Object Oriented Programming language that is comparatively easy to
learn.

2. Ethereum Virtual Machine (EVM): It is designed to operate as a runtime environment


for compiling and deploying Ethereum-based smart contracts.

3. Ether: Ether is the cryptocurrency of the Ethereum network. It is the only acceptable
form of payment for transaction fees on the Ethereum network.

4. Decentralized applications (Daaps): Dapp has its backend code running on a


decentralized peer-to-peer network. It can have a frontend and user interface written
in any language to make calls and query data from its backend. They operate on
Ethereum and perform the same function irrespective of the environment in which
they get executed.

5. Decentralized autonomous organizations (DAOs): It is a decentralized organization


that works in a democratic and decentralized fashion. DAO relies on smart contracts
for decision-making or decentralized voting systems within the organization.
Components of Ethereum Network:
Component-1 :
Nodes –
There are two types of nodes in an Ethereum network. They are as follows.

1. Mining Node –
These nodes are responsible for writing all the transactions that have occurred in the
Ethereum network in the block.

2. Ethereum Virtual Machine Node –


These are the nodes in the Ethereum network in which Smart Contracts (it is a type of
contract between supporter and developer in which there are a set of rules based on
which both the parties agree to interact with each other. The agreement will be
automatically executed when the pre-defined rules are met.) are implemented. By
default, this node utilizes a 30303 port number for the purpose of communication
among themselves.

3. Seed Node

4. Peer Node

Component-2 :
Ether –

● Just like we have money to do the exchange of goods in real world, we need Ethers to
exchange data or perform any kind of operation in Ethereum Blockchain. Ether is a
type of cryptocurrency used in the Ethereum network just like a bitcoin is used in a
blockchain network. It is a peer-to-peer currency, similar to Bitcoin. It tracks and
promotes each transaction in the network.

● It is the second-largest cryptocurrency in the world. The first one is Bitcoin. Other
cryptocurrencies can be used to get ether tokens, but vice versa is not true.

● It means that ether tokens can’t be interchanged by other cryptocurrencies to render


computing power for Ethereum transactions. Ether is paid as a commission for any
execution that affects the state of Ethereum.

● It is used in the Ethereum algorithm as an incentive for miners who connect blocks to
the blockchain using a proof-of-work method.

● It is the only currency that can be used to pay transaction costs, which go to miners as
well. The block reward, as well as transaction fees, provide miners with an
opportunity to keep the blockchain rising.

● Aside from paying for transactions, ether is often used to purchase gas, which is used
to pay for the computation of any transaction on the Ethereum network.

Component-3 :
Gas –

● Gas is an internal currency of the Ethereum network. We need gas to run applications
on the Ethereum network, much as we need gas to run a vehicle.

● To complete every transaction on the Ethereum network, a consumer must first make
a payment—send out ethers—and the intermediate monetary value is known as gas.

● Gas is a unit of measurement on the Ethereum network for the computing power used
to execute a smart contract or a transaction.

● The price of gas is very low compared to Ether. The execution and resource
utilization costs are predetermined in Ethereum in terms of Gas units, called gwei.
Component-4 :
Ethereum Accounts –
There are two types of Ethereum accounts. They are as follows.

1. Externally owned account (EOA) –


These accounts are used to store transactions.

2. Contract account –
As the name itself suggests, these accounts store the details of Smart Contracts.

Component-5 :
Nonce –
For externally owned accounts, nonce means the number of transactions via this account. For a
contract account, nonce means the number of contracts generated via this account.

Component-6 :
Storage Root –
It is the main root node of a Merkle tree. Hash of all details of the account is stored here. The
root of the Merkle tree is the verification of all transactions.

Component-7 : Algorithm Used

● Ethash
The intended PoW algorithm for Ethereum 1.0 is Ethash. It’s the most recent version
of Dagger-Hashimoto, however, it’s no longer proper to call it that because many of
the algorithms’ initial characteristics have been dramatically altered in the previous
month of study and development. Since ethereum transitioned to Proof of Stake (PoS)
in 2022, ethash has become legacy and the PoS Algorithm used is – “Clique”.

Component-8 :
Execution Client –
These are core components that act as the heart of ethereum, and facilitates transaction
processing, maintaining state, and ensuring every node is following the consensus rules. Here are
key responsibilities :-

● Handling the transactions sent to the ethereum network.

● Keeping track of current state of the blockchain, syncing with the overall networks
that involves account balances, smart contract execution and block information

● Validating blocks and ensuring they adhere to the ethereum network’s agreed upon
rules

Some examples are Geth, Nethermind, Besu etc.

Component-9 :
Consensus Client –

A consensus client is a software that implements the Proof-of-Stake Algorithm and helps the
blockchain network ensure that all the nodes agree on the state of the blockchain. It has the
following key responsibilities :-

● Transaction Validation : Ensuring that any transaction made over the ethereum
network adhere to the rules and guidelines set

● Block Proposal: Block proposal is the process of organizing a set of valid transaction
into groups and then broadcasting them to the ethereum network for proposal as
including them in the network.

Algorithm:
The algorithm follows the following general path as follows.

1. There is a seed for each block that may be determined by reading over the block
headers till that point.

2. A 16 MB pseudo-random cache may be computed from the seed. The cache is saved
by light clients.
3. We can construct a 1 GB dataset from the cache, with the condition that each item in
the dataset is dependent on just a few cache items. The dataset is stored by full clients
and miners. The dataset expands linearly over time.

4. Taking random slices of the dataset and hashing them together is what mining is all
about. Verification may be done with little memory by utilizing the cache to renew
just the parts of the dataset that you require, requiring just the cache to be stored.

Mining in Ethereum

Ethereum mining is a process that verifies new transactions in the Ethereum blockchain and their
addition to blocks combined with issuing the crypto coins.
The benefits of Ethereum mining include:

1. Security: Ethereum miners help to secure the network by verifying and adding transactions to

the blockchain.

2. Decentralization: Ethereum mining is a decentralized process, which means that anyone can

participate in the mining process and help to secure the network.

3. Earnings: Ethereum miners are rewarded with Ethereum for their efforts in verifying and

adding transactions to the blockchain.

4. Potential: The Ethereum network is still in its early stages, and as it grows, so too will the

rewards for miners.

5. Participation: Ethereum mining is a great way to get involved in the Ethereum network and to

help secure its future.

History of Ethereum
● 2013: Ethereum was first described in Vitalik Buterin’s white paper in 2013 with the
goal of developing decentralized applications.

● 2014: In 2014, EVM was specified in a paper by Gavin Wood, and the formal
development of the software also began.

● 2015: In 2015, Ethereum created its genesis block marking the official launch of the
platform.

● 2018: In 2018, Ethereum took second place in Bitcoin in terms of market


capitalization.

● 2021: In 2021, a major network upgrade named London included Ethereum


improvement proposal 1559 and introduced a mechanism for reducing transaction fee
volatility.

● 2022: In 2022, Ethereum has shifted from PoW( Proof-of-Work ) to PoS( Proof-of-
State ) consensus mechanism, which is also known as Ethereum Merge. It has
reduced Ethereum’s energy consumption by ~ 99.95%.

Benefits of Ethereum
● Availability: As the Ethereum network is decentralized so there is no downtime.
Even if one node goes down other computing nodes are available.

● Privacy: Users don’t need to enter their personal credentials while using the network
for exchanges, thus allowing them to remain anonymous.

● Security: Ethereum is designed to be unhackable, as the hackers have to get control


of the majority of the network nodes to exploit the network.

● Less ambiguity: The smart contracts that are used as a basis for trade and agreement
on Ethereum ensure stronger contracts that differ from the normal traditional
contracts which require follow-through and interpretation.
● Rapid deployment: On Ethereum decentralized networks, enterprises can easily
deploy and manage private blockchain networks instead of coding blockchain
implementation from scratch.

● Network size: Ethereum network can work with hundreds of nodes and millions of
users.

● Data coordination: Ethereum decentralized architecture better allocates information


so that the network participants don’t have to rely on a central entity to manage the
system and mediate transactions.

Drawback of Ethereum
● Complicated programming language: Learning solidity from programming smart
contracts on Ethereum can be challenging and one of the main concerns is the scarcity
of beginner-friendly classes.

● Volatile cryptocurrency: Ethereum investing can be risky as the price of Ether is


very volatile, resulting in significant gains as well as a significant loss.

● Low transaction rate: Bitcoin has an average transaction rate of 7TPS and Ethereum
has an average speed of 15 TPS which is almost double that of bitcoin but it is still
not enough.

Basis Bitcoin Ethereum

Bitcoin Ethereum is a
Definition (abbreviation: BTC; decentralized global
sign: ₿) is a
decentralized software platform
digital currency powered by blockchain
that can be technology. It is most
transferred on the commonly known for its
peer-to-peer native cryptocurrency,
bitcoin network. ether (ETH).

The word bitcoin was Ethereum was conceived


defined in a white paper in 2013 by programmer
History published on 31 October Vitalik Buterin, and then
2008. The currency went live on 30 July
began use in 2009. 2015.

The purpose of Ethereum


was to utilize blockchain
The purpose of bitcoin
technology for
was to replace national
Purpose maintaining a
currencies during the
decentralized payment
financial crisis of 2008.
network and storing
computer code.

Smart Although bitcoin do have Ethereum allows us to


Contracts smart contracts, they are create smart contracts.
not as flexible or Smart contracts are
complete as Ethereum computer codes that is
smart contracts. Smart stored on a blockchain
contracts in Bitcoin does and executed when the
not have all the predetermined terms and
functionality that a
programming language
conditions are met.
would give them.

Smart contracts on Smart contracts on


Smart Contract
Bitcoin are written in Ethereum are written in
Programming
programming languages programming languages
Language
like Script, Clarity. like Solidity, Vyper, etc.

Generally, bitcoin Ethereum transactions


Transactions transactions are only for may contain some
keeping notes. executable code.

Ethereum runs on the


Hash Bitcoin runs on the SHA-
Keccak-256 hash
Algorithm 256 hash algorithm.
algorithm.

The Proof-of-Work
The Proof-of-Stake is the
Consensus (PoW) is the consensus
consensus mechanism
Mechanism mechanism used by the
used by Ethereum.
Bitcoin network.

Block Time The block time of bitcoin The block time of


Ethereum is 14 to 15
is 10 minutes.
seconds.

The Ethereum blockchain


The bitcoin blockchain
Block Limit does not have a block
has a block limit of 1 MB.
limit.

Ether, native currency of


Bitcoin is the most
Ethereum is the second-
Popularity popular digital currency
largest cryptocurrency
in the market to date.
after bitcoin to date.

Energy consumption is
Energy Energy consumption is
very low as compared to
Consumption very high.
bitcoin

Energy Energy consumption rate Energy consumption rate


Consumption of bitcoin mining system of bitcoin mining system
rate 3.2 Million household. 1.2 Million household.

Structure Structure of bitcoin is Structure of Ethereum is


simple and robust. complex and feature rich

Miner got nearly 5 BTC


Miner got nearly 6.25
along with same
BTC on successfully
Rewards additional rewards on
adding new block in
successfully adding new
network.
block in network.

Assets of Ethereum is
Assets Assets of Bitcoin is BTC.
Ether.

Ethereum Virtual Machine


The Ethereum Virtual Machine (EVM) is a crucial component of the Ethereum
blockchain that enables the execution of smart contracts and decentralized
applications (DApps). When developers write smart contracts in languages
like Solidity, the EVM processes these contracts, managing state changes
and executing transactions based on predefined logic. It uses a gas system to
measure and regulate computational resources, preventing abuse and
ensuring fair usage.
What is an Ethereum Virtual Machine (EVM)?
The Ethereum Virtual Machine (EVM) is a decentralized computing
environment that executes smart contracts on the Ethereum Work. It serves
as the runtime environment for all Ethereum accounts and smart contracts,
allowing developers to deploy applications that can run on the blockchain
without requiring a central authority.
1. Decentralization: The EVM operates on a distributed network of

nodes, ensuring that no single entity controls the execution of

contracts.

2. Turing Completeness: The EVM is Turing complete, meaning it can

execute any computation that can be described algorithmically,

given sufficient resources.

3. Smart Contract Execution: When a smart contract is deployed, the

EVM handles the contract’s execution based on the inputs it

receives, managing state changes on the blockchain.

4. Gas Mechanism: To prevent abuse of resources, every operation in

the EVM requires a certain amount of “gas,” a measure of

computational effort. Users pay gas fees to incentivize miners to

process their transactions.

5. Isolation: Each smart contract operates in isolation, which means

that the execution of one contract doesn’t directly affect the

execution of another.

6. State Management: The EVM maintains a global state, tracking the

current state of all accounts and contracts on the Ethereum network.

Purpose of EVM
Here are the several key purposes of EVM:
1. Execution of Smart Contracts: The EVM is responsible for

executing smart contracts, which are self-executing contracts with


the terms directly written into code. This allows for automated and

trustless transactions.

2. Decentralization: By running on a distributed network, the EVM

ensures that no single party controls the execution of contracts,

enhancing trust and security.

3. State Management: The EVM maintains a global state of all

accounts and smart contracts, tracking changes and ensuring

consistency across the network.

4. Resource Management: The gas mechanism in the EVM helps

regulate resource usage, preventing abuse and ensuring that

computational resources are allocated fairly.

5. Compatibility: The EVM allows developers to write applications in

high-level programming languages (like Solidity) that can be

compiled and executed on the Ethereum network, promoting ease of

development and interoperability.

6. Turing Completeness: The EVM’s Turing-complete nature allows it

to perform any computation that can be described algorithmically,

making it versatile for a wide range of applications.

7. Security: The EVM isolates contract executions, preventing

unintended interactions between contracts and enhancing the

overall security of the Ethereum ecosystem.


How Does EVM Work?
The EVM works as follows-
1. Smart Contract Deployment: Developers write smart contracts in

high-level languages (like Solidity), which are compiled into EVM

bytecode. Contracts are deployed to the Ethereum network through

transactions.

2. Transaction Processing: Users create transactions to interact with

deployed contracts. These transactions are propagated to Ethereum

nodes.

3. Execution: Each node runs its own instance of the EVM to execute

the transaction. The EVM processes the contract logic and updates

the global state of the blockchain.

4. Gas Mechanism: Each operation consumes gas, which users pay for.

If the transaction runs out of gas, it reverts, but the gas is still spent.

5. Stack Management: The EVM uses a stack-based architecture to

manage data and execute instructions, storing temporary data in

memory and permanent data on-chain.

6. Block Creation and Validation: Processed transactions are bundled

into blocks by miners or validators, validated against consensus

rules, and added to the blockchain.

7. Finality: Once included in a block, the changes are permanent and

publicly verifiable.
Architecture of the EVM
Here is an overview of the architecture of EVM:
Stack-Based Architecture: The EVM operates using a stack where data is

pushed and popped. Each stack can hold up to 1024 items, enabling

calculations and control flow during contract execution.

Figure :- Stack-Based Architecture

● Stack: A list of 32-byte items utilized for holding the inputs and outputs of smart
contract instructions
● Memory: Temporary data that is used during contract execution

● Storage: Mapping of 32-byte slots to 32-byte values containing keys like nonce,

balance, code hash, and storage hash


● EVM code: Stored in the code is persistent as part of a contract account state
field
● Program Counter (PC): A pointer that instructs the EVM which opcode
instruction should be executed next
● Gas: Every opcode incurs a predetermined fee for its execution, denominated in
some gas amount (in wei)

1. Memory: The EVM has a linear memory structure that provides

temporary storage for data during execution. This memory is cleared

after each transaction.

Figure :- Memory
2. Stack: The Stack enables the EVM to execute code and transaction instructions,
ultimately updating the world state of Ethereum. The Stack is part of the volatile machine
state of the EVM, so its operations are only persistent during transaction execution. The
Stack is also limited in its operations and computing, so any operations exceeding the
limits will result in a Stack error, causing a transaction to revert. In size, the Stack is
limited to 1024 elements in total and uses words, which are 256-bit, 32-byte chunks of
data. The Stack cannot store values such as arrays, strings, or mappings, so other
components like Memory can be used to store them for reference during transaction
execution. A common error developers run into when dealing with the Stack is stack
overflow/underflow and not enough gas. This occurs when there is an exception on the
Stack due to an incorrect amount of items on the Stack or insufficient gas to complete the
computation.The Stack is designed in a Last-In First-Out (LIFO) data format and
executes different bytecodes (opcodes) by popping values off the stack, executing the
bytecode, and then pushing them back on the Stack. Basic operations of the Stack include
opcode instructions like PUSH1, ADD, MUL, POP (and more), which all rely on the
Stack to perform. The Stack can also access other parts of the VM, such as Memory and
Storage (i.e., world state), which reference opcodes such as MSTORE and SSTORE, both
of which we'll cover later.
Figure :- Stack

3. Storage:-The world state (aka Storage) of Ethereum is persistent, unlike the Stack and
Memory, which are volatile. Storage consists of a keystore of 256-bit to 256-bit values
that contain different states of an account (smart contract) such as balance, nonce, storage
hash and code hash. Accounts that are externally owned (EOA; e.g., non-custodial
wallets) only contain balance and nonce key stores. Storage uses a modified Merkle
Patricia Trie data structure to store accounts (EOA and smart contracts) via hashing and
reducing the stored data to a single root hash. This hash represents a mapping between
account addresses and account states (e.g., balance, nonce, storage hash, code hash).

The Storage component of the EVM enables the state to be persistent and modifiable,
enabling use cases like updating the token balance of an account. Storage can be accessed
via a message call; this is with methods such as eth_call, which is one of the RPC
methods on Ethereum implementations like Geth. The cost of Storage on Ethereum is
paid via transaction execution, consisting of fees to validators (which can vary on
network activity) and the predetermined gas costs for each opcode. Since Storage on
Ethereum can get expensive, others look for solutions like IPFS and AWS to store data
(e.g., NFT Metadata). Check out our IPFS guides to learn how to pin data on the IPFS
network via a UI or API.

4. EVM Code:-Smart contracts are written in higher-level languages like Solidity and Vyper
and eventually get compiled down to bytecode (EVM Code). This bytecode (smart
contract instruction) is stored in Storage (in the account state fields) and can be accessed
by other smart contracts and EOAs to read or interact with.

5. Program Counter (PC):-With the smart contract instructions from the compiled EVM
code, the Program Counter tracks the EVM instruction (opcode) to execute next, ensuring
operations are done in the correct sequence.For example, if the bytecode of a smart
contract is 20 bytes long, you should expect to have 20 lines, and each line will be an
opcode instruction.

6. Gas:-Gas can be thought of as the fuel needed for transactions to be executed via the EVM. It
is a unit that measures the computational effort required to execute operations. Each opcode
executed by the EVM consumes a certain amount of gas, predetermined by the Ethereum yellow
paper. The implementation of gas prevents spam (DDos) and ensures that resources are used
efficiently.

EVM and Ethereum Blockchain


The Ethereum Virtual Machine (EVM) and the Ethereum blockchain are intrinsically linked,
functioning together to enable decentralized applications and smart contracts.
1. Smart Contract Execution: The EVM processes the logic contained within smart
contracts, allowing for automated and trustless transactions directly on the
blockchain.

2. State Management: The EVM maintains the global state of all accounts and
contracts, ensuring that data is consistent and accessible across the network.

3. Transaction Processing: When a transaction is sent to the Ethereum network, it is


propagated to all nodes, which use the EVM to execute the transaction. After
execution, the results are validated by nodes through consensus mechanisms (like
Proof of Stake), ensuring that only valid transactions are added to the blockchain.

4. Resource Management: The EVM uses a gas system to allocate computational


resources for transaction processing. Users pay gas fees, which incentivize
miners/validators to include transactions in the blockchain.

5. Distributed Network: Both the EVM and the Ethereum blockchain operate on a
decentralized network of nodes, meaning no single entity controls the system,
enhancing security and trust.

6. Cross-Chain Compatibility: Many other blockchain networks are EVM-compatible,


allowing developers to deploy Ethereum-based applications across multiple
platforms.

Development of the EVM


Developing the Ethereum Virtual Machine (EVM) involves creating smart contracts and
decentralized applications (DApps) that run on the Ethereum blockchain.

1. Languages

1. Solidity: The most widely used language for writing smart contracts. It’s similar to
JavaScript and designed specifically for Ethereum.

2. Vyper: A Python-like language focused on simplicity and security, aimed at


providing a more secure alternative to Solidity.
2. Development Tools

1. Remix: A web-based IDE that allows developers to write, test, and deploy smart
contracts easily.

2. Truffle: A popular framework that provides a suite of tools for developing, testing,
and deploying DApps, including a built-in testing environment and migration scripts.

3. Hardhat: A development environment for Ethereum that includes advanced


debugging capabilities and support for local blockchain networks.

3. Testing and Debugging

1. Unit Testing: Writing tests for smart contracts to ensure they function as intended.
Frameworks like Truffle and Hardhat provide testing libraries.

2. Debugging Tools: Tools like Remix and Hardhat offer debugging capabilities to trace
errors in smart contracts during development.

4. Deployment

1. Deployment Scripts: Developers create scripts to automate the deployment of


contracts to the Ethereum network, specifying parameters and handling transaction
fees.

2. Testnets: Developers often deploy contracts on Ethereum test networks (like


Ropsten, Rinkeby, or Goerli) to test functionality without spending real Ether.

5. Interacting with Smart Contracts

1. Web3.js: A JavaScript library that allows web applications to interact with the
Ethereum blockchain, enabling communication with smart contracts.

2. Ethers.js: A lightweight alternative to Web3.js that also provides easy interaction


with Ethereum, including wallet management and contract interaction.
6. Security Practices

1. Auditing: Conducting thorough audits of smart contracts to identify vulnerabilities


before deployment.

2. Common Vulnerabilities: Awareness of common issues like reentrancy,


overflow/underflow, and improper access control is crucial for secure development.

7. Deployment to Mainnet

Once contracts are thoroughly tested and audited, they can be deployed to the Ethereum mainnet,
where they will operate in a live environment.
Benefits of EVM
1. Execute Untrusted Code: 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.

2. Execute 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.

3. 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.

4. 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
computers.

5. Robust Against Failure: This is a complex process because the network needs to be
able to come to a consensus at any given time. 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.

6. 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.

Limitations of EVM
1. High Cost of Storing Data: First is gas, which is what you need to use to pay the fee
to run a smart contract, and the other is the high cost of storing data on the
blockchain, which could take up more than 3TB

2. 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.

3. 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).

4. 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; 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.
Steps to Transfer Ether (ETH) using MetaMask:
STEP 1: Open Metmask. If this is your first time you install Metamask , you will be asked to
create your first password for encrypting your wallet.

Figure 1–1: Create new wallet:- If you already stored your Mnemonic Phrases somewhere else
before, you can restore all of your wallets by choosing “Import Existing DEN”, then paste the 12-
words Mnemonic Phrases into the “Wallet Seed” box.

Figure 1–2: Restore from existing DEN

After create/restore your Metamask DEN, you will see your wallet(s) appear in Metamask.
Figure 1–3: Account details
Step 2: For sending ETH into an address, click “SEND” button. Put the destination address and
amount of ETH then click “NEXT”

Step 2–1: Sending to an address


For confirming transaction, you need to adjust Gas Limit and Gas Price. For knowing Gas Limit
and Gas Price during a Token Sale period, you should check the announcement & guideline of
specific Token Sale for recommendation. After you’re certain about making transaction, you can
click to “Submit” button. There are also “Reset” button for reset all value to default, and “Reject”
button in case you change your mind.
Figure 2–2: Setting gas price and gas limit
Step 3: After submitting a transaction, the transaction history will be displayed on Metamask.

Step 3–1: Checking transaction


You can click to any transaction for verifying the transaction status on Etherscan
Figure 3–2: Checking transaction on Etherscan

You might also like