[go: up one dir, main page]

0% found this document useful (0 votes)
189 views25 pages

Unit II - Ethereum Overview - Blockchain Notes

Download as docx, pdf, or txt
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1/ 25

Subject Code: MC4013 Unit - 2 Subject Name: CNBT

UNIT II CRYPTOCURRENCY

Bitcoin:Bitcoin Working - Bitcoin Transactions - Bitcoin Mining - Value of


Bitcoin-Community,PoliticsandRegulations–Advantages–Disadvantages.
Ethereum:Overview -decentralized Application.Components of
Ethereum:Smart contracts– Ether - Ethereum Clients - EthereumVirtual
Machine – Etherscripter

 A cryptocurrency is a digital currency, which is an alternative form of payment created


using encryption algorithms. The use of encryption technologies means that
cryptocurrencies function both as a currency and as a virtual accounting system.
 To use cryptocurrencies, you need a cryptocurrency wallet. These wallets can be software
that is a cloud-based service or is stored on your computer or on your mobile device.
 The wallets are the tool through which you store your encryption keys that confirm your
identity and link to your cryptocurrency.

What Is Bitcoin?

 Bitcoin (BTC) is a cryptocurrency, a virtual currency designed to act as money and a form
of payment outside the control of any one person, group, or entity, thus removing the need
for third-party involvement in financial transactions.
 It is rewarded to blockchain miners for the work done to verify transactions and can be
purchased on several exchanges.
 Bitcoin was introduced to the public in 2009 by an anonymous developer or group of
developers using the name Satoshi Nakamoto.It has since become the most well-known
cryptocurrency in the world.

Bitcoin Working

Prepared By: Savithri S, Assistant Professor - Dhanalakshmi Srinivsan College of Engineering and Technology
1
Subject Code: MC4013 Unit - 2 Subject Name: CNBT
How Bitcoin Works

Bitcoin is a decentralized digital currency that operates without the need of financial system or
government authorities. It utilizes peer-to-peer transfers on a digital network that records all
cryptocurrency transactions. This network is powered by the blockchain, an open source code
that pairs (or chains) blocks of transaction histories to prevent manipulation.

Because these transfers are confirmed directly between users and are located on a shared
public ledger, Bitcoin eliminates the need for central facilitators, like governments and banks,
to verify currency transactions.

KEY TAKEAWAYS

 A blockchain is a secured distributed ledger, a database disseminated between multiple


users who can make changes.
 Mining is the process of validating transactions, which requires miners who are
rewarded in bitcoin.
 You access your bitcoin using a wallet, a public key, and private keys.
 Bitcoin users pay small transaction fees in bitcoin to miners for processing the
transactions.
 Bitcoin's weakness is in storage methods. The blockchain has reportedly never been
compromised.

The Bitcoin Blockchain

The Bitcoin blockchain is a database of transactions secured by encryption and validated by


peers. Here's how it works. The blockchain is not stored in one place; it is distributed across
multiple computers and systems within the network. These systems are called nodes. Every
node has a copy of the blockchain, and every copy is updated whenever there is a validated
change to the blockchain.

Prepared By: Savithri S, Assistant Professor - Dhanalakshmi Srinivsan College of Engineering and Technology
2
Subject Code: MC4013 Unit - 2 Subject Name: CNBT

The blockchain consists of blocks, which store data about transactions, previous blocks,
addresses, and the code that executes the transactions and runs the blockchain. So, to
understand the blockchain, it's important first to understand blocks.

Blocks

When a block on the blockchain is opened, the blockchain creates the block hash, a 256-bit
number that encodes the following information:

 The block version: the Bitcoin client version


 The previous block's hash: the hash of the block before the current one
 The coinbase transaction: the first transaction in the block, issuing the bitcoin reward
 The block height number: how far away numerically the block is from the first block
 Merkelroot: A 256-bit number that stores the information about all previous blocks
 Timestamp: the time and date the block was opened
 The target in bits: the network target
 The nonce: a randomly-generated 32-bit number

Queued transactions are entered into the block, the block is closed, and the blockchain creates
the hash. Each block contains information from the previous blocks, so the blockchain cannot
be altered because each block is "chained" to the one before it. Blocks are validated and
opened by a process called mining.

Bitcoin Transactions

A bitcoin transaction happens when you send or receive a bitcoin.

To send a coin, you enter the receiver's address in your wallet application, enter your private
key, and agree to the transaction fee. Then, press whichever button corresponds to "send."

Prepared By: Savithri S, Assistant Professor - Dhanalakshmi Srinivsan College of Engineering and Technology
3
Subject Code: MC4013 Unit - 2 Subject Name: CNBT
The receiver must wait for the transaction to be verified by the mining network, which can
take up to 30 minutes because transactions wait in a mining queue called the mempool.

The mempool is where transactions waiting to be verified go. The network, on average,
confirms a block of transactions about every ten minutes, but not all new transactions go into
the new block that is created.

This is because blocks only hold a certain amount of information, and each transaction comes
with a mining fee.

Transactions must meet the minimum transaction fee threshold to be processed, and the
transactions with the highest fees are processed first. This is why you may hear about the
problem of rising fees. Bitcoin is so popular that demand for transactions has increased,
allowing (or requiring) miners to charge higher fees.

Transaction fees were established to create an incentive for people to become network nodes
and miners. Bitcoin mining is also expensive, so fees help to offset the cost of equipment and
electricity used.
Once the fee is met, the transaction is transferred to a block, where it is processed. Once
transaction information within the block is validated by miners, the block is closed, and all
receivers collect their bitcoin. Both wallets display their appropriate balances, and the next
transactions are processed.

Bitcoin Mining

Mining is the process of validating transactions and creating a new block on the blockchain.
Mining is conducted by software applications that run on computers or machines designed
specifically for mining called Application Specific Integrated Circuits.

The hash is the focus of the mining programs and machines. They are working to generate a
number that matches the block hash. The programs randomly generate a hash and try to match

Prepared By: Savithri S, Assistant Professor - Dhanalakshmi Srinivsan College of Engineering and Technology
4
Subject Code: MC4013 Unit - 2 Subject Name: CNBT
the block hash, using the nonce as the variable number, increasing it every time a guess is
made. The number of hashes a miner can produce per second is its hash rate.

Mining programs across the network generate hashes. The miners compete to see which one
will solve the hash first—the one that does receives the bitcoin reward, a new block is created,
and the process repeats for the next group of transactions.

Bitcoin's protocol will require a longer string of zeroes depending on the number of miners,
adjusting the difficulty to hit a rate of one new block every 10 minutes. The difficulty—or the
average number of tries it takes to verify the hash—has been increasing since Bitcoin was
introduced, reaching tens of trillions of average attempts to solve the hash. As this suggests, it
has become significantly more difficult to mine Bitcoin since the cryptocurrency launched.

Mining is intensive, requiring big, expensive rigs and a lot of electricity to power them. And
it's competitive. There's no telling what nonce will work, so the goal is to plow through them
as quickly as possible with as many machines working on the hash as possible to get the
reward. This is why mining farms and mining pools were created.

Halving

Halving is an important concept in Bitcoin mining. At first, the mining reward was 50 BTC for
solving the hash. About every four years, or 210,000 blocks, the reward is cut in half. So
rewards were cut to 25 in 2012, 12.5 in 2016, and 6.25 in 2020. The next halving is expected
to occur in 2024 when the reward will reduce to 3.125, followed by a reduction to 1.5625
around 2028.

The last bitcoin is expected to be mined somewhere around 2140. All 21 million bitcoins will
have been mined at that time, and miners will depend solely on fees to maintain the network.

Consensus in Bitcoin
There are three kinds of consensus that have to operate for Bitcoin to be successful.

Prepared By: Savithri S, Assistant Professor - Dhanalakshmi Srinivsan College of Engineering and Technology
5
Subject Code: MC4013 Unit - 2 Subject Name: CNBT
1. Consensus about rules.By rules we mean things like what makes a transaction or a block
valid.
2. Consensus about history.That is, consensus about what is and isn’t in the block chain, and
therefore a consensus about which transactions have occurred.
3. Consensus that coins are valuable.The third form of consensus is the general agreement
that bitcoins are valuable and in particular the consensus that if someone gives you a bitcoin
today, then tomorrow you will be able to redeem or trade that for something of value.

7.2: Bitcoin Core Software


Bitcoin Core is a piece of open‐source software.
Bitcoin Core is the de‐facto rulebook of Bitcoin.
Bitcoin Improvement Proposals:Anyone can contribute technical improvements via “pull
requests” to Bitcoin Core, a familiar process in the world of open ‐source software. For more
substantial changes, especially protocol modifications, there is a process called Bitcoin
Improvement Proposals or BIPs. These are formal proposals for changes to Bitcoin.
Typically a BIP will include a technical specification for a proposed change as well as a
rationale for it. So if you have an idea for how to improve Bitcoin by making some technical
change, you're encouraged to write up one of these documents and to publish it as part of the
Bitcoin Improvement Proposal series, and that will then kick off a discussion in the community
about what to do.
Bitcoin Core developers:To understand the role of the Bitcoin Core software we also have to
understand the role of Bitcoin Core developers. The original code was written by Satoshi

Prepared By: Savithri S, Assistant Professor - Dhanalakshmi Srinivsan College of Engineering and Technology
6
Subject Code: MC4013 Unit - 2 Subject Name: CNBT
Nakamoto, who we’ll return to later in the chapter. Nakamoto is no longer active, but instead
there are a group 196 of developers who maintain Bitcoin Core.

Forks in the rules: One way to fork the software and the rules is to start a new block chain
with a new genesis block.
At the point when there’s a disagreement about the rules, there will be a fork in the 197 block
chain, resulting in two branches. One branch is valid under rule set A but invalid under rule set
B, and vice versa. Once the miners operating under the two rule sets separate they can’t come
back together because each branch will contain transactions or blocks that are invalid according
to the other rule set.

7.3: Stakeholders: Who's in Charge?


We can claims on behalf of many different stakeholders:
1. Core developers have the power — they write the rulebook and almost everybody uses
their code.
2. Miners have the power — they write history and decide which transactions are valid. If
miners decide to follow a certain set of rules, arguably everyone else has to follow it. The fork
with more mining power behind it will build a stronger, more secure block chain .
3. Investors have the power — they buy and hold bitcoins, so it's the investors who decide
whether Bitcoin has any value. You could argue that if the developers control consensus about
the rules and the miners control consensus about history, it's the investors who control

Prepared By: Savithri S, Assistant Professor - Dhanalakshmi Srinivsan College of Engineering and Technology
7
Subject Code: MC4013 Unit - 2 Subject Name: CNBT
consensus that Bitcoin has value. In the case of a hard fork, if investors mostly decide to put
their money in either A‐coin or B‐coin, that branch will be perceived as legitimate.
4. Merchants and their customers have the power — they generate the primary demand for
Bitcoin. While investors provide some of the demand that supports the price of the currency,
199 the primary demand that drives the price of the currency
5. Payment services have the power — they’re the ones that handle transactions. A lot of
merchants don't care which currency they follow and simply want to use a payment service that
will give them dollars at the end of the day, allow their customers to pay using a
cryptocurrency, and handle all the risk. So maybe payment services drive primary demand and
merchants, customers, and investors will follow them.

7.4: Roots of Bitcoin


Cypherpunk and digital cash.
The cypherpunk movement was a group of people who believed that with strong online
privacy and strong cryptography you could re‐architect the way that people interact with each
other. In this world, cypherpunks believed, people could protect

themselves and their interests more effectively and with much less activity (or, as they would
say, interference) from government
One of the challenges in the cypherpunk movement was how to deal with money in a future
cypherpunk world where people were interacting online via strong technical and cryptographic
measures.

7.5: Governments Notice Bitcoin


Capital controls.One reason why governments would notice a digital currency like Bitcoin is
that untraceable digital cash, if it exists, defeats capital controls. Capital controls are rules or
laws that a country has in place that are designed to limit the flow of capital (money and other
assets) into or out of the country. By putting controls on banks, investments, and so on, the
country can try to regulate these flows.

Prepared By: Savithri S, Assistant Professor - Dhanalakshmi Srinivsan College of Engineering and Technology
8
Subject Code: MC4013 Unit - 2 Subject Name: CNBT
Bitcoin is a very easy way, under some circumstances, to defeat capital controls. Someone can
simply buy bitcoins with capital inside the country, transmit those bitcoins outside the country
electronically, and then trade them for capital or wealth outside the country. That would let
them move capital or wealth from inside to outside and similarly they can move capital from
outside to inside.

Crime. Another reason governments might worry about untraceable digital cash is that it
makes certain kinds of crimes easier — in particular, crimes like kidnapping and extortion that
involve the payment of a ransom. Those crimes become easier when payment can be done at a
distance and anonymously. Law enforcement against kidnappers, for example, often has relied
upon exploiting the hand‐off of money from the victim or the victim’s family to the criminals.
When that can be done at a distance in an anonymous way, it becomes much harder for law
enforcement to follow the money. Another example: the “CryptoLocker” malware encrypts
victims’ files and demands ransom in Bitcoin (or other types of electronic money) to decrypt
them

Silk Road. A good example of that is Silk Road, a self‐styled “anonymous marketplace” which
has also been called “the eBay for illegal drugs.” . Silk Road allowed sellers to advertise goods
for sale and buyers to buy them. The goods were delivered typically through the mail or
through shipment services and payment was made in bitcoins.

7.6: Anti Money‐Laundering


 Anti‐money laundering is aimed at trying to make certain kinds of crime more difficult,
especially organized crime.
 Organized crime groups often find themselves getting a lot of money coming in in one
place and wanting to move it somewhere else, but not wanting to explain where that money
came from — hence the desire to get money across borders.
 Anti‐money laundering, then, has the goals of making it harder to move money around this
way and making it easier to catch people trying to do it.

Prepared By: Savithri S, Assistant Professor - Dhanalakshmi Srinivsan College of Engineering and Technology
9
Subject Code: MC4013 Unit - 2 Subject Name: CNBT
Know Your Customer.One of the essential countermeasures against money laundering is
something called Know Your Customer laws, sometimes called KYC.

Know Your Customer rules require certain kinds of businesses that handle money to do three
things:
1. Identify and authenticate clients
2. Evaluate risk of client
3. Watch for anomalous behavior
7.7: Regulation Now let’s directly address the 'R' word — regulation.

When markets fail and produce outcomes that are bad — and agreed to be bad by pretty much
everyone in the market — then regulation can step in and try to address the failure.

Regulation, don't always give you the result that you'd like.

A low‐quality car (a lemon) sitting on the lot may look pretty good, but you can't really tell if
it's going to break down tomorrow or if it's going to run for a long time. The dealer probably
knows if it's a lemon, but you as the customer can't tell the difference. Let’s think about the
incentives that drive people in this kind of lemons market. As a consumer, you're not willing
to pay extra for a high‐quality car, because you just can't tell the difference. Even if the used car
dealer says that a car is perfect and is only an extra hundred dollars, you don’t have a good
reason to trust the dealer. As a consequence, producers can't make any extra money by selling a
high‐quality car.. This type of market failure is called a lemons market .

People who argue for regulation of Bitcoin exchanges, for example, sometimes point to them as
an example of a lemons market. Collusion and antitrust law.Another example of markets not
operating the way we would like them to is price fixing. Price fixing is when different sellers
collude with each other and agree to raise prices or to not lower them.

7.8: New York's BitLicense Proposal

Prepared By: Savithri S, Assistant Professor - Dhanalakshmi Srinivsan College of Engineering and Technology
10
Subject Code: MC4013 Unit - 2 Subject Name: CNBT
 Specific regulation of Bitcoin, namely New York State’s BitLicense proposal. help you
understand a specific piece of actual or proposed regulation.
 The BitLicense proposal was issued in July 2014 and has since been revised in response to
comments from the Bitcoin community, industry, the public, and other stakeholders.
 It was issued by the New York State Department of Financial Services, the part of the state
of New York that regulates the financial industry.
 BitLicense is a proposed set of codes, rules, and regulations that has to do with virtual
currencies.

Advantages of Bitcoin
 User Anonymity and Transparency. ...
 Independence From Central Authority. ...
 High Return Potential. ...
 Volatility. ...
 No Government Regulations. ...
 Irreversible. ...
 Limited Use.

Disadvantages of Bitcoin
 price volatility
 high energy consumption for mining activities
 use in criminal activities.

Ethereum Overview

Prepared By: Savithri S, Assistant Professor - Dhanalakshmi Srinivsan College of Engineering and Technology
11
Subject Code: MC4013 Unit - 2 Subject Name: CNBT
Overview :

 Vitalik Buterin, a programmer, proposed Ethereum in 2013. The network went live in
2015, with an initial supply of 72 million coins, after being crowdfunded in 2014.
 The Ethereum Virtual Machine (EVM) can run decentralized programs and execute
scripts. Ethereum is used for decentralized banking, the production and distribution of
non-fungible tokens (NFTs), and many ICOs.
 Ethereum, on the other hand, refers to itself as a decentralized computer network based on
blockchain technologies. Ethereum is built on top of a blockchain network. A blockchain
is a transparent, distributed public ledger that verifies and records all transactions.
 The Ethereum network allows users to build and run apps, smart contracts, and other
transactions. These features are not available in Bitcoin.
 It is only used as a medium of exchange and a store of cash. There is no boundary on how
much Ether tokens can be produced while Bitcoin can only deliver 21 million coins.
 The Ethereum Virtual Machine (EVM) is run by Ethereum clients, which may be built in
any popular programming language.

Ethereum
 Ethereum is a decentralized, open-source blockchain with smart contract functionality.
 Ether is the native cryptocurrency of the platform.
 Among cryptocurrencies, ether is second only to bitcoin in market capitalization.
 Ethereum was conceived in 2013 by programmer Vitalik Buterin.
 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.

Prepared By: Savithri S, Assistant Professor - Dhanalakshmi Srinivsan College of Engineering and Technology
12
Subject Code: MC4013 Unit - 2 Subject Name: CNBT
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.

What is a dApp?

Decentralized applications (dApps) are one of several paths to bring back users’ data liberty out
of centralized control. Hence, instead of reaching a centralized server, your requests actually
contact the Blockchain for information. dApps are the apps only, without centralized control.

App = Frontend + Backend → Hosted on Centralized Network Servers.

DApp = Frontend + Backend + Smart Contracts → Hosted on Blockchain.

Smart contracts help to encode the regulations and conditions of the decentralized application.
It works along with the Backend of the application. Usually, smart contracts are programmed in
solidity language and executed by Ethereum Virtual Machine (EVM).

How Does a dApp Work?

dApps interact with users on mobile or browser like a normal app or website. Users can also
connect or log in via wallet to access the application. The dApp hosts on the blockchain
network. The source code is available for verification to each node in the network.

The front end of the application is written in HTML, CSS, JS, etc. Backend is written in JS or
Python, usually interacting with smart contracts and Blockchain. Moreover, frameworks like
NodeJS and Web3 or Django help to create the Backend.

Prepared By: Savithri S, Assistant Professor - Dhanalakshmi Srinivsan College of Engineering and Technology
13
Subject Code: MC4013 Unit - 2 Subject Name: CNBT
Benefits of dApps

Following are the advantages of Decentralized Applications (dApps):

 Data integrity and Privacy


 Censorship Resistant: Nobody is authorized to control the application’s actions.
Hence, equality and decentralization.
 No Downtime: As the whole network is decentralized, no one or central point of failure.
 Open-Source and Permissionless
 Provides incentives for valuable reviews and building reputation
 No third-party trust
Limitations of dApps

Following are the disadvantages of Decentralized Applications (dApps):

Examples of dApps

Following are a few of the application examples of dApps:

 Augur: A decentralized prediction marketplace based on Ethereum


 Bit Torrent: A decentralized file-sharing application
 Golem: A decentralized marketplace for renting computational power and resources
 Cryptokitties: A decentralized game application
 Minds: A decentralized social media platform between content creators and consumers

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

Prepared By: Savithri S, Assistant Professor - Dhanalakshmi Srinivsan College of Engineering and Technology
14
Subject Code: MC4013 Unit - 2 Subject Name: CNBT
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.
Component-2 :
Ether –

 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 in 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.

Prepared By: Savithri S, Assistant Professor - Dhanalakshmi Srinivsan College of Engineering and Technology
15
Subject Code: MC4013 Unit - 2 Subject Name: CNBT
 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 –

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 :
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. The original version may be found here.

Prepared By: Savithri S, Assistant Professor - Dhanalakshmi Srinivsan College of Engineering and Technology
16
Subject Code: MC4013 Unit - 2 Subject Name: CNBT

What are smart contracts?


 Smart contracts are simply computer programs living on the Ethereum blockchain.
 They only execute when triggered by a transaction from a user (or another contract).
 They make Ethereum very flexible in what it can do and distinguish it from other
cryptocurrencies. These programs are what we now call decentralized apps, or dapps.
 Have you ever used a product that changed its terms of service? Or removed a feature you
found useful?
 Once a smart contract is published to Ethereum, it will be online and operational for as long
as Ethereum exists. Not even the author can take it down. Since smart

 contracts are automated, they do not discriminate against any user and are always ready to
use.
 Popular examples of smart contracts are lending apps, decentralized trading exchanges,
insurance, crowdfunding apps - basically anything you can think of.

A smart contract includes an automatically-executable program of the business logic or


requirement mentioned. It follows if-then statements. If a particular condition is true, then do a
specific operation. The smart contract programs are executed by Ethereum Virtual Machine

Prepared By: Savithri S, Assistant Professor - Dhanalakshmi Srinivsan College of Engineering and Technology
17
Subject Code: MC4013 Unit - 2 Subject Name: CNBT
(EVM). Once the program gets executed, the action will be taken automatically as defined in
the contract.

 On a prepaid order, the payment by the customer goes to an escrow account.


 The payment will not be transferred to the vendor until the customer gets their order.
 Once the customer receives the order, the payment automatically transacts to the vendor.
 If the order does not deliver, the payment goes back to the customer after a specific number
of days.

Features of Smart contract:

 Self-executable code
 Deployed on Blockchain networks like Ethereum
 Follows IF-THEN conditions for contract
 Irreversible, can’t alter later
 Traceable and Transparent
 An Agreement between Buyer and Seller
 Secure and Reliable

Prepared By: Savithri S, Assistant Professor - Dhanalakshmi Srinivsan College of Engineering and Technology
18
Subject Code: MC4013 Unit - 2 Subject Name: CNBT
How does Smart Contract work?

Following are the steps to run an Ethereum smart contract:

 Contract deal between buyer (party A) and the seller (party B).
 A developer writes the smart contract in the solidity programming language.
 Solidity code (converted into) → Opcodes (compiles into) → Byte code
 Byte code (low-level machine language) saved by Ethereum Virtual Machine (EVM).
 Miners convert the smart contract into a new block to add to the Ethereum blockchain
network.
 When the conditions meet, the contract automatically executes. Hence, payment release to
the seller (party B).
 Verification of payment transaction.

Benefits of Smart contracts

Following are the advantages of Ethereum-based Smart Contracts:

 Smart contracts are automatically executable programs.


 It removes the need for middle parties or intermediaries. Hence, it eliminates the risk of
manipulation and cost-cutting.
 No fear of data loss as the contract has multiple copies shared across the blockchain network.
 Impressions of digital signing and cryptography ensure the safety and authenticity of the
contract.
 Saves time and effort in producing real business contracts.

Prepared By: Savithri S, Assistant Professor - Dhanalakshmi Srinivsan College of Engineering and Technology
19
Subject Code: MC4013 Unit - 2 Subject Name: CNBT
 Eliminate manual human errors while filling out forms.

Limitations of Smart contracts

Following are the disadvantages of Ethereum-based Smart Contracts:

 Once the smart contract code is deployed, it’s impossible to alter it.
 There are possibilities of loopholes in the contract
 Not a complete elimination of intermediaries as developers require them to establish
rules for smart contact.
 Not legally binded yet. No approval by any jurisdiction.

Ether in Ethereum
What Is Ether?

Ether is the second-largest cryptocurrency and handles more transaction volume than any other
digital asset.
Ether (ETH) is the main token of the Ethereum blockchain and the world’s second-
largest cryptocurrency by market capitalization. Just like the largest cryptocurrency, bitcoin,
ether can be used to send payments directly to another person without the need for an
intermediary such as a bank.

The long-term vision for Ethereum is to power more than just financial transactions. Software
developers are able to build applications on Ethereum, ranging from decentralized platforms for
lending money to social media networks.

Prepared By: Savithri S, Assistant Professor - Dhanalakshmi Srinivsan College of Engineering and Technology
20
Subject Code: MC4013 Unit - 2 Subject Name: CNBT
For any Ethereum-based app, ether acts as the primary "fuel.” Any activity on the blockchain
requires an amount of ether to power it, also known as "gas."

In Ethereum, ether can be used for the following things:

Payments: Like bitcoin, ether can be used for payments. Users can send ether to another
user and, just like cash, the payment doesn’t require a third party to process or approve it.
Powering decentralized applications: Ether is required in order to use decentralized
apps (dapps) built on Ethereum, from staking ERC-20 tokens for yield farming to
completing functions such as governance voting.
Transactions fees: Every Ethereum action – from payments to using dapps – requires a
fee.

What is Ethereum Client?

An Ethereum client is software that allows you to interact with the Ethereum network. It is your
gateway to the Ethereum network. There are different types of Ethereum clients. The most
popular ones are Geth and Parity. Geth is the Go implementation of the Ethereum client. Parity
is the Rust implementation of the Ethereum client. There are also other clients like Aleth and
Trinity.

Each client has its advantages and disadvantages. Geth is the most popular client. It is easy to
use, and it has a lot of features. Parity is more lightweight, and it is faster than Geth. Aleth is
more focused on security. Trinity is still in development. You can choose any client you want.
It would be best if you used a client you are comfortable with. If you are still deciding which
client to use, you can try out different ones and see which one you like the most.

Different Ethereum clients can communicate with one another if they follow the reference
specification and the defined communication protocols. While these many clients are created
by various teams and in various programming languages, they all “speak” the same protocol
and adhere to the same rules. As a result, they may all function on and interact with the same
Ethereum network.

Prepared By: Savithri S, Assistant Professor - Dhanalakshmi Srinivsan College of Engineering and Technology
21
Subject Code: MC4013 Unit - 2 Subject Name: CNBT
 These interactions among different clients in the network take place using various
programming languages like Geth (Go), OpenEthereum (Rust), Nethermind (C#, .NET),
Besu (Java), Erigon (Go/Multi).
 The yellow paper is the Ethereum protocol that allows anybody to run a client to construct
a node.
 The formal requirements that comprise Ethereum distinguish the blockchain from Bitcoin.
Whereas Ethereum sets standard behaviors that all Ethereum clients must adhere to,
Bitcoin Core does not. Ethereum’s specs enabled the blockchain to allow for different, but
interoperable, software implementations of an Ethereum client by providing standard
documentation and simple language.

Types of Ethereum Clients

There are 3 types of Ethereum Clients

1. Full Client: Full clients save the complete Ethereum blockchain, which might take several
days to synchronize and takes a massive amount of disc space – more than 1 Terabyte,
according to the most recent estimates. Full clients enable connected nodes to conduct all
network functions, including as mining, transaction and block-header validation, and smart
contract execution.

2. Light Client: Ethereum clients do not always need to necessary keep all of the data, so
often, when data storage and performance are concerns, developers utilize the “light clients”.
Light clients provide a portion of full client capability. Because light clients do not keep the
entire Ethereum blockchain, as a result, they can provide quick delivery and free up data
storage space.

Prepared By: Savithri S, Assistant Professor - Dhanalakshmi Srinivsan College of Engineering and Technology
22
Subject Code: MC4013 Unit - 2 Subject Name: CNBT
 The functionality of a light client is adapted to the purposes of the Ethereum client.
 Light clients, for example, are widely used within wallets to maintain private keys and
Ethereum addresses.
 They also manage smart contract interactions and transaction broadcasts.
 Light clients are also useful for web3 instances within JavaScript objects, Dapp browsers,
and obtaining the exchange rate data.
3. Remote Client: A remote client is much like a light client. The primary distinction is that

a remote client does not keep its own copy of the blockchain or validate transactions or
block headers. Remote clients, on the other hand, rely entirely on a full or lite client to
have access to the Ethereum blockchain network. These clients are mostly used as wallets
for transmitting and receiving transactions.

Ethereum Virtual Machine

The Ethereum Virtual Machine or EVM is a piece of software that executes smart contracts and
computes the state of the Ethereum network after each new block is added to the chain.
The EVM sits on top of Ethereum's hardware and node network layer. Its main purpose is to
compute the network's state and to run and compile various types of smart contract code into a
readable format called 'Bytecode.'
This makes it possible for smart contracts deployed on EVM-compatible chains like Polygon or
Avalanche to be recognized by Ethereum nodes, and allows developers to port their dapps or
tokens over from Ethereum to other EVM-compatible chains with relative ease.

What Is an Ethereum Virtual Machine (EVM)?

Prepared By: Savithri S, Assistant Professor - Dhanalakshmi Srinivsan College of Engineering and Technology
23
Subject Code: MC4013 Unit - 2 Subject Name: CNBT
 Ethereum Virtual Machine (EVM) is a computation engine which acts like a decentralized
computer that has millions of executable projects.
 It acts as the virtual machine which is the bedrock of Ethereum’s entire operating
structure.
 It is considered to be the part of the Ethereum that runs execution and smart contract
deployment.
 The role of the EVM is to deploy a number of extra functionalities to the Blockchain to
ensure users face limited issues on the distributed ledger.
 Every Ethereum node runs on the EVM to maintain consensus across the blockchain.
 Ethereum facilitates something called smart contracts, a piece of code that is running on
Ethereum.
 EVM is completely isolated meaning the code inside the EVM has no access to network,
file system or other processes.
 Ethereum has two types of accounts: Externally Owned Accounts (EOA) and Contract
Accounts, both of which are treated equally under the EVM.
 Account abstraction tries to reduce this to just one account meaning both EOAs and
Contract Accounts function like each other.
 EOAs are controlled by private keys, meanwhile contract accounts are stored in the smart
contracts, also known as smart wallets.
 A contract which is written in the smart-contract coding is converted into something called
a bytecode.
 Most of the source code for using smart contracts is done using programming language
from Solidity.
 It is then converted into opcodes for the EVM to interpret.
 The EVM then uses the operation codes in order to complete certain tasks.
 So, the EVM works like a large decentralized or master computer to complete all types of
tasks on the blockchain.
 EVM is one of the biggest projects in the world of cryptocurrencies.

Prepared By: Savithri S, Assistant Professor - Dhanalakshmi Srinivsan College of Engineering and Technology
24
Subject Code: MC4013 Unit - 2 Subject Name: CNBT
Ether Scripter:
Ether Scripter is a smart contract programming language that enables developers to create
contracts and decentralized applications (dapps) on the Ethereum blockchain.

It is a high-level language similar to JavaScript and is designed to be easy to learn and use.

Ether Scripter is also Turing-complete, meaning that it can be used to create programs that can
solve any computational problem.

Prepared By: Savithri S, Assistant Professor - Dhanalakshmi Srinivsan College of Engineering and Technology
25

You might also like