Bitcoin Tech
Talk
Zehady Abdullah Khan (Andy)
Graduate Assistant,
Computer Science Department,
Purdue University.
Bitcoin
2
Bitcoin
Digital
Currency
Public Key
Cryptograp
hy
Internet
Security
Cryptography
Financial
Transaction
E-Cash
Complex Network
Intro
What is Bitcoin?
• A digital currency
o Unit: BTC (1 BTC = 110 USD).
o Buy or sell goods.
o Exchange with Yen, USD etc.
• Differences
o Decentralized and Distributed.
o Very low fee.
o Very Fast Transaction.
o Non-reversible: Requires less trust .
o Pseudo-anonymous: Address <=> Address.
o Value increase (Only 21,000,000 Bitcoin)
• How do you get and use bitcoin?
o Bitcoin exchanges to buy and sell bitcoin.
o Bitcoin wallets to use bitcoin to purchase or send bitcoin.
3
Bitcoin Network protocols
• Steps to run the bitcoin network.
o New transactions are broadcast to all nodes.
o Each node collects new transactions into a block.
o Each node works to find a difficult proof-of-work for its
block. These nodes are called Bitcoin Miners.
o When a node finds a proof-of-work, it broadcasts the
block to all nodes.
o Other nodes accept the block only if all transactions in
it are valid and not already spent.
o Nodes express their acceptance of the block by
introducing the next block, using the hash of the
accepted block.
• Bitcoin uses SHA256 cryptographic hash function.
4
How Bitcoin looks like?
• Not a physical object like gold or paper-money.
• A chain of digital signatures in a block-chain.
o Block header
o Transactions
• https://www.youtube.com/watch?v=3ujUIz9hQ7c
5
Block: Human Readable format
6
/blockexplorer.com/block/00000000000000001588d80f3cb1d593cb198f485aef33ca926b58a62b
https://blockchain.info/tree/15296863
Validation of a Block
• Condition for a hash to validate a block
o Hash of block header Target
• Block Reward(B)
o 50(25) bitcoin per valid block
o Halves every 4 year
• Target(T) is a 32 byte(256 bit) number
o Current target(Tcur): “Bits” field of the block header in compact format.
o Maximum target(Tmax): 0x1d00ffff =
0x00000000FFFF0000000000000000000000000000000000000000000000000000
• Which hash will validate the block ?
• A given hash validating a block is a Random Event
o Independent of the validity of any other calculated hash
7
£
Nonce
Time
Stamp
Change
A completely
different hash of the
block header
Block Header
8
Change of Nonce Resulting Hash
3590836561 000000000000004b6cca89a20a6287dd423bbec
48d901755dfe888bc9fa948d4
0972783904 00000000000000497fc8294f1f1ba9c24c5edf016
e2e066772f7794e33b372cf
(3590836561)d=(100001011100010011100010110100101010)2
(0972783904)d=(000000111001111110111000000100100000)2
There are 2^32 different Nonces to try.
Block Difficulty
• Difficulty(D): A measure of how difficult it is to find a new block
compared to the easiest.
• Maximum Difficulty is set when = 1 , Tmax is defined as 0x1d00ffff
• Exp: If = 0x1b0404cb,then
o Desired rate of finding a block: 1 block / 10 minutes.
o Difficulty is adjusted after every 6*24 * 14 = 2016 blocks to maintain
the rate.
9
Tcur
D =
0x1d00 ffff
0x1b0404cb
= ? =16307.669773817162
D =
Tmax
Tcur
if Tcur = 0 , D = infinity
Tcur
Network Hash Rate Calculation
• To find a block, the hash must be less than the target. The hash is
effectively a random number between 0 and 2^256 – 1.
• 0x00000000FFFF0000000000000000000000000000000000000000000000000000
The offset for difficulty 1 is (2^16-1) * 2^208
and for difficulty D is ((2^16-1)* 2^208) / D
• The expected number of hashes we need to calculate to find a
block with difficulty D is
D * 2^256 / ((2^16-1) * 2^208)=D * 2^48 / (2^16 – 1) = D*2^32
• Difficulty is set such that previous 2016 blocks would have been
found at the rate of 1 every 10 minutes. So, the network hash rate,
H = D * 2^48/(2^16-1)/(60* 10) = D*2^32/600
10
208 bits16bits
Tmax
Difficulty Graph
Network Hash Rate
Graph
Bitcoin Mining War
• https://en.bitcoin.it/wiki/Mining_hardware_comparison
• https://bitcoinwisdom.com/bitcoin/calculator
Bitcoin's Development
Visualized
• https://www.youtube.com/watch?v=cVGEbtIBxIE

Bitcoin tech talk @Purdue Bitcoin Club

  • 1.
    Bitcoin Tech Talk Zehady AbdullahKhan (Andy) Graduate Assistant, Computer Science Department, Purdue University.
  • 2.
  • 3.
    What is Bitcoin? •A digital currency o Unit: BTC (1 BTC = 110 USD). o Buy or sell goods. o Exchange with Yen, USD etc. • Differences o Decentralized and Distributed. o Very low fee. o Very Fast Transaction. o Non-reversible: Requires less trust . o Pseudo-anonymous: Address <=> Address. o Value increase (Only 21,000,000 Bitcoin) • How do you get and use bitcoin? o Bitcoin exchanges to buy and sell bitcoin. o Bitcoin wallets to use bitcoin to purchase or send bitcoin. 3
  • 4.
    Bitcoin Network protocols •Steps to run the bitcoin network. o New transactions are broadcast to all nodes. o Each node collects new transactions into a block. o Each node works to find a difficult proof-of-work for its block. These nodes are called Bitcoin Miners. o When a node finds a proof-of-work, it broadcasts the block to all nodes. o Other nodes accept the block only if all transactions in it are valid and not already spent. o Nodes express their acceptance of the block by introducing the next block, using the hash of the accepted block. • Bitcoin uses SHA256 cryptographic hash function. 4
  • 5.
    How Bitcoin lookslike? • Not a physical object like gold or paper-money. • A chain of digital signatures in a block-chain. o Block header o Transactions • https://www.youtube.com/watch?v=3ujUIz9hQ7c 5
  • 6.
    Block: Human Readableformat 6 /blockexplorer.com/block/00000000000000001588d80f3cb1d593cb198f485aef33ca926b58a62b https://blockchain.info/tree/15296863
  • 7.
    Validation of aBlock • Condition for a hash to validate a block o Hash of block header Target • Block Reward(B) o 50(25) bitcoin per valid block o Halves every 4 year • Target(T) is a 32 byte(256 bit) number o Current target(Tcur): “Bits” field of the block header in compact format. o Maximum target(Tmax): 0x1d00ffff = 0x00000000FFFF0000000000000000000000000000000000000000000000000000 • Which hash will validate the block ? • A given hash validating a block is a Random Event o Independent of the validity of any other calculated hash 7 £ Nonce Time Stamp Change A completely different hash of the block header
  • 8.
    Block Header 8 Change ofNonce Resulting Hash 3590836561 000000000000004b6cca89a20a6287dd423bbec 48d901755dfe888bc9fa948d4 0972783904 00000000000000497fc8294f1f1ba9c24c5edf016 e2e066772f7794e33b372cf (3590836561)d=(100001011100010011100010110100101010)2 (0972783904)d=(000000111001111110111000000100100000)2 There are 2^32 different Nonces to try.
  • 9.
    Block Difficulty • Difficulty(D):A measure of how difficult it is to find a new block compared to the easiest. • Maximum Difficulty is set when = 1 , Tmax is defined as 0x1d00ffff • Exp: If = 0x1b0404cb,then o Desired rate of finding a block: 1 block / 10 minutes. o Difficulty is adjusted after every 6*24 * 14 = 2016 blocks to maintain the rate. 9 Tcur D = 0x1d00 ffff 0x1b0404cb = ? =16307.669773817162 D = Tmax Tcur if Tcur = 0 , D = infinity Tcur
  • 10.
    Network Hash RateCalculation • To find a block, the hash must be less than the target. The hash is effectively a random number between 0 and 2^256 – 1. • 0x00000000FFFF0000000000000000000000000000000000000000000000000000 The offset for difficulty 1 is (2^16-1) * 2^208 and for difficulty D is ((2^16-1)* 2^208) / D • The expected number of hashes we need to calculate to find a block with difficulty D is D * 2^256 / ((2^16-1) * 2^208)=D * 2^48 / (2^16 – 1) = D*2^32 • Difficulty is set such that previous 2016 blocks would have been found at the rate of 1 every 10 minutes. So, the network hash rate, H = D * 2^48/(2^16-1)/(60* 10) = D*2^32/600 10 208 bits16bits Tmax
  • 11.
  • 12.
  • 13.
    Bitcoin Mining War •https://en.bitcoin.it/wiki/Mining_hardware_comparison • https://bitcoinwisdom.com/bitcoin/calculator
  • 14.

Editor's Notes

  • #10 6 blocks per hour 6 * 24 * 14= 2016 0x0404cb * 2**(8*(0x1b - 3)) = 0x00000000000404CB000000000000000000000000000000000000000000000000