Lecture 7 - Block
Lecture 7 - Block
Prepared by:
Dr. Hossam Mahmoud Moftah
Faculty of Computers and Artificial Intelligence
Beni-Suef University
Digital Currency – LedgerAlice: 20
Alice: 20 Bob: 11
Bob: 11 Charlie: 5
Charlie: 5 David: 34
David: 34
Bob
Alice: 20
Bob: 11
Alice Charlie: 5
Alice: 20 David: 34
"I am giving 15 Bob: 11
cryptocoins Charlie: 5
David: 34
to Charlie"
Charlie
David
Bob
Alice: 5
Bob: 11
Alice Charlie: 20
Alice: 5 David: 34
Bob: 11
Charlie: 20
David: 34
Charlie
David
Bob
Invalid
transaction!
Alice
"I am giving 8
cryptocoins Invalid
to David" transaction!
Charlie
David
VALID!
Alice
Invalid
transaction!
Alice 3
David
Source: Prof. Tom Austin, San José State University Alice 4
How can we defend against Sybils?
• Know your clients, OR
• Force them to commit some resource
–Proof-of-work
–Proof-of-stake
–Proof-of-storage
–Others?
https://www.businessinsider.com/
https://www.coinbase.com/
Proof of Work vs. Proof of Stake
• Bitcoin, a known cryptocurrency, uses PoW.
• Initially, Ethereum used a competitive proof-of-work
validation process similar to that of Bitcoin. After
several years of development, Ethereum finally
switched to proof-of-stake in 2022, which uses much
less processing power and energy.
https://www.coinbase.com/
https://www.investopedia.com/
Nakamoto Consensus
• Solving PoW puzzle determines "leader"
– i.e., who gets to make a block.
• More profitable to mine than to cheat
https://www.binance.com/
Hashcash in Bitcoin
• Target: number of (binary) leading zeroes required for
hash value
• Nonce: random "number used once"
• A hash rate is the rate at which a blockchain network
like Bitcoin generates hashes, or hexadecimal numbers
that are the result of sending transactional data through
hashing algorithms.
https://www.coinwarz.com/
The current Bitcoin hashrate
https://www.coinwarz.com/
Bitcoin difficulty
• Bitcoin difficulty is a measure of how many hashes (statistically)
must be generated to find a valid solution to solve the next
Bitcoin block and earn the mining reward.
• Bitcoin mining difficulty determines how difficult it will be to
mine the next block and this is why it is referred to as the
difficulty of Bitcoin mining.
https://www.coinwarz.com/
Bitcoin difficulty
https://www.coinwarz.com/
Block height
• The block height of a particular block is defined as the number of
blocks preceding it in the blockchain.
• The very first block on a blockchain is called the genesis block.
It has a block height of zero, as no blocks precede it in the
blockchain. The total height of the blockchain is taken to be the
height of the most recent block, or the highest block, in the
chain.
https://www.investopedia.com/
Proof-of-Work Mining
• Process:
– "Miners" choose a nonce
– If hash(block) meets target, share block
– Otherwise, continue searching
• N = number of leading zeroes required for target
• Work to find valid proof:
– 2N hashes
• Work to verify proof:
– 1 hash
00000000000000000004cf5d4bcee3bec
16c40cc823fb1aeb75c5d9384797c82
utils.hash(s+proof)
U – Unspent
TX – Transaction
O – Output