You are on page 1of 17

Blockchain​ ​Technology

EMG​ ​689​ ​-​ ​Independent​ ​Study​ ​Report


ITU,​ ​San​ ​Jose

Nirav​ ​Uchat
ID​ ​89149
Table​ ​of​ ​Content

Introduction​ ​to​ ​Blockchain 2


Intrinsic​ ​properties​ ​of​ ​Blockchain 3
Distributed​ ​ledger 3
Decentralization 4
How​ ​Blockchain​ ​works 4

Introduction​ ​to​ ​Bitcoin 5


Transactions 5
Timestamp​ ​Server 6
Proof-of-Work 6
Transaction​ ​Verification 7
Incentive 7
Drawbacks 8

Introduction​ ​to​ ​Ethereum 9


Ethereum​ ​Design​ ​Principles 9
How​ ​Ethereum​ ​Blockchain​ ​works 10
Basic​ ​Elements​ ​of​ ​Ethereum 11
Accounts 11
State 11
Gas​ ​and​ ​Fees 11
Transactions 12
Blocks 13
Ethereum​ ​Milestones 13
Smart​ ​Contracts 14
Proof​ ​of​ ​Work​ ​vs​ ​Proof​ ​of​ ​Stack 14

Cryptocurrency​ ​Market​ ​Cap 15

References 16

​ ​ ​ ​ ​ ​ ​ ​1
Introduction​ ​to​ ​Blockchain
Idea of blockchain was born during financial meltdown of 2009 and was driven by a belief that
there is a need of a system which could replace the traditional financial institution that are
responsible for the recession. The blockchain was the answer to replace those middleman, the
bankers, the ​trusted third party who we trust, but could not be trusted. These human comes
between the transactions, taking their profit and eventually and most of time unreasonably
complicating​ ​the​ ​transaction.

Blockchain sought to replace the services provided by the third parties and banks with
cryptography and distributed network. When you use your credit card to make the payment, a
series or agreement and transaction happens between you and your bank. Bank can assure the
person whom you are paying, that the transaction is authentic and you have money in your
account to pay for the transaction. All this is possible because your bank has central database
which​ ​manage​ ​and​ ​stores​ ​your​ ​deposits​ ​and​ ​withdrawal.

The software that replaces these background agreement and transaction with the help of
distributed and secure database is called the Blockchain. The value unit which identifies a
blockchain is called token. The process by which the ownership of token changes from one
person to another, no matter who they are or which government they live under - is ensured and
entrusted by distributed computers running blockchain protocol. Blockchain is a single
universally accessible digital ledger which records each and every transaction ever made. It is
called chain because changes can only be made by appending transaction at the end and every
single​ ​transaction​ ​can​ ​be​ ​traced​ ​back​ ​to​ ​root​ ​of​ ​the​ ​chain​ ​by​ ​following​ ​parent​ ​chain.

Unlike traditional financial system which manage ledger behind closed door, blockchain ledger
is replicated on networked computer around the globe and is accessible to anyone who has
computer and internet connection. The nodes on blockchain network, called miners, are
responsible for detecting transaction requests from end users, aggregating them, validating
them,​ ​and​ ​adding​ ​them​ ​to​ ​the​ ​blockchain.

​ ​ ​ ​ ​ ​ ​ ​2
Validation ensures both verifying that user actually owns the tokens in his transaction and that
he has not yet spent them. Ownership of the token in blockchain is determined by a pair of
cryptographic keys. The first, called the public key, resides in the blockchain for anyone to see.
The second is called the private key and is only accessible and visible to owner. The main
secret behind the blockchain protocol is the use of asymmetric public-private keys in ensuring
the non-repudiation property, a person who sends the message must own the private key and
hence​ ​owns​ ​the​ ​token​ ​and​ ​anyone​ ​on​ ​the​ ​network​ ​can​ ​verify​ ​it.

Intrinsic​ ​properties​ ​of​ ​Blockchain

Distributed​ ​ledger
Information in blockchain is shared and continually reconciled by all nodes in the network. The
database​ ​isn’t​ ​stored​ ​at​ ​central​ ​location​ ​and​ ​is​ ​truly​ ​publicly​ ​accessible.

​ ​ ​ ​ ​ ​ ​ ​3
Decentralization
Stores asset in network which can be access over internet. Through decentralized technology,
the owner has direct control via their private key. The owner can transfer the asset whenever
and​ ​to​ ​anyone.

How​ ​Blockchain​ ​works


Step​ ​1​ ​-​ ​User​ ​requests​ ​the​ ​transaction
Step​ ​2​ ​-​ ​The​ ​transaction​ ​is​ ​broadcasted​ ​to​ ​blockchain​ ​network
Step​ ​3​ ​-​ ​The​ ​network​ ​nodes​ ​validates​ ​the​ ​transaction
Step​ ​4​ ​-​ ​Once​ ​verified,​ ​transaction​ ​along​ ​with​ ​other​ ​verified​ ​transaction​ ​are​ ​combined​ ​to​ ​create
new​ ​block​ ​for​ ​the​ ​ledger
Step​ ​5​ ​-​ ​The​ ​new​ ​ledger​ ​block​ ​is​ ​added​ ​at​ ​the​ ​end​ ​of​ ​blockchain
Step​ ​6​ ​-​ ​the​ ​transaction​ ​is​ ​completed

Image​ ​Reference​ ​-​ ​https://blockgeeks.com/guides/what-is-blockchain-technology/

​ ​ ​ ​ ​ ​ ​ ​4
Introduction​ ​to​ ​Bitcoin
Bitcoin is a electronic payment system based on cryptographic proof instead of relying on
trusted third party like banks, allowing two parties to transact directly without ever need of a
central intermediary. Transaction in bitcoin blockchain are computationally impractical to reverse
and would protect buyer and seller from fraud. Bitcoin blockchain essentially address the
problem of double-spending using peer-to-peer distributed timestamp server to generate
computational​ ​proof​ ​of​ ​chronological​ ​order​ ​of​ ​transactions​ ​[​ ​distributed​ ​ledger​ ​].

Transactions
Bitcoin coin is a chain of digital signatures. Owner can transfer the coin by digitally signing the
hash of previous transaction and public key of the next owner and adding it to the end of the
coin.

This requires a way for payee to check if sender has not double-spend the coin. The only way to
confirm the absence of transaction is to be aware of all transaction. Bitcoin implements this by

​ ​ ​ ​ ​ ​ ​ ​5
the means of single longest running transaction chain which is agreed by by all participant in the
network.​ ​It​ ​achieves​ ​it​ ​by​ ​implementing​ ​timestamp​ ​server​ ​and​ ​proof-of-work​ ​model.

Timestamp​ ​Server
It works by taking a hash of block of transaction to be timestamped and publishing it to network.
Each timestamp included the previous timestamp in its hash, forming a chain, thus reinforcing
the​ ​previous​ ​transaction​ ​history.

Proof-of-Work
To implement distributes timestamp server on peer-to-peer system, bitcoin uses proof-of-work
system similar to Adam Back’s Hashcash implementation. The main idea behind it is, user who
calculates a hash of a block, needs to find a random number which when added to the block as
nonce, would produce a hash which starts with certain number of zeros. It has been
mathematically proven that the difficulty of generating such hash increases exponentially with
number​ ​of​ ​zero​ ​bits.

Proof-of-Work is essentially one-cpu-one-vote. The majority decision is represented by longest


chain in blockchain. If majority of CPU power is controlled by honest node then valid chain grow

​ ​ ​ ​ ​ ​ ​ ​6
and will represent the state of the network. To modify the past transaction, attacker needs to
redo the proof-of-work of all past nodes. The mathematical model proves that probability of slow
running attacker node to catch up the good node diminished exponentially as new blocks gets
added​ ​to​ ​the​ ​network.

Transaction​ ​Verification
In bitcoin network, it is possible to verify the payment without running the full node. A user could
only keep the block headers of longest proof-of-work chain and can query the markel root of the
block where the transaction is timestamped. By looking at the transaction, he can verify that
transaction indeed happened at that timestamp and which was also approved by other network
nodes.

Incentive
By design the first transaction in a block is a special transaction that starts a new coin owned by
the creator of the block. This is the way to incentivize the miner who support the network by

​ ​ ​ ​ ​ ​ ​ ​7
running mining algorithm. The second incentive is in the form of transaction fees which gets
added​ ​to​ ​the​ ​incentive​ ​for​ ​mining​ ​the​ ​block.

Drawbacks
It’s been close to nine years since first bitcoin was minted and there has been many theories
about authenticity of the idea and if it ever going to replace the traditional financial institution.
Before we conclude on the bitcoin fundamental, lets discuss some of the known drawbacks of
bitcoin.

● Valuation​ ​Fluctuation
● Zero-Day​ ​bug​ ​in​ ​bitcoin​ ​protocol
● Phising​ ​attack​ ​on​ ​wallet
● Mainstream​ ​adaptation
● Deflation by design - since total number of bitcoin are fixed, the value will increase as it
gets​ ​mainstream​ ​adoption
● No​ ​physical​ ​form
● Valuation​ ​guarantees

​ ​ ​ ​ ​ ​ ​ ​8
Introduction​ ​to​ ​Ethereum
Bitcoin is often described as radical development in digital currency with no backing or intrinsic
value, no centralized authority or issuer. The other aspect which bitcoin is the use of blockchain
as a means of distributed consensus. Ethereum can be think of as version 2.0 of blockchain
paradigm where one can run arbitrary piece of code know an smart contract to control the
underlying asset. ​Ethereum is a blockchain with a built-in turing-complete programming
language that can be used to create smart contracts that can be used to code arbitrary
state​ ​transition​ ​functions​ ​to​ ​create​ ​a​ ​distributed​ ​consensus​ ​system.

The purpose of Ethereum is to create an alternative protocol for building decentralized


application [ DApp ] with ​emphasis on rapid development, security and the ability of
different applications to interact​. ​Ethereum does this by building an abstract foundational
layer, which is a blockchain with a built-in Turing-complete programming language
which allows anyone to write smart contracts and decentralized applications with their
own rules for ownership, transaction formats and state transition functions. Ethereum is
more versatile than Bitcoin ​because of the Turing-completeness, value-awareness,
blockchain-awareness​ ​and​ ​state.

Ethereum​ ​Design​ ​Principles


Ethereum​ ​protocol​ ​relies​ ​on​ ​five​ ​basic​ ​principles
1. Sandwich complexity model: It believe that the bottom level architecture of Ethereum
should be as simple as possible, and the interfaces to Ethereum should be as easy
to understand as possible. Where complexity is inevitable, it should be pushed into
the "middle layers" of the protocol, that are not part of the core consensus but are
also​ ​not​ ​seen​ ​by​ ​end​ ​users.
2. Freedom: Users should not be restricted in the way they use the Ethereum protocol.
It should not attempt to preferentially favor or disfavor certain kinds of Ethereum
contracts​ ​or​ ​transactions​ ​based​ ​on​ ​the​ ​nature​ ​of​ ​their​ ​purpose.

​ ​ ​ ​ ​ ​ ​ ​9
3. Generalization: Protocol features in Ethereum should embody maximally low-level
concepts, so that they can be combined in arbitrary ways including ways that may
not​ ​seem​ ​useful​ ​today​ ​but​ ​which​ ​may​ ​become​ ​useful​ ​later.
4. Have No Features: Refuse to build very common high-level use cases as intrinsic
parts of the protocol. If user want to build it that way, they can create sub currency
on​ ​top​ ​of​ ​ethereum​ ​blockchain.
5. Non-risk-aversion: They are okay with higher degrees of risk if it provides very
substantial​ ​benefits​ ​like​ ​increasing​ ​the​ ​transaction​ ​speed​ ​by​ ​50x.

How​ ​Ethereum​ ​Blockchain​ ​works


Ethereum blockchain is essentially a state machine where state transitions are driven by inputs.
The ethereum state machine starts with genesis state with no transaction. As transaction
happenes, it transition into some final state. At any given time, the final state represent the
current​ ​state​ ​of​ ​the​ ​system.

As in bitcoin, in Ethereum, every transaction ever occurred would belong to some block and
blocks are chained together. The longest running chain represents the valid transaction history
and is validated by Proof-of-Work terminology. It used GHOST [ Greedy Heaviest Observed
Subtree​ ​]​ ​algorithm​ ​to​ ​identify​ ​the​ ​longest​ ​running​ ​chain.

​ ​ ​ ​ ​ ​ ​ ​10
Basic​ ​Elements​ ​of​ ​Ethereum

Accounts
The global state of Ethereum is comprised of many small objects known as accounts, that are
able to interact with one another through a message-passing framework. Each account has
state associated with it and 20 byte address which identifies the account. There are two types of
account, an end user accounts associated with Private key and contract account, controlled by
their​ ​contract​ ​code​ ​and​ ​has​ ​code​ ​associated​ ​with​ ​it.
An externally owned account can send messages to other externally owned accounts or to other
contract accounts by signing a transaction using its private key. While a message from an
externally owned account to a contract account activates the contract account’s code, allowing it
to perform various actions (e.g. transfer tokens, write to internal storage, mint new tokens,
perform​ ​some​ ​calculation​ ​or​ ​create​ ​new​ ​contracts)

State

The​ ​account​ ​state​ ​consists​ ​of​ ​four​ ​components

1. nonce: If the account is an externally owned account, this number represents the
number of transactions sent from the account’s address. If the account is a contract
account,​ ​the​ ​nonce​ ​is​ ​the​ ​number​ ​of​ ​contracts​ ​created​ ​by​ ​the​ ​account.
2. balance:​ ​The​ ​number​ ​of​ ​Wei​ ​owned​ ​by​ ​this​ ​address.​ ​There​ ​are​ ​1e18​ ​Wei​ ​per​ ​Ether.
3. storageRoot: A hash of the root node of a Merkle Patricia tree. This tree encodes the
hash​ ​of​ ​the​ ​storage​ ​contents​ ​of​ ​this​ ​account,​ ​and​ ​is​ ​empty​ ​by​ ​default.
4. codeHash: The hash of the EVM (Ethereum Virtual Machine) code of this account. For
contract accounts, this is the code that gets hashed and stored as the codeHash. For
externally​ ​owned​ ​accounts,​ ​the​ ​codeHash​ ​field​ ​is​ ​the​ ​hash​ ​of​ ​the​ ​empty​ ​string.

Gas​ ​and​ ​Fees

Gas is the unit used to measure the fees required for a particular computation. Gas price is the
amount of Ether you are willing to spend on every unit of gas, and is measured in “gwei.” “Wei”
is the smallest unit of Ether, where 1e18 Wei represents 1 Ether. One gwei (​shannon​) ​is 1e9
Wei.

​ ​ ​ ​ ​ ​ ​ ​11
With every transaction, a sender sets a gas limit and gas price. The product of gas price and
gas limit represents the maximum amount of Wei that the sender is willing to pay for executing a
transaction. For example,say the sender sets the gas limit to 50,000 and a gas price to 20 gwei.
This implies that the sender is willing to spend at most 50,000 x 20 gwei =
1,000,000,000,000,000 Wei = 0.001 Ether to execute that transaction. All the money spent on
gas​ ​by​ ​the​ ​sender​ ​is​ ​sent​ ​to​ ​the​ ​“beneficiary”​ ​address,​ ​which​ ​is​ ​typically​ ​the​ ​miner’s​ ​address.

Transactions

It is a cryptographically signed piece of instruction that is generated by an externally owned


account, serialized, and then submitted to the blockchain network. There are two types of
transactions:​ ​message​ ​calls​ ​and​ ​contract​ ​creations.
A​ ​transaction​ ​contains​ ​following​ ​elements​ ​regardless​ ​of​ ​its​ ​type.
1. nonce:​ ​a​ ​count​ ​of​ ​the​ ​number​ ​of​ ​transactions​ ​sent​ ​by​ ​the​ ​sender.
2. gasPrice: the number of Wei that the sender is willing to pay per unit of gas required to
execute​ ​the​ ​transaction.
3. gasLimit: the maximum amount of gas that the sender is willing to pay for executing this
transaction.​ ​This​ ​amount​ ​is​ ​set​ ​and​ ​paid​ ​upfront,​ ​before​ ​any​ ​computation​ ​is​ ​done.
4. to: the address of the recipient. In a contract-creating transaction, the contract account
address​ ​does​ ​not​ ​yet​ ​exist,​ ​and​ ​so​ ​an​ ​empty​ ​value​ ​is​ ​used.
5. value: the amount of Wei to be transferred from the sender to the recipient. In a
contract-creating transaction, this value serves as the starting balance within the newly
created​ ​contract​ ​account.
6. v,​ ​r,​ ​s:​ ​used​ ​to​ ​generate​ ​the​ ​signature​ ​that​ ​identifies​ ​the​ ​sender​ ​of​ ​the​ ​transaction.
7. init (only exists for contract-creating transactions): An EVM code fragment that is used to
initialize the new contract account. init is run only once, and then is discarded. When init
is first run, it returns the body of the account code, which is the piece of code that is
permanently​ ​associated​ ​with​ ​the​ ​contract​ ​account.
8. data (optional field that only exists for message calls): the input data (i.e. parameters) of
the​ ​message​ ​call.

​ ​ ​ ​ ​ ​ ​ ​12
Blocks

All transactions are grouped together into “blocks.” A blockchain contains a series of such
blocks​ ​that​ ​are​ ​chained​ ​together.
In​ ​Ethereum,​ ​a​ ​block​ ​consists​ ​of:
● the​ ​block​ ​header
● information​ ​about​ ​the​ ​set​ ​of​ ​transactions​ ​included​ ​in​ ​that​ ​block
● a​ ​set​ ​of​ ​other​ ​block​ ​headers​ ​for​ ​the​ ​current​ ​block’s​ ​ommers.
Where​ ​ommers​ ​is​ ​a​ ​block​ ​whose​ ​parent​ ​is​ ​equal​ ​to​ ​the​ ​current​ ​block’s​ ​parent’s​ ​parent

Ethereum​ ​Milestones
The​ ​ethereum​ ​blockchain​ ​is​ ​divided​ ​in​ ​four​ ​milestones

Phase​ ​1:​ ​Frontier​ ​Release

It is a minimalist release which has a command line interface to talk to ethereum blockchain. It
allows​ ​user​ ​to​ ​transact​ ​ether,​ ​create​ ​or​ ​upload​ ​contracts,​ ​allows​ ​trade​ ​platform​ ​to​ ​tread​ ​ther,

Phase​ ​2:​ ​Homestead​ ​Release

The​ ​Homestead​ ​Phase​ ​was​ ​initiated​ ​after​ ​Frontier​ ​was​ ​extensively​ ​tested​ ​and​ ​classified​ ​by​ ​the
core​ ​developers​ ​as​ ​stable​ ​and​ ​safe.

Phase​ ​3:​ ​Metropolis​ ​Release

● Increased​ ​security​ ​for​ ​lite​ ​client​ ​wallets,

● zkSNARKS​ ​will​ ​bring​ ​improvements​ ​to​ ​transaction​ ​privacy​ ​through​ ​anonymity.

● More​ ​predictable​ ​gas​ ​charges

Phase​ ​4:​ ​Serenity​ ​Release

Serenity is the fourth and final phase of Ethereum. Because PoW (Proof of Work) consumes
enormous waste of energy, the developers want to find an alternative in this phase. The
Ethereum Network is expected to be converted from PoW to PoS (Proof of Stake). Apart from

​ ​ ​ ​ ​ ​ ​ ​13
this, the network should be faster, more efficient, easier for beginners and more resilient against
the​ ​closure​ ​of​ ​mining​ ​capacity

Smart​ ​Contracts
Smart contracts are software programs that live on a blockchain and form the basis of many of
the new blockchain applications. Smart contracts are automated systems that can provide
services in exchange for cryptocurrency. Since blockchain is not good at storing large amount of
data nor querying state of the outside world, they need a service outside of blockchain to get
information that it needs. Let’s take an example of flight insurance service running on
blockchain,​ ​we​ ​will​ ​go​ ​through​ ​the​ ​process​ ​of​ ​managing​ ​insurance​ ​payout​ ​through​ ​blockchain.

Step 1: User buys flight insurance by sensing ether to blockchain contract providing flight
insurance​ ​service.

Step 2: Smart contract sends information to outside service [ REST API ] to get the flight
information​ ​and​ ​historical​ ​data​ ​to​ ​get​ ​flight​ ​history

Step 3: Smart contract uses this information to decide if offered premium is good enough. If the
smart​ ​contract​ ​accepts​ ​the​ ​premium,​ ​it​ ​asks​ ​the​ ​API​ ​service​ ​to​ ​report​ ​the​ ​status​ ​of​ ​the​ ​flight.

Step 4: The REST API uses flight information to provide realtime flight status back to smart
contract

Step​ ​5:​ ​If​ ​the​ ​flight​ ​is​ ​delays,​ ​the​ ​contract​ ​pays​ ​the​ ​passenger​ ​else​ ​it​ ​pays​ ​it​ ​self.

Proof​ ​of​ ​Work​ ​vs​ ​Proof​ ​of​ ​Stack


Proof of Stake (PoS) is a type of consensus algorithms for blockchains that depend on a
validator's stake in the network. The fundamental difference between Proof-of-Work vs
Proof-of-Stack​ ​is

​ ​ ​ ​ ​ ​ ​ ​14
● In proof of work (PoW) based public blockchains, the algorithm rewards miners
who solve cryptographic puzzles in order to validate transactions and create new
blocks.
● In PoS-based public blockchains (Ethereum upcoming Casper implementation),
a set of validators take turns proposing and voting on the next block, and the
weight​ ​of​ ​each​ ​validator's​ ​vote​ ​depends​ ​on​ ​the​ ​size​ ​of​ ​its​ ​deposit​ ​(i.e.​ ​stake).

Major advantages of PoS is security, reduced risk of centralization and energy


efficiency.

Cryptocurrency​ ​Market​ ​Cap

Data​ ​Source​ ​-​ ​https://coinmarketcap.com/

​ ​ ​ ​ ​ ​ ​ ​15
References
1. Bitcoin:​ ​A​ ​Peer-to-Peer​ ​Electronic​ ​Cash​ ​System​ ​-​ h
​ ttps://bitcoin.org/bitcoin.pdf
2. Blockchain​ ​Architecture​ ​-
https://www.pluralsight.com/guides/software-engineering-best-practices/blockchain-archi
tecture
3. Special​ ​Rpport​ ​-​ ​Blockchain​ ​World​ ​-
https://spectrum.ieee.org/static/special-report-blockchain-world
4. Ethereum​ ​-​ ​White​ ​Paper​ ​-​ ​https://github.com/ethereum/wiki/wiki/White-Paper
5. Ethereum​ ​-​ ​Design​ ​Rational​ ​-​ ​https://github.com/ethereum/wiki/wiki/Design-Rationale
6. Ethereum​ ​-​ ​Proof​ ​Of​ ​Stack​ ​-​ ​https://github.com/ethereum/wiki/wiki/Proof-of-Stake-FAQ
7. Ethereum​ ​-​ ​Hard​ ​Problems​ ​in​ ​Cryptocurrency​ ​-
https://github.com/ethereum/wiki/wiki/Problems
8. How​ ​Smart​ ​Contract​ ​Works​ ​-
https://spectrum.ieee.org/computing/networks/how-smart-contracts-work
9. Proof​ ​Of​ ​Stack​ ​Design​ ​Phylosophy​ ​-
https://medium.com/@VitalikButerin/a-proof-of-stake-design-philosophy-506585978d51
10. Go​ ​Implementation​ ​of​ ​Ethereum​ ​-​ ​https://geth.ethereum.org/
11. How​ ​Does​ ​Ethereum​ ​Work​ ​-
https://medium.com/@preethikasireddy/how-does-ethereum-work-anyway-22d1df50636
9
12. How​ ​Blockchain​ ​Works​ ​-​ ​https://blockgeeks.com/guides/what-is-blockchain-technology/
13. Cryptocurrency​ ​Valuation​ ​-​ ​https://coinmarketcap.com/

​ ​ ​ ​ ​ ​ ​ ​16

You might also like