You are on page 1of 193

CS4049

Blockchain and Cryptocurrency


Dr. Anwar Shah
Assistant Professor, National University of Computer and Emerging Sciences,
Faisalabad, Pakistan.

Spring 2023
Cryptocurrency
Contents – Module B
What is Bitcoin? Nonce Transactions

Bitcoin's Monetary CPU's vs GPU's vs


Wallets
Policy ASICs

Mining Mempool Public Key and Private


Key
Founder of
Bitcoin
Founder of Bitcoin
• Satoshi Nakamoto
• The first decentralized Blockchain was conceptualized by a person (or group
of people) known as Satoshi Nakamoto in 2008.
• Satoshi published the Bitcoin white paper
• Created and deployed Bitcoin using Blockchain Technology
• As part of the implementation, he also devised the first Blockchain database
Coin vs Token
Blockchain
Technology

Protocol/Coin Waves Bitcoin Ethereum

WGB BI TRX SNT


Token INTL WGR REP AE
Blockchain vs. Bitcoin
• Blockchain is the Technology, whereas,
• Bitcoin is a protocol which uses Blockchain technology
Protocol: A set of rules for transmitting data between electronic devices, such
as computers. For example, Bitcoin defines some set of rules i.e.
• How to work on Blockchain
• How mining will work
• How the rewards should be given to the miners etc.
Coin vs. Token
Coin:
• The coin is associated with the protocol
• The transaction take place and the fee is paid using these coins
Tokens:
• Tokens are used/ based on these platforms (Bitcoin, Ethereum, Waves)

Coin Market demonstration


To see Coins vs. Tokens on different platforms
https://coinmarketcap.com/
Coin vs. Token
• The terms "token" and "coin" are often used interchangeably, but they
actually have different meanings in the context of blockchain and
cryptocurrency.

• A coin is a unit of value that operates as a standalone digital currency on its


own blockchain network. Examples of coins include Bitcoin (BTC), Litecoin
(LTC), and Monero (XMR). These coins typically have their own
blockchain, consensus mechanism, and network infrastructure.
Coin vs. Token
• A token, on the other hand, is a digital asset that represents a particular asset
or utility on an existing blockchain network. Tokens are created using smart
contracts on a blockchain, such as Ethereum. These tokens can be used to
represent anything from digital assets like real estate or commodities, to
access to a particular service or application, to loyalty points for a company.
Coin vs. Token
• While coins operate as standalone currencies, tokens are dependent on the
underlying blockchain network and require it to function. Tokens can be
traded on cryptocurrency exchanges and used to access specific features or
services within the network. Examples of tokens include ERC-20 tokens on
the Ethereum network, Binance Coin (BNB) on the Binance Smart Chain,
and UNI on the Uniswap decentralized exchange.
Coin vs. Token
• Ethereum has its own cryptocurrency called Ether (ETH), which is used as the native
currency of the Ethereum network. ETH is used to pay for transaction fees and as a reward
for miners who process transactions and secure the network.

• In addition to ETH, Ethereum also allows the creation and use of tokens on its platform.
Tokens are digital assets that can represent anything from a digital currency to a specific
asset or utility within a particular application. These tokens are created using smart contracts
on the Ethereum platform, and they can be traded on various cryptocurrency exchanges.
However, it's important to note that tokens are not the same as ETH, and they are not the
native currency of the Ethereum network.
Birth of Bitcoin
• The 2008 USA crisis destroyed people trust on central authorities like banks
• A new model and a class of asset was required, independent of central
authorities
• In 2008, the Founder of the Bitcoin published a paper regarding Bitcoin
based on Blockchain.
• As Blockchain removes the need of central authority, and people interact
with each other directly.
• Bitcoin became popular and today it is the most popular Cryptocurrency
Bitcoin Network
Bitcoin Ecosystem
Node:
Bitcoin
• A computer that runs a Bitcoin software, and is Ecosystem

connected to the Bitcoin network


• Validate, broadcast, process and store BTC transactions
Miner:
• A special type of node that runs a version of software
that contains special rules for mining blocks

Miner Node Large Mines Mining Pool


Bitcoin Ecosystem
Large mine:
Bitcoin
• Has a huge setup Ecosystem
• Dalian, China: Hash rate is 360,000 TH, Monthly energy cost is $1,170,000,
Mines 750 Bitcoin every month, and Mines 3% of all Bitcoins

Mining Pool:
• Coordinate mining activity from groups of miners
• The reward is distributed to miners proportionate
to their number of resources
• Provide a steady stream of revenue for
small scale miner Miner Node Large Mines Mining Pool
Bitcoin's
Monetary
Policy
Bitcoin Monetary Policy
• Every country has central authorities like banks etc. that control the amount
of money in a system
• Monetary Policy is used to maintain the supply of a currency (money)
• Bitcoin has its own monetary policy developed by Satoshi Nakamoto
Bitcoin's Monetary Policy

The Halving Block Frequency


The Halving
Event Date Block number Reward

Launch of Bitcoin 03 Jan. 2009 0 50 new XBT


1st halving 28 Nov. 2012 210’000 25 new XBT
2nd halving 09 Jul. 2016 420’000 12.5 new XBT
3rd halving 11 May 2020 630’000 6.25 new XBT
4th halving Expected 2024 740’000 3.125 new XBT
5th halving Expected 2028 850’000 1.5625 new XBT
Maximum supply reached Expected 2140 6’930’000 0 new XBT

Note- Supply cap of Bitcoin is 21 million.


The Halving
• The bitcoins used in transaction fees halving every 210,000 blocks or four years
• That is why it is expected that these bitcoins will become 0 in 2140, therefore,
no new bitcoins will be added to the system
The Halving
• You cannot create gold, but you can print currency as many as possible
• Therefore, the supply of any currency or bitcoins should be controlled
• When Zimbabwe’s government prints many currencies, the banknote reached
100,000,000,000,000 (One hundred trillion dollars)
• However, what if the reward bitcoins becomes 0?
• Only, the fees will be deducted from the bitcoin account, as the bitcoins will be
adopted by people at that time
The Halving
Block Frequency
• This states that on average it will take 10 minutes to create a new block

Q). How is the monetary policy working in the existing protocol?


A). This is done automatically by the bitcoin algorithm/ protocol
The Halving
Demonstration: Checking the average time of mining a block
https://www.blockchain.com/explorer
https://www.blockchain.com/explorer/blocks/btc?page=1
• The Bitcoin Core protocol limits the block to 1 MB in size
• Each block contains at most some 4,000 transactions
• New blocks are added to the blockchain on average 10 minutes
• Therefore, the transaction rate is limited to some 7 transactions per second
(TPS)
Details
• Hash: A unique identifier for the block, generated through a cryptographic
algorithm that ensures the integrity of the block's contents.
• Capacity: The percentage of the block's maximum capacity that has been
used.
• Distance: The time between the block's creation and the creation of the
previous block, indicating the speed at which new blocks are added to the
blockchain.
• BTC: The amount of Bitcoin contained within the block.
Details
• Value: The total value of the Bitcoin contained within the block, calculated based
on the current market price.
• Value Today: The total value of the Bitcoin contained within the block at the current
market price.
• Average Value: The average amount of Bitcoin per transaction within the block.
• Median Value: The median amount of Bitcoin per transaction within the block.
• Input Value: The total value of the Bitcoin that was inputted into the block through
the transactions.
Details
• Output Value: The total value of the Bitcoin that was outputted from the block
through the transactions.
• Transactions: The number of transactions contained within the block.
• Witness Tx's: The number of transactions that utilize the Segregated Witness
(SegWit) protocol, which enables more transactions to be included in a block.
• Inputs: The number of Bitcoin inputs within the block's transactions, which
represent the Bitcoin that was sent to the recipient.
• Outputs: The number of Bitcoin outputs within the block's transactions, which
represent the Bitcoin that was received by the recipient.
Details
• Fees: The total fees paid by the transactions within the block, which are collected
by the miner who confirms the block.
• Fees Kb: The fee per kilobyte of transaction data within the block.
• Fees kWU: The fee per kiloweight unit, which accounts for the size of the
transaction data and the SegWit protocol.
• Depth: the transaction was confirmed in a block that is two blocks back from the
most recently confirmed block.
• Size: The size of the block in bytes.
• Version: The version number of the block. (The version number 0x20000000 (or 536870912 in decimal)

that appears in the block details you provided likely indicates that the block was created using version 2 of the Bitcoin protocol. )
Details
• Merkle Root: A unique identifier generated through a cryptographic algorithm that
ensures the integrity of the transactions within the block.
• Difficulty: The current level of difficulty for mining new blocks on the Bitcoin
network, which is adjusted periodically to maintain a consistent rate of new blocks.
• Nonce: A random value added to the block's contents during the mining process to
generate a valid hash.
• Bits: A representation of the block's target hash, used by miners to verify that a
valid hash has been found.
• Weight: A metric used to account for the size of transactions and the SegWit
protocol, which is used to calculate fees.
Details
• Minted: The amount of new Bitcoin created through the mining process for the
block.
• Reward: The total value of the new Bitcoin created and the fees collected by the
miner who confirms the block.
• Mined on: The date and time at which the block was confirmed by the miner.
• Height: The block's position within the blockchain, represented by a unique
number.
• Confirmations: The number of blocks added to the blockchain after the current
block, indicating the level of security and immutability of the transactions within
the block.
Details
• Fee Range: The range of fees paid by the transactions within the block, represented
in satoshis per byte of transaction data.
• Average Fee: The average fee per transaction within the block.
• Median Fee: The median fee per transaction within the block.
• Miner: The mining pool or individual miner who confirmed the block. In this case,
the block was confirmed by AntPool.
How Mining Works ?

Nonce

Target
How Mining Works ?
Nonce:

• The nonce is the number that Blockchain miners are solving for.

• demoblockchain.org/block
How Mining Works ?
Target

• Target is a number used in mining.


• It is a number that a block hash must be below for the block to be
added to the Blockchain.
• The target adjusts after every 2016 blocks (roughly two weeks) to
try and ensure that blocks are mined once every 10 minutes on
average.
• The target is adjusted by the algorithm or protocol automatically
How Mining Works ?
• d2fd3930d274b202fe8e7cb431e38a8b64ec396e15f5717e60493234b0de210a
• 52d095795c1dc87ff2f6b4d9b005a1fe2cfed01103763c9443f6d4496df8e800

• 0000005432d9f64f6e05c019f9302162100163b6cdba06bd72eee35cd19aebf

Smallest- 0000000.......................0 Largest- fffffffffffff..................f


How Mining Works ?
All Possible Hashes

Block No.-7 Largest

Nonce:512

Data:
Kshitij->Rakesh 500 coins
Raj->Bella 200 coins
Prev Hash: 0000AB23 Target('0000')
Hash: 0000b6aa
Smallest
Bitcoin's
Target
History
Bitcoin's Target History
Bitcoin Genesis Block

Block# 0

Hash: 000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f

This is the Bitcoin genesis block it marks the birth of the Bitcoin network and was mined by the project’s
mysterious creator 'Satoshi Nakamoto'. Its 50 bitcoin coinbase reward is unspendable as it was omitted
from the transaction database so any attempt to spend it would be rejected by the network. Whether this
was intentional or not is unknown.
This block was mined on 1/03/2009, 23:15:05 by Satoshi.
A total of 0.00 BTC ($0.00) were sent in the block with the average transaction being 0.0000 BTC
($0.00). Satoshi earned a total reward of 50.00 BTC $0.00. The reward consisted of a base reward of 50.00
BTC $0.00 with an additional 0.0000 BTC ($0.00) reward paid as fees for the 1 transaction which were
included in the block.
Bitcoin's Target History
Bitcoin Block

Block# 754,406

Hash: 000000000000000000074ba534a31b3bc67ccb0b4193fab88b88f0afd1b15d3d

This block was mined on 9/17/2022, 05:22:37 by Unknown. A total of 14,538.41 BTC ($289,334,787) were
sent in the block with the average transaction being 8.7845 BTC ($174,823). Unknown earned a total
reward of 6.25 BTC $124,383. The reward consisted of a base reward of 6.25 BTC for $124,383 with an
additional 0.2087 BTC ($4,153.42) reward paid as fees for the 1,655 transactions which were included in
the block.
Bitcoin's Target History
Block# 0
Mined on (1/03/2009, 23:15:05)
Hash: 000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f
Target: 10 Zeros at the beginning

Block# 754,406
Mined on (9/17/2022, 05:22:37)
Hash: 000000000000000000074ba534a31b3bc67ccb0b4193fab88b88f0afd1b15d3d
Target: 19 Zeros at the beginning.
Bitcoin's
Target
Difficulty
Understanding Mining Difficulty
Let's take a five-digit number= XXXXX

Area that can be covered


Understanding Mining Difficulty
Let's take a five-digit number= 0XXXX

Area that can be covered


Understanding Mining Difficulty
Let's take a five-digit number= 00XXX

Area that can be covered


Understanding Mining Difficulty
Let's take a five-digit number= 000XX

Area that can be covered


Understanding Mining Difficulty

Current Target:

0000000000000000000b3ce90000000000000000000000000000000000000000

19 leading 0's
Understanding Mining Difficulty
Total Possible 64-digits hexadecimal numbers = 16^64 ≃ 10^77

Total valid hashed(with 19 leading 0's) = 16^(64-19) ≃ 10^54

The probability that a randomly picked hash is valid = (10^54/10^77) ≃ 10^-23

OR
The probability that a randomly picked hash is valid = (1/16)^19 ≃ 10^-23
Understanding Mining Difficulty
Q) Who adjusts the difficulty?

To compensate for increasing hardware speed and varying interest in


running nodes over time, the proof-of-work difficulty is determined
by a moving average targeting an average number of blocks per hour.
If they’re generated too fast, the difficulty increases.
Satoshi Nakamoto
CPUs Vs
GPUs Vs
ASCIs
How Mining Works ?
All Possible Hashes

Block No.-6 Largest

Nonce:100

Data:
Kshitij->Rakesh 500 coins​​
Raj->Bella 200 coins
Prev Hash: 0000AB23 Target('0000')
Hash: cd19aebf
Smallest
How Mining Works ?
All Possible Hashes

Block No.-6 Largest

Nonce:76

Data:
Kshitij->Rakesh 500 coins
Raj->Bella 200 coins
Prev Hash: 0000AB23 Target('0000')
Hash: 1da81a0e
Smallest
How Mining Works ?
All Possible Hashes

Block No.-6 Largest

Nonce: 201
Data:
Kshitij->Rakesh 500 coins
Raj->Bella 200 coins
Prev Hash: 0000AB23 Target('0000')
Hash: b474e220
Smallest
How Mining Works ?
All Possible Hashes

Block No.-7 Largest

Nonce:512

Data:
Kshitij->Rakesh 500 coins
Raj->Bella 200 coins
Prev Hash: 0000AB23 Target('0000')
Hash: 0000b6aa
Smallest
CPUs Vs GPUs Vs ASCIs
• If one miner generates 5H/s and the second generates 10H/s
• The second miner has higher chances to generate the hashes quickly and win the reward
• Miner uses different technologies that generate different hashes per second
• At the start, people used CPUs (General purposes) for mining
• Then GPUs were used, as GPUs generate hashes much faster than CPUs
• GPU not specialized in generating hashes i.e., GPU can be used for gaming, etc.
• ASIC was introduced, specialized in generating hashes, and is capable of generating hashes
much faster than GPUs
• The latest Bitcoin ASIC miner (S19 Pro version) can generate 110 TH/s
CPUs Vs GPUs Vs ASCIs

CPU < 10 MH/s

GPU < 1 GH/s

ASIC > 1000 GH/s


Mining
Pool
Mining Pools
Mining Pools
Mining Pools
Mining Pools
• A space that allows miners to work cooperatively to mine blocks
• Miner interacts with each other using different technologies
• If big miners join the network (Industries created), the chances for small miners
to mine blocks decrease and thus exploited (Elon Musk)
• Therefore, mining pools are created, where small miners work jointly
• Rewards are distributed proportionately to the provided resources
• The software used for the mining pool ensures parallelism and miners work on
different ranges
Mining Pools
Advantages of joining Mining Pools:
• Provide faster processing
• Cheaper, can provide a stable income
• If one is unaware of the mining, he pays small fees and joins the pool

Disadvantages of joining Mining Pools:


• Joining a very big pool gives a small portion of the reward
• Bigger pools get a high commission
Hash rate Distribution Demonstration
https://www.blockchain.com/charts/pools
Nonce
Range
Nonce Range
Block No.-1

Nonce: A nonce is a 32-bit number.

Data

Range of Nonce = 0 to 2^32 –1 ≃ 4 x10^9


Prev Hash:000000000
Hash:0000D8C42
Nonce Range

SHA 256

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Total number of possible hashes = 16 x 16 x......16 = 16^64 ≃ 10^77


Nonce Range
• Nonce is a 32-bit number
• The total numbers of nonces are 2^32 ≃ 4 billion
• SHA-256 has 64 hexadecimal numbers each position has 16 possibilities
• The total number of hashes that can be generated from SHA-256 is
16^64 ≃ 10^77
Nonce Range
Total hashes ≃ 10^77

Total number of Nonce that we can generate ≃ 4 x10^9

10^77 >>>>> 4 x10^9


10^77 is much greater than 4x10^9

=> That there are not enough nonce to generate the valid hash.
Nonce Range
• Total Nonces ≃ 4 x10^9 on the left side Hashes
Nonces
• Total hashes ≃ 10^77 on the right side
• Some parts of the hashes can be generated by
a nonce
• A modest miner generates 10^8 H/s, then 4
billion nonces will be covered in 40 seconds.
• How to check the remaining hashes?
Nonce Range
A modest mines does 10^8 hashes/sec.
4 x 10^9 nonce will be covered in = (4 x 10^9)/(10^8)= 40 seconds.

Q) So what the miners do when all the nonce get exhausted and miners
have not hit the target ?
Timestamp
Timestamp
• The timestamp field is introduced to generate the remaining hashes.
• Timestamp is a Unix time, Unix time represents time in seconds, and it started
when Unix was introduced.
• The hash is calculated for all the block fields including a timestamp
• Miner exhaust 0.1 billion nonces in 1 second, while meantime the timestamp
changes and due to avalanche effect, the new hashes will be drastically
changed.
Timestamp
Block No.-1

Nonce:

Data

Prev Hash:000000000
Hash:
Timestamp
Block No.-1

Nonce:

Timestamp: 1622186555
SHA 256

Data

Prev Hash:000000000
Hash:
Timestamp
Block No.-1

Nonce: A miner exhaust 4 Billion nonce in


Timestamp: 1622186555
40 sec.

Data A miner will exhaust 0.1 Billion


nonce in 1 sec.
Prev Hash:000000000
Hash:
Timestamp
Block No.-1

Nonce:

Timestamp: 1622186555 0.5 seconds


Data

Prev Hash:000000000
Hash:
Timestamp
Block No.-1

Nonce:

Timestamp: 1622186556

Data

Prev Hash:000000000
Hash:
Timestamp
Block No.-1

Nonce:

Timestamp: 1622186557

Data

Prev Hash:000000000
Hash:
Timestamp
Block No.-1

Nonce:

Timestamp: 1622186558

Data

Prev Hash:000000000
Hash:
Timestamp
The current hashing rate is 320.88 EH/s equal to 320 million trillion H/s
Hash rate demonstration
https://www.blockchain.com/charts/hash-rate
320 ignored
4 x 10^9 nonce will be covered in = (4 x 10^9)/( 10^6 x10^12) = 1.25 x 10^-8
seconds 1.25 x 10^-8 sec <<<<< 1 sec
Now at this rate, before the timestamp changes, all the nonce will be exhausted
New complication arises
Q)What should the miners do in idle time? Should they wait for
timestamp to change?
Mempool
Mempool
• Mempool is a place where all the unconfirmed transaction resides
• Mempool resides on every node just like blockchain resided on every node
(Will be covered in detail later)
• Mempool will be used to handle utilize miners’ resources effectively
• Mempool has thousands of unconfirmed transactions, miners get transactions
from the pool
• After adding transactions, the miner starts mining to solve the mathematical
problem
Mempool
• Miner exhausted all nonces in less than a second
• Timestamp is also not changed
• Still valid hash not computed
• Then, the Mempool transaction will be used for changing the hash
• If nonces are exhausted and the timestamp is not changed, the transaction
picked will be changed
• Thus, using different transactions, the miner can reuse the nonce from the start
Mempool
Block No.-1

Nonce:

Timestamp:

Transactions:

Prev Hash:000000000
Hash:
Mempool
FF3ABC Fees:0.0008
Block No.-1
D23ABC Fees:0.001
Nonce:
A21ADC Fees:0.002
Timestamp:
B24ABE Fees:0.006
Transactions:

43AFBC Fees:0.007

E23AB2 Fees:0.004
Prev Hash:000000000
F23A6C Fees:0.005 Hash:

Mempool
How actually mining of transaction
takes place?
FF3ABC Fees:0.0008
Block No.-1
D23ABC Fees:0.001
Nonce:
A21ADC Fees:0.002
Timestamp:
B24ABE Fees:0.006
Transactions:

43AFBC Fees:0.007

E23AB2 Fees:0.004
Prev Hash:000000000
F23A6C Fees:0.005 Hash:

Mempool
How actually mining of transaction
takes place?
FF3ABC Fees:0.0008
Block No.-1
D23ABC Fees:0.001
Nonce:
A21ADC Fees:0.002
Timestamp:
B24ABE Fees:0.006
Transactions:

43AFBC Fees:0.007

E23AB2 Fees:0.004
Prev Hash:000000000
F23A6C Fees:0.005 Hash:

Mempool
How actually mining of transaction
takes place?
FF3ABC Fees:0.0008
Block No.-1
D23ABC Fees:0.001
Nonce:
A21ADC Fees:0.002
Timestamp:
B24ABE Fees:0.006
Transactions:

43AFBC Fees:0.007

E23AB2 Fees:0.004
Prev Hash:000000000
F23A6C Fees:0.005 Hash:

Mempool
How actually mining of transaction
takes place?
FF3ABC Fees:0.0008
Block No.-1
D23ABC Fees:0.001
Nonce:
A21ADC Fees:0.002
Timestamp:
B24ABE Fees:0.006
Transactions:

43AFBC Fees:0.007

E23AB2 Fees:0.004
Prev Hash:000000000
F23A6C Fees:0.005 Hash:

Mempool
How actually mining of transaction
takes place?
FF3ABC Fees:0.0008
Block No.-1
D23ABC Fees:0.001
Nonce:

A21ADC Fees:0.002 Timestamp: 1622186558


Transactions:
B24ABE Fees:0.006 43AFBC Fees:0.007
B24ABE Fees:0.006
F23A6C Fees:0.007
F23A6C Fees:0.005
E23AB2 Fees:0.004 E23AB2 Fees:0.004

43AFBC Fees:0.005 Prev Hash:000000000

Mempool Hash:
How actually mining of transaction
takes place?
FF3ABC Fees:0.0008
Block No.-1
D23ABC Fees:0.001
Nonce:

A21ADC Fees:0.002 Timestamp: 1622186558


Transactions:
B24ABE Fees:0.006 43AFBC Fees:0.007
B24ABE Fees:0.006
F23A6C Fees:0.007
F23A6C Fees:0.005
E23AB2 Fees:0.004 E23AB2 Fees:0.004

43AFBC Fees:0.005 Prev Hash:000000000

Mempool Hash:
How actually mining of transaction
takes place?
FF3ABC Fees:0.0008
Block No.-1
D23ABC Fees:0.001
Nonce:

A21ADC Fees:0.002 Timestamp: 1622186558


<1s Transactions:
B24ABE Fees:0.006 43AFBC Fees:0.007
B24ABE Fees:0.006
F23A6C Fees:0.007
F23A6C Fees:0.005
E23AB2 Fees:0.004 E23AB2 Fees:0.004

43AFBC Fees:0.005 Prev Hash:000000000

Mempool Hash:
How actually mining of transaction
takes place?
FF3ABC Fees:0.0008
Block No.-1
D23ABC Fees:0.001
Nonce:

A21ADC Fees:0.002 Timestamp: 1622186558


<1s
Transactions:
B24ABE Fees:0.006 43AFBC Fees:0.007
B24ABE Fees:0.006
F23A6C Fees:0.007
F23A6C Fees:0.005
E23AB2 Fees:0.004 A21ADC Fees:0.002

43AFBC Fees:0.005 Prev Hash:000000000

Mempool Hash:
How actually mining of transaction
takes place?
FF3ABC Fees:0.0008
Block No.-1
D23ABC Fees:0.001
Nonce:

A21ADC Fees:0.002 Timestamp: 1622186558

<1s Transactions:
B24ABE Fees:0.006 43AFBC Fees:0.007
B24ABE Fees:0.006
F23A6C Fees:0.007
F23A6C Fees:0.005
E23AB2 Fees:0.004 A21ADC Fees:0.002

43AFBC Fees:0.005 Prev Hash:000000000

Mempool Hash:
How actually mining of transaction
takes place?
FF3ABC Fees:0.0008
Block No.-1
D23ABC Fees:0.001
Nonce:

A21ADC Fees:0.002 Timestamp: 1622186558

<1s Transactions:
B24ABE Fees:0.006 43AFBC Fees:0.007
B24ABE Fees:0.006
F23A6C Fees:0.007
F23A6C Fees:0.005
E23AB2 Fees:0.004 D23ABC Fees:0.001

43AFBC Fees:0.005 Prev Hash:000000000

Mempool Hash:
How actually mining of transaction
takes place?
FF3ABC Fees:0.0008
Block No.-1
D23ABC Fees:0.001
Nonce:

A21ADC Fees:0.002 Timestamp: 1622186558


<1s Transactions:
B24ABE Fees:0.006 43AFBC Fees:0.007
B24ABE Fees:0.006
F23A6C Fees:0.007
F23A6C Fees:0.005
E23AB2 Fees:0.004 D23ABC Fees:0.001

43AFBC Fees:0.005 Prev Hash:000000000

Mempool Hash:
How actually mining of transaction
takes place?
FF3ABC Fees:0.0008
Block No.-1
D23ABC Fees:0.001
Nonce:

A21ADC Fees:0.002 Timestamp: 1622186558


<1s Transactions:
B24ABE Fees:0.006 43AFBC Fees:0.007
B24ABE Fees:0.006
F23A6C Fees:0.007
F23A6C Fees:0.005
E23AB2 Fees:0.004 FF3ABC Fees:0.008

43AFBC Fees:0.005 Prev Hash:000000000

Mempool Hash:
How actually mining of transaction
takes place?
FF3ABC Fees:0.0008
Block No.-1
D23ABC Fees:0.001
Nonce:

A21ADC Fees:0.002 Timestamp: 1622186558


Transactions:
B24ABE Fees:0.006 43AFBC Fees:0.007
B24ABE Fees:0.006
F23A6C Fees:0.007
F23A6C Fees:0.005
E23AB2 Fees:0.004 FF3ABC Fees:0.0008

43AFBC Fees:0.005 Prev Hash:000000000

Mempool Hash:
How actually mining of transaction
takes place?
FF3ABC Fees:0.0008
Block No.-1
D23ABC Fees:0.001
Nonce:

A21ADC Fees:0.002 Timestamp: 1622186559


Transactions:
B24ABE Fees:0.006 43AFBC Fees:0.007
B24ABE Fees:0.006
F23A6C Fees:0.007
F23A6C Fees:0.005
E23AB2 Fees:0.004 E23AB2 Fees:0.004

43AFBC Fees:0.005 Prev Hash:000000000

Mempool Hash:
How actually mining of transaction
takes place?
FF3ABC Fees:0.0008
Block No.-1
D23ABC Fees:0.0001
Nonce:

A21ADC Fees:0.002 Timestamp: 1622186559


Transactions:
B24ABE Fees:0.006 43AFBC Fees:0.007
B24ABE Fees:0.006
F23A6C Fees:0.007
F23A6C Fees:0.005
E23AB2 Fees:0.004 E23AB2 Fees:0.004

43AFBC Fees:0.005 Prev Hash:000000000

Mempool Hash:
Mempool
• Generally, the miners pick transactions with high fees
• If a transaction is assigned minimum fees, then there is a chance that the
transaction will not be picked by any miners
• A transaction is removed from the pool after 72 hours
How
Mempool
works?
How does a Mempool work?
• Mempool is a place where all unconfirmed transactions saved
• Mempool is distributed, thus every node has its own Mempool
• When transactions are done, they are saved into a Mempool across the network
• Miner adds some transactions to a block and mines it, the information is sent to
other nodes, the block is verified, and the transactions are removed from the pool

Demonstration of Unconfirmed transactions


https://www.blockchain.com/btc/unconfirmed-transactions
How does a Mempool work? (Behind the scenes)
How does a Mempool work? (Behind the scenes)

DF123
How does a Mempool work? (Behind the scenes)

DF123
How does a Mempool work? (Behind the scenes)

DF123

DF123
DF123 DF123
How does a Mempool work? (Behind the scenes)

DF123

DF123
DF123 DF123
How does a Mempool work? (Behind the scenes)
DF123 DF123

DF123
DF123 DF123

DF123
DF123 DF123
How does a Mempool work? (Behind the scenes)
DF123 DF123

DF123
DF123 DF123

DF123
DF123 DF123
How does a Mempool work? (Behind the scenes)
DF123 DF123 DF123 DF123

DF123
DF123 DF123

DF123
DF123 DF123
How does a Mempool work? (Behind the scenes)
DF123 DF123 DF123 DF123

DF123
DF123 DF123 ABC56

DF123
DF123 DF123
How does a Mempool work? (Behind the scenes)
DF123 DF123 DF123 DF123

DF123
DF123 DF123 ABC56

DF123
DF123 DF123
How does a Mempool work? (Behind the scenes)
DF123 DF123 DF123 DF123
ABC56

DF123
DF123 DF123 ABC56
ABC56

DF123
DF123 DF123
ABC56
How does a Mempool work? (Behind the scenes)
DF123 DF123 DF123 DF123
ABC56

DF123
DF123 DF123 ABC56
ABC56

DF123
DF123 DF123
ABC56
How does a Mempool work? (Behind the scenes)
DF123 DF123 DF123 DF123
ABC56 ABC56

DF123
DF123 DF123 ABC56
ABC56 ABC56

DF123
DF123 DF123
ABC56 ABC56
How does a Mempool work? (Behind the scenes)
DF123 DF123 DF123 DF123
ABC56 ABC56

DF123
DF123 DF123 ABC56
ABC56 ABC56

DF123
DF123 DF123
ABC56 ABC56
How does a Mempool work? (Behind the scenes)
DF123 DF123 DF123 DF123
ABC56 ABC56 ABC56 ABC56

DF123
DF123 DF123 ABC56
ABC56 ABC56

DF123
ABC56 DF123 DF123
ABC56 ABC56
How does a Mempool work? (Behind the scenes)
DF123 DF123 DF123 DF123
ABC56 ABC56 ABC56 ABC56

DF123
DF123 DF123 ABC56
ABC56 ABC56

DF123
ABC56 DF123 DF123
ABC56 ABC56
How does a Mempool work? (Behind the scenes)
DF123 DF123 DF123 DF123
ABC56 ABC56 ABC56 ABC56

DF123
DF123 DF123 ABC56
ABC56 ABC56

DF123
ABC56 DF123 DF123
ABC56 ABC56
DF123 DF123 DF123 DF123
ABC56 ABC56 ABC56 ABC56
EF123 EF123 EF123 EF123
BBC66 BBC66 BBC66 BBC66

DF123
DF123 DF123 ABC56
ABC56 ABC56
EF123
EF123 EF123 BBC66
BBC66 BBC66

DF123
ABC56 DF123 DF123
EF123 ABC56 ABC56
BBC66 EF123 EF123
BBC66 BBC66
DF123 DF123 DF123 DF123
ABC56 ABC56 ABC56 ABC56
EF123 EF123 EF123 EF123
BBC66 BBC66 BBC66 BBC66

DF123
DF123 DF123 ABC56
ABC56 ABC56
EF123
EF123 EF123 BBC66
BBC66 BBC66

DF123
ABC56 DF123 DF123
EF123 ABC56 ABC56
BBC66 EF123 EF123
BBC66 BBC66
DF123 DF123 DF123 DF123
ABC56 ABC56 ABC56 ABC56
EF123 EF123 EF123 EF123
BBC66 BBC66 BBC66 BBC66

DF123
DF123 DF123 ABC56
ABC56 ABC56
EF123
EF123 EF123 BBC66
BBC66 BBC66

DF123
ABC56 DF123 DF123
EF123 ABC56 ABC56
BBC66 EF123 EF123
BBC66 BBC66
DF123 DF123 DF123 DF123
ABC56 ABC56 ABC56 ABC56
EF123 EF123 EF123 EF123
BBC66 BBC66 BBC66 BBC66

DF123
DF123 DF123 ABC56
ABC56 ABC56
EF123
EF123 EF123 BBC66
BBC66 BBC66

DF123
ABC56 DF123 DF123
EF123 ABC56 ABC56
BBC66 EF123 EF123
BBC66 BBC66
DF123 DF123 DF123 DF123
ABC56 ABC56 ABC56 ABC56
EF123 EF123 EF123 EF123
BBC66 BBC66 BBC66 BBC66

DF123
DF123 DF123 ABC56
ABC56 ABC56
EF123
EF123 EF123 BBC66
BBC66 BBC66

DF123
ABC56 DF123 DF123
EF123 ABC56 ABC56
BBC66 EF123 EF123
BBC66 BBC66
DF123 DF123 DF123 DF123
ABC56 ABC56 ABC56 ABC56
EF123 EF123 EF123 EF123
BBC66 BBC66 BBC66 BBC66

DF123
DF123 DF123 ABC56
ABC56 ABC56
EF123
EF123 EF123 BBC66
BBC66 BBC66

DF123
ABC56 DF123 DF123
EF123 ABC56 ABC56
BBC66 EF123
BBC66
DF123 DF123 DF123 DF123
ABC56 ABC56 ABC56 ABC56
EF123 EF123 EF123 EF123
BBC66 BBC66 BBC66 BBC66

DF123
DF123 DF123 ABC56
ABC56 ABC56
EF123
EF123 EF123 BBC66
BBC66 BBC66

DF123
ABC56 DF123 DF123
EF123 ABC56 ABC56
BBC66 EF123
BBC66
DF123 DF123 DF123 DF123
ABC56 ABC56 ABC56 ABC56
EF123 EF123 EF123 EF123
BBC66 BBC66 BBC66 BBC66

DF123
DF123 DF123 ABC56
ABC56 ABC56
EF123
EF123 EF123 BBC66
BBC66 BBC66

DF123
ABC56 DF123 DF123
EF123 ABC56 ABC56
BBC66 EF123
BBC66
DF123 DF123 DF123 DF123
ABC56 ABC56 ABC56 ABC56
EF123 EF123 EF123 EF123
BBC66 BBC66 BBC66 BBC66

DF123
DF123 DF123 ABC56
ABC56 ABC56
EF123
BBC66

DF123
ABC56 DF123 DF123
EF123 ABC56 ABC56
BBC66
DF123 DF123 DF123 DF123
ABC56 ABC56 ABC56 ABC56
EF123 EF123 EF123 EF123
BBC66 BBC66 BBC66 BBC66

DF123
DF123 DF123 ABC56
ABC56 ABC56
EF123
BBC66

DF123
ABC56 DF123 DF123
EF123 ABC56 ABC56
BBC66
DF123 DF123 DF123 DF123
ABC56 ABC56 ABC56 ABC56
EF123 EF123 EF123 EF123
BBC66 BBC66 BBC66 BBC66

DF123
DF123 DF123 ABC56
ABC56 ABC56
EF123
BBC66

DF123
ABC56 DF123 DF123
EF123 ABC56 ABC56
BBC66
DF123 DF123 DF123 DF123
ABC56 ABC56 ABC56 ABC56
EF123 EF123
BBC66 BBC66

DF123
DF123 DF123 ABC56
ABC56 ABC56

DF123
ABC56 DF123 DF123
ABC56 ABC56
DF123 DF123 DF123 DF123
ABC56 ABC56 ABC56 ABC56
EF123 EF123
BBC66 BBC66

DF123
DF123 DF123 ABC56
ABC56 ABC56

DF123
ABC56 DF123 DF123
ABC56 ABC56
DF123 DF123 DF123 DF123
ABC56 ABC56 ABC56 ABC56
EF123 EF123
BBC66 BBC66

DF123
DF123 DF123 ABC56
ABC56 ABC56

DF123
ABC56 DF123 DF123
ABC56 ABC56
DF123 DF123 DF123 DF123
ABC56 ABC56 ABC56 ABC56

DF123
DF123 DF123 ABC56
ABC56 ABC56

DF123
ABC56 DF123 DF123
ABC56 ABC56
DF123 DF123 DF123 DF123
ABC56 ABC56 ABC56 ABC56

DF123
DF123 DF123 ABC56
ABC56 ABC56

DF123
ABC56 DF123 DF123
ABC56 ABC56
DF123 DF123 DF123 DF123
ABC56 ABC56 ABC56 ABC56

DF123
DF123 DF123 ABC56
ABC56 ABC56

DF123
ABC56 DF123 DF123
ABC56 ABC56
Orphaned Blocks
• It does not matter who minded the block first. The only thing that
matters is who has the longest chain.
• Ideally wait for 6 confirmations before considering the
transaction to be successful.

6 confirmations
The 51% Attack

• The 51% attack is not about 51% of the network conspiracy against a single node
as it is practically impossible.

• The 51% attack is about having the control over the hashing power.
The 51% Attack
The 51% Attack
The 51% Attack
The 51% Attack
The 51% Attack

Broadcast
The 51% Attack

Broadcast
The 51% Attack

Broadcast
The 51% Attack

Broadcast
The 51% Attack

Broadcast
Transaction
and UTXOs
Transaction and UTXOs
• Transactions of Cryptocurrency are different from normal transactions
• A UTXO (Unspent transaction output) is the amount of digital currency remaining
after a cryptocurrency transaction
• To carry out transactions a cryptocurrency wallet is needed
• A wallet (device or program) stores cryptocurrency keys and allows to access coins.
a public key is a wallet address, and a private key is needed to sign transactions.
• In Blockchain, transactions once added never changed, and history remains forever
• The unspent transactions are chosen for further transactions
Transaction and UTXOs
Arjun-> Me 0.4 BTC
Raj -> Me 0.3 BTC
UTXOs Let say I buy coffee for 0.5 BTC.
Alice -> Me 0.7 BTC
Bob -> Me 0.1 BTC

Transaction :
Input: Output:
0.5 BTC to the coffee shop.
0.7 BTC from Alice
0.2 BTC back to me.
Transaction and UTXOs
Arjun-> Me 0.4 BTC
Raj -> Me 0.3 BTC
UTXOs Let say I buy coffee for 0.5 BTC.
Alice -> Me 0.7 BTC
Bob -> Me 0.1 BTC
UTXO for the coffee
Transaction : shop.
Input: Output:
0.5 BTC to the coffee shop.
0.7 BTC from Alice
0.2 BTC back to me.
Transaction and UTXOs

Arjun-> Me 0.4 BTC


Raj -> Me 0.3 BTC
Bob -> Me 0.1 BTC
UTXOs
Me -> Me 0.2 BTC

Updated UTXOs Get a Coffee


Transaction and UTXOs
Arjun-> Me 0.4 BTC
Raj -> Me 0.3 BTC
UTXOs Let say I buy Noodles for 1.4 BTC.
Alice -> Me 0.7 BTC
Bob -> Me 0.1 BTC

Transaction : UTXO for the noodle shop.

Input: Output:
Arjun-> Me 0.4 BTC
Raj -> Me 0.3 BTC 1.4 BTC to the noodles shop.
Alice -> Me 0.7 BTC
Transaction and UTXOs

Bob -> Me 0.1 BTC UTXOs

Get Noodles
Updated UTXOs
Transaction
Fee
Transaction Fee
Arjun-> Me 0.4 BTC
Raj -> Me 0.3 BTC
UTXOs Let say I buy coffee for 0.5 BTC.
Alice -> Me 0.7 BTC
Bob -> Me 0.3 BTC

Transaction :
Input: Output:
0.5 BTC to the coffee shop.

0.7 BTC from Alice


0.2 BTC back to me.
Transaction Fee
Arjun-> Me 0.4 BTC
Raj -> Me 0.3 BTC
UTXOs Let say I buy coffee for 0.5 BTC.
Alice -> Me 0.7 BTC
Bob -> Me 0.3 BTC

Transaction :
Input: Output:
0.5 BTC to the coffee shop.

0.7 BTC from Alice


0.1 BTC back to me.
Transaction Fee
Arjun-> Me 0.4 BTC
Raj -> Me 0.3 BTC
UTXOs Let say I buy coffee for 0.5 BTC.
Alice -> Me 0.7 BTC
Bob -> Me 0.3 BTC

Transaction :
Input: Output:
0.5 BTC to the coffee shop.

0.7 BTC from Alice


0.1 BTC back to me. Fees: 0.1 BTC
Transaction Fee
Arjun-> Me 0.4 BTC
Raj -> Me 0.3 BTC
UTXOs Let say I buy coffee for 0.5 BTC.
Alice -> Me 0.7 BTC
Bob -> Me 0.1 BTC
UTXO for the coffee
Transaction : shop.
Input: Output: UTXO for the miner.
0.5 BTC to the coffee shop.
0.7 BTC from Alice
0.1 BTC back to me.
Fees: 0.1 BTC
Transaction Fee

Arjun-> Me 0.4 BTC


Raj -> Me 0.3 BTC
Bob -> Me 0.1 BTC
UTXOs
Me -> Me 0.1 BTC
Get Coffee
Updated UTXOs
Cryptocurrency
Wallet
Cryptocurrency Wallets
• A wallet (device or program) stores cryptocurrency keys and allows one to access
coins
• Public key is used as a wallet address and for receiving the coins
• Private key is needed to sign transactions and for sending the coins
• Just like Blockchain a wallet is also distributed
• Not storing the balance, computes the balance from the transactions UTXOs
• Wallet note down those transactions that are coming to the wallet, add the
transactions' amounts and show it as a balance
Cryptocurrency Wallets
Block 4

Block 3

Me->coffee shop 0.5 BTC


Block 2 Me->Me 0.2 BTC

Arjun-> Me 0.4 BTC


Raj -> Me 0.3 BTC
Block 1 Alice -> Me 0.7 BTC
Bob -> Me 0.1 BTC
Cryptocurrency Wallets
Block 4

Block 3

Me->coffee shop 0.5 BTC


Me->Me 0.2 BTC
Block 2
Arjun-> Me 0.4 BTC
Raj -> Me 0.3 BTC
Alice -> Me 0.7 BTC
Block 1 Bob -> Me 0.1 BTC
Cryptocurrency Wallets
Block 4 Me->Noodle shop 1.4 BTC

Arjun-> Me 0.4 BTC


Raj -> Me 0.3 BTC
Block 3 Alice -> Me 0.7 BTC
Bob -> Me 0.1 BTC

Me->coffee shop 0.5 BTC


Block 2 Me->Me 0.2 BTC

Arjun-> Me 0.4 BTC


Raj -> Me 0.3 BTC
Block 1 Alice -> Me 0.7 BTC
Bob -> Me 0.1 BTC
Cryptocurrency Wallets
Me->Noodle shop 1.4 BTC
Block 4

Arjun-> Me 0.4 BTC


Raj -> Me 0.3 BTC
Block 3 Alice -> Me 0.7 BTC
Bob -> Me 0.1 BTC

Me->coffee shop 0.5 BTC


Block 2 Me->Me 0.2 BTC

Arjun-> Me 0.4 BTC


Raj -> Me 0.3 BTC
Block 1 Alice -> Me 0.7 BTC
Bob -> Me 0.1 BTC
Cryptocurrency Wallets
Me->Noodle shop 1.4 BTC
Block 4

Arjun-> Me 0.4 BTC


Raj -> Me 0.3 BTC
Block 3 Alice -> Me 0.7 BTC
Bob -> Me 0.1 BTC

Me->coffee shop 0.5 BTC


Block 2 Me->Me 0.2 BTC

Arjun-> Me 0.4 BTC


Raj -> Me 0.3 BTC
Block 1 Alice -> Me 0.7 BTC
Bob -> Me 0.1 BTC
Cryptocurrency Wallets
Me->Noodle shop 1.4 BTC
Block 4

Arjun-> Me 0.4 BTC


Raj -> Me 0.3 BTC
Block 3 Alice -> Me 0.7 BTC
Bob -> Me 0.1 BTC

Me->coffee shop 0.5 BTC


Block 2 Me->Me 0.2 BTC

Arjun-> Me 0.4 BTC


Raj -> Me 0.3 BTC
Block 1 Alice -> Me 0.7 BTC
Bob -> Me 0.1 BTC
Cryptocurrency Wallets
Me->Noodle shop 1.4 BTC
Block 4

Arjun-> Me 0.4 BTC


Raj -> Me 0.3 BTC
Block 3 Alice -> Me 0.7 BTC
Bob -> Me 0.1 BTC

Me->coffee shop 0.5 BTC


Block 2 Me->Me 0.2 BTC

Arjun-> Me 0.4 BTC


Raj -> Me 0.3 BTC
Block 1 Alice -> Me 0.7 BTC
Bob -> Me 0.1 BTC
Cryptocurrency Wallets
Me->Noodle shop 1.4 BTC
Block 4

Arjun-> Me 0.4 BTC


Raj -> Me 0.3 BTC
Block 3 Alice -> Me 0.7 BTC
Bob -> Me 0.1 BTC

Me->coffee shop 0.5 BTC


Block 2 Me->Me 0.2 BTC

Arjun-> Me 0.4 BTC


Raj -> Me 0.3 BTC
Block 1 Alice -> Me 0.7 BTC
Bob -> Me 0.1 BTC
Cryptocurrency Wallets
Me->Noodle shop 1.4 BTC
Block 4

Arjun-> Me 0.4 BTC


Raj -> Me 0.3 BTC
Block 3 Alice -> Me 0.7 BTC
Bob -> Me 0.1 BTC

Me->coffee shop 0.5 BTC 1.1 BTC


Block 2 Me->Me 0.2 BTC

Arjun-> Me 0.4 BTC


Raj -> Me 0.3 BTC
Block 1 Alice -> Me 0.7 BTC
Bob -> Me 0.1 BTC
Cryptocurrency Wallets
Me->Noodle shop 1.4 BTC
Block 4

Arjun-> Me 0.4 BTC


Raj -> Me 0.3 BTC
Block 3 Alice -> Me 0.7 BTC
Bob -> Me 0.1 BTC

Me->coffee shop 0.5 BTC


Block 2 Me->Me 0.2 BTC

Arjun-> Me 0.4 BTC


Raj -> Me 0.3 BTC
Block 1 Alice -> Me 0.7 BTC
Bob -> Me 0.1 BTC
Private and
Public Key
Cryptocurrency Wallets
Me->Noodle shop 1.4 BTC
Block 4

Arjun-> Me 0.4 BTC


Raj -> Me 0.3 BTC
Block 3 Alice -> Me 0.7 BTC
Bob -> Me 0.1 BTC

Me->coffee shop 0.5 BTC


Block 2 Me->Me 0.2 BTC

Arjun-> Me 0.4 BTC


Raj -> Me 0.3 BTC
Block 1 Alice -> Me 0.7 BTC
Bob -> Me 0.1 BTC
Private and Public Key
• How to check whether the transaction is valid or not, as there is no central authority
• It seems one can write anything in a transaction, so If a hacker adds a fraudulent
transaction the transaction will be added to the block. How to check?
• The protocol stops fraudulent transactions using a wallet, and private and public keys
• A wallet is created (software or hardware) and will be used for transactions
• To make a transaction, a signature is created using a private key and a message
• Verification is done using a message, a signature, and a public key
Demonstration of Private and public keys/ Signatures
https://tools.superdatascience.com/blockchain/public-private-keys/keys
Private and Public Key
Private Key Public Key

Message
Verification
Function

Signature
Yes/No
Public Key vs
Bitcoin Address
Public Key vs. Bitcoin Address
• Public key and Bitcoin address are not the same
• A transaction is made to others using public, whereas a bitcoin address is used
for getting transactions
• To handle a Bitcoin the Bitcoin addresses are used to make it more secure
• An extra layer of security is added to the bitcoin address.
• If a hacker tries to get a private key, he must find out a public key from a Bitcoin
address, and then using the public key he will try for the private key.
Private and Public Key
Private Key Public Key

Message
Verification
Function

Signature
Yes/No
Private and Public Key
Bitcoin
Private Key Public Key
Address

Message
Verification
Function

Signature
Yes/No
Segregated
Witness
Segregated Witness
• The current block size of Bitcoin is 1 MB
• Increasing the block size will decrease the transaction time
• A big block needs more bandwidth, thus, will slow down the blockchain system
• 60-65% of the transaction space is given to signature and public key
• Now as the transactions are increased, 1 MB block size is no more sufficient
• The blockchain community separates the signature and public key from the
transaction and will be sent separately.
• Now, 1 MB block can store more transactions, as transactions take less space
Segregated Witness
Block No.-1

xxx
6f1d6254d28efe436a89e74d51556
Transactions:
85fec8c76a43e8122e0d15fab5dcc4 From: X
1 MB
6f1d6254d28efe436a89e74d51556 To: Y
6f1d6254d28efe436a89e74d51556
Amount: 0.3 BTC

Prev Hash:000000000 Signature: <…>


60-65%
Hash:247AD8C42 Public Key:<…>
ScriptSig
Hierarchically Deterministic
(HD) Wallet
Hierarchically Deterministic Wallet
• If a person does transactions from a specific address i.e., Payment done to or
from a specific Bitcoin address multiple time
• This way a pattern is developed, hackers can guess big setups, etc.
• The hackers can track down a person/ company using these patterns.
• Leads to privacy issues, So HD wallets were introduced.
Hierarchically Deterministic Wallet
• A master private key is used to generate different private keys
• Private keys are used to generate public keys, which further used to generate different addresses
• Completely different private keys are generated due to the avalanche effect
• Thus, transactions are done using different addresses
• How Hierarchically Deterministic?
• CEO has a master key, and the subordinates are given the generated private keys.
• CEO can trace all transactions done from generated public keys.
Private and Public Key
Bitcoin
Private Key Public Key
Address

Message
Verification
Function

Signature
Yes/No
Hierarchically Deterministic (HD) Wallets
Master Private
Private Key 1 Public Key 1 Address 1
Key
Hierarchically Deterministic (HD) Wallets
Master Private
Private Key 1 Public Key 1 Address 1
Key

+1
Private Key 2 Public Key 2 Address 2
Hierarchically Deterministic (HD) Wallets
Master Private
Private Key 1 Public Key 1 Address 1
Key

+1
Private Key 2 Public Key 2 Address 2

+2
Private Key 3 Public Key 3 Address 3
Hierarchically Deterministic (HD) Wallets
Master Private
Private Key 1 Public Key 1 Address 1
Key

+1
Private Key 2 Public Key 2 Address 2

+2
Private Key 3 Public Key 3 Address 3

+3
Private Key 4 Public Key 4 Address 4
Hierarchically Deterministic (HD) Wallets
Master Private
Private Key 1 Public Key 1 Address 1
Key

+1
Private Key 2 Public Key 2 Address 2

+2
Private Key 3 Public Key 3 Address 3

+3
Private Key 4 Public Key 4 Address 4

You might also like