Introduction To Blockchains
Introduction To Blockchains
By
Prof. Rajhans Mishra
The Beginning Argument
• Blockchain as a concept was there before Bitcoin as well
• Bitcoin gave the first practical use case
• Satoshi Nakamoto ( pseudonym) on October 31, 2008, that set the basic
structure of the Bitcoin network.
• Paper Titled : Bitcoin: A Peer-to-Peer Electronic Cash System
• https://bitcoin.org/bitcoin.pdf
• A set of ecosystem without relying on Trust
• Shared Public Ledger (Distributed ledger)
• There are many use cases beyond Cryptocurrencies possible for Blockchain
• Difference between Digital currency(Payments) and Bitcoins (Cryptographic
currency)
Continued…
• Motivation for anything like Bitcoin
• P2P (Payment without intervention)
• No Intermediary ( Low transaction fee)
• Quick for settlement
• Easy to pay ( like sending the emails)
• Its all on the basis of predefined system driven Algos
• Transparency on Transaction
• Central Bank Digital Currency (CBDC)
Bitcoins
• Hashing, Blockchain and Cryptography are the basic building blocks
• Permissionless (v/s Permissioned)
• Intrinsic Value ?
• Volatility / trading
• Bitcoins are fungible
• Turing incomplete
• Reward for mining (why?)
Bitcoin Volatility
Date: 31/01/2023
Bitcoin – All Time High
Bitcoin Pizza Day
• First Bitcoin Transaction for Buying something:
• 22nd May 2010 : To Buy two Pizza from a local store
• Paid : 10, 000 Bitcoins
• May 22 is called as Bitcoin Pizza Day
• https://www.ndtv.com/business/the-first-bitcoin-transaction-was-for-buying-
pizzas-more-interesting-tidbits-inside-2512643
• https://www.businesstoday.in/crypto/story/two-pizzas-for-rs-2260-crores-12-
years-of-the-bitcoin-pizza-day-334204-2022-05-19
How Blockchains Work?
Continued..
Source: https://blog.goodaudience.com/
Blockchain How does it work?
Source: https://blog.goodaudience.com/
Continued..
Source: https://blog.goodaudience.com/
Continued..
Source: https://blog.goodaudience.com/
Continued..
Source: https://blog.goodaudience.com/
Hash
Source: https://blog.goodaudience.com/
Cryptography
19
Cryptography
20
Encrypt
Use key = shift down 15 to encrypt the message “HELLO.”
123456 7 8 9 10 1112
A BC DE F GHI J K L
13 14 15 16 17 18 1920 21 22 23 24 25 26
MN OP Q R ST U V W X Y Z
Solution
Each character is shifted 15 characters down.
Letter H W. ( 8 + 15 =23)
Letter E T. (5 + 15 =20)
Letter L A. (12 + 15 =27-26=1)
Letter L A. (12 +15 =27-26=1)
Letter O D. (15+15=30-26=4)
The cipher text is WTAAD.
21
Decrypt
decrypt the message “WTAAD.”
123456 7 8 9 10 1112
A BC DE F GHI J K L
13 14 15 16 17 18 19 20 21 22 23 24
25 26
MN OP Q R ST U V W X Y
Solution Z
Each character is shifted 15 characters up.
Letter W H. (23-15=8)
Letter T E. (20-15=5)
Letter A L. (1-15= -14 +26 =12)
Letter A L. (1-15= -14 + 26=12)
Letter D O. (4-15 = -11+ 26=15)
The plaintext is HELLO.
22
Categories of cryptography
23
Symmetric-key cryptography
shared
26
Comparison between two categories of cryptography
27
Key Management
• Private keys are password-protected.
• If someone want your private key:
• They need the file contains the key
• They need the passphrase for that key
• If you have never written down your passphrase or told anyone
• Very hard to crack
• Brute-force attack won’t work
28
Message Integrity
29
MESSAGE INTEGRITY
we may not even need secrecy, but instead must have integrity !!.
30
Message and message digest
31
Checking integrity
Message
Message Message
• Prevents the sender from later claiming that he did not sent the message
33
Hand VS Digital Signature
4) Timestamp No Yes
34
Digital Signature Generation and Verification
Message Sender Message Receiver
Message Message
Private
Encryption Decryption
Key
35
How does it work
• Hashing
• Digital Signature
• Solving Cryptographic Puzzle
• Merkel Tree
What is Mining ?
• Mining – Adding new Block to the Blockchain
• Requires solving a cryptography puzzle
• Computationally difficult
• Reward for Mining
Which puzzle to be solved ?
• Guess the Value of Nonce (number only used once) to make the
resultant Hash a valid one
• Valid resultant Hash means – Mining is performed
• Requires very high computational power
• How does it work?
• Hash of Data (Transactions) and Nonce combined should be less than
the specified value
• Miner who gets that required Nonce will add the block to the existing
blockchain
Pictorial representation
• HV- Highest value (FF......FFF) 16 times HV
• LV-Lowest value (00…..000) 16 times
HN1
• AT- Arbitrary Threshold
• Hash Nonce1-HN1 Invalid Range
AT
HN2
Valid Range
LV
How a block looks like :
Block
Block Number
Time stamp
Data
Nonce
Hash
https://medium.com/loom-network/understanding-blockchain-fundamentals-part-1-byzantine-fault-tolerance-245f46fe8419
Byzantine Fault Tolerance(BGT)
https://en.bitcoin.it/wiki/Controlled_supply
Bitcoin Monetary Policy
• Halving
• Every 210000 blocks (or about every 4 years) number of bitcoins per block
reduced to half
• 2009 – 50 BTC / Block
• 2012 -25 BTC/ Block
• 2016 – 12.5 BTC / Block
• 2020- 6.25 BTC / Block
• 2024 – 3.125 BTC / Block
• Total 21 Millions – by 2040 will be mined
• Controlled by Software / algorithm / preprogrammed
Bitcoin As A State Transition System
Courtesy - https://ethereum.org/en/whitepaper/
Continued…
• Ledger of a cryptocurrency such as Bitcoin can be thought of as a
state transition system
• "state" consisting of the ownership status of all existing bitcoins
• "state transition function" that takes a state and a transaction and
outputs a new state which is the result.
• APPLY(S,TX) -> S' or ERROR
• APPLY({ Alice: $50, Bob: $50 },"send $20 from Alice to Bob") = { Alice:
$30, Bob: $70 }
• “State" = Unspent transaction outputs (UTXO)
Continued..
• UTXO having a denomination and an owner (defined by a 20-byte
address which is essentially a cryptographic public key)
• A transaction contains one or more inputs. Each input
• containing a reference to an existing UTXO
• and a cryptographic signature produced by the private key associated with
the owner's address,
• one or more outputs,
• with each output containing a new UTXO to be added to the state.
Continued..
• The state transition function APPLY(S,TX) -> S' can be defined roughly
as follows:
• For each input in TX:
• If the referenced UTXO is not in S, return an error.
• If the provided signature does not match the owner of the UTXO,
return an error.
• If the sum of the denominations of all input UTXO is less than the sum
of the denominations of all output UTXO, return an error.
• Return S with all input UTXO removed and all output UTXO added.
Bitcoin operational issues (Scalability)
• Scalability Problem restricts the usage of Bitcoin
• Restricted capability for huge Transactional data
• Limited size of the Blocks (1MB ) and Frequency
(10 minutes to mine per block)
Average Block time / Block frequency
• Bitcoin- 10 Minutes
• Ethereum – 15 Sec
• Ripple – 3.5 sec
• Litecoin- 2.5 Minutes
The Rigs Look like
• https://www.nytimes.com/interactive/2021/09/03/climate/bitcoin-
carbon-footprint-electricity.html
• https://www.businessinsider.in/cryptocurrency/news/watch-
malaysian-police-use-a-steamroller-to-crush-1069-bitcoin-mining-
rigs-worth-1-3-million/articleshow/84549421.cms
• https://www.theguardian.com/world/2022/jan/06/kazakhstan-
bitcoin-internet-shutdown
Ethereum
• Most popular Cryptocurrency after Bitcoin
• Launched in 2015 ( Vitalik Buterin, one of the co-founder)
• Ether as (native) Cryptocurrency
• Supports development of tokens
• It is Programmable (Turing complete)
• Ethereum is a platform to develop any application on the top
• DAO, Dapps, DeFi , NFT
• Extended the legacy of Cryptocurrency with additional features
like Smart Contracts
Continued..
• Open source , decentralized , reward for mining
• (The current mining reward is 2 ether per block plus all transaction and
gas fees contained in the block)
• Triggered the development of blockchain based ecosystem
• Ethereum Virtual Machine
• Gas : Amount of fee to be paid to miner for doing the
computation.
• To be included with the proposed transaction (controlling mechanism
to avoid infinite loop)
• Predefined computation rate wrt Gas.
• Gas v/s Ether conversion also exist
Ethereum :
Source-https://ethereum.org/en/what-is-ethereum/
Transaction Processing Speed
https://coinmarketcap.com/view/stablecoin/
Binance
• One of the biggest Crptocurrency exchange founded by Changpeng
Zhao ("CZ") and Yi He
• CZ Net worth was around $96 Billion (Jan 2022) , $43 Billion (2024)
• Launched two cryptocurrencies Binance Coin (BNB)-2017 launched in
June 2017 and Binance Smart Chain (BSC) -2020
• BSC operates using "Proof of Staked Authority", a combination
of proof of stake and proof of authority. It has 21 approved validators.
• As of 2021, Binance Coin was the cryptocurrency with the third
highest market capitalization
https://www.livemint.com/companies/people/richest-us-prisoner-worth-43-billion-binances-changpeng-zhao-will-see-
his-wealth-grow-even-in-jail-11714548346951.html
Blockchain versions
• Blockchain 1.0 - Currency
• Blockchain 2.0 – Contracts
• Blockchain 3.0 – Justice Applications beyond Currency,
Economics and Markets (Decentralized Governance , e-
Voting etc.)
https://www.cryptokitties.co/
ERC-1155
• Next step for creating Non fungible tokens
• Allows a contract that can contain both fungible and Non -
Fungible tokens
• Enjin (a gaming platform): Allows both Fungible and Non-Fungible
objects to be used during the game.
Decentraland
• Open-source 3D virtual world platform (Game)
• The first fully decentralized world, Decentraland is controlled via the DAO,
• DAO owns the most important smart contracts and assets of Decentraland.
Via the DAO, you decide and vote on how the world works.
(https://decentraland.org/)