Blockchain, bitcoin
-
Upload
sathish-vj -
Category
Technology
-
view
504 -
download
0
Transcript of Blockchain, bitcoin
Agenda
Definitions Bitcoin Payment Why Bitcoin?
Networks & Data Crypto Hashes Pvt/Pub Key Crypto
Consensus Mining Regulation Trading
2
Blockchain
A blockchain is a distributed database that maintains a continuously growing list of records called blocks secured from
tampering and revision. Each block contains a timestamp and a link to a
previous block.
4
Bitcoin
A distributed, decentralized, digital cryptocurrency that relies
on Blockchain technology.
5
Ethereum
A blockchain-based distributed computing platform, featuring smart contract functionality. It provides a decentralized virtual machine that
can execute peer-to-peer contracts using a cryptocurrency called ether.
6
Alice’s wallet ‘signs’ the transaction.
Txn sent out on Bitcoin Network
1F1t...xaN 1a1b...79F
Bob
10
‘Miners’ collect transactions.
Cryptographically validates them.
Transactions grouped into block.
Adds ‘fees’ for txn.
New BTC reward for mining block.
Miner
11
New block sent out on network.
Other nodes validate.
Connects new block to previous block.
Thus forming a chain of blocks.
12
Anticipated Questions
● Why use Blockchain?● Can Alice send a copy of the same coins to Chanakya?
○ The double-spend problem.● What if two miners create a block at the same time.
○ Who wins?● What if the miners cheat?
○ Byzantine Generals problem
14
Current Issues● Trust is centralized
○ Centralized ledger
● Power and abuse at the center● Deniability with alteration● Long Time for Transactions● Hefty charges● Non-resilient● Cost of maintaining software● Security breaches on ‘one truth’
16
With Blockchain● Trust without a central figure
○ Decentralized ledger
○ Transact with anybody on the network
○ Confirms: spender has the money
○ Confirms: Not a fraudulent transaction
● Immutability● Resilient
○ Works with intermittent connectivity
● Fast● Cheap● Micro-transactions
17
Bitcoin: A Peer-to-Peer Electronic Cash System
“We propose a solution to the double-spending problem using a peer-to-peer network. The network timestamps transactions by hashing them into an ongoing chain of hash-based proof-of-work, forming a record that cannot be changed without redoing the proof-of-work. The longest chain not only serves as proof of the sequence of events witnessed, but proof that it came from the largest pool of CPU power... The network itself requires minimal structure.”
bitcoin.org/bitcoin.pdf - Satoshi Nakomoto 18
‘On the Shoulders of Giants’
● Distributed Systems● Peer-Peer Networks● Hashing Functions● Cryptography
The astonishing innovation was in bringing it all
together in a way that it works.
19
BitTorrent Protocol
● Distributed● Resilient● Owned by no one person● BitTorrent client required● Once started, lives on its
own● Uses computing
resources
22
A Database & A Linked List
A database is an organized collection of data.
1 2 3
A Singly Linked List can be traversed in one direction.
23
Analogy: Hop Route
1.2.3.4
1.2.3.41.2.3.5
1.2.3.41.2.3.51.2.3.6 1.2.3.4
1.2.3.51.2.3.61.2.3.7
1.2.3.41.2.3.51.2.3.61.2.3.71.2.3.8
24
Hash Function● Used to map data of arbitrary size to
data of fixed size● Used in data structures like
hashtable/dictionary/map
27
Cryptographic Hash● Fixed length output● Must be fast● Pre-image resistance: it should be
computationally hard to reverse a hash function
● Second Pre-Image Resistance: given an input and its hash, it should be hard to find a different input with the same hash
● Collision Resistance: it should be hard to find two different inputs of any length that result in the same hash.
blockchain
the competition creating new blocks is known as mining
a blockchain consists of blocks that hold batches of valid transactions. each block includes the hash of the prior block in the blockchain, linking the two. the linked blocks form a chain. variants of this format were used previously, for example in git, and it is not by itself sufficient to qualify as a blockchain.
CMPDLDIBJO
UIF DPNQFUJUJPO DSFBUJOH OFX CMPDLT JT LOPXO BT NJOJOH
B CMPDLDIBJO DPOTJTUT PG CMPDLT UIBU IPME CBUDIFT PG WBMJE USBOTBDUJPOT. FBDI CMPDL JODMVEFT UIF IBTI PG UIF QSJPS CMPDL JO UIF CMPDLDIBJO, MJOLJOH UIF UXP. UIF MJOLFE CMPDLT GPSN B DIBJO. WBSJBOUT PG UIJT GPSNBU XFSF VTFE QSFWJPVTMZ, GPS FYBNQMF JO HJU, BOE JU JT OPU CZ JUTFMG TVGGJDJFOU UP RVBMJGZ BT B CMPDLDIBJO.
9184ae16
8e347c28
a3a928ee
source Simple Cipher Crypto Hash
28
blockchaim CMPDLDIBJN a598fc4b9
Block with TransactionsField Purpose Updated When ... Bytes Example
version Block Version No. s/w upgrade 4 02000000
Prev Block # 256bit # of prev block header A new block arrives 32 c12959edab
Merkle Root # 256bit # of all Txns in Block A Txn is accepted 32 d3f4bac86b2
Timestamp Current Timestamp Block Creation 4 358a2903
Bits Current Difficulty Target Difficulty is adjusted 4 f3591e20
Nonce 32bit number Proof of Work Nonce 4 537629132
Txn Count Count of Txns Each Block 63
Coinbase Txn, User Txn 1, User Txn 2, User Txn ...
# Entire Block 29
Block 23
Block 24Block 25
Merkle Tree
● Each transaction is hashed● Hash values are combined
and hashed● Final hash added to block
header● If any transaction is tampered
with, final header hash will not match
Txn α Txn β Txn γ Txn δ
#α #β #γ #δ
#αβ #γδ
Prev Block 25 #αβγδ Timestamp
+ Nonce
Current Block 26
30
Consensus?
● No central authority to verify● Then who verifies?● Everybody?
○ Maybe, but how many nodes are there?● A few specific nodes?
○ Maybe, but will they abuse power?● Sybil attack?
○ Reputation system subverted by forged identities.
36
Byzantine Generals Problem
● Generals of army surround enemy city● Action in unison required to win● Some generals may be traitors
○ Prevents loyal generals from reaching
agreement
○ Sabotages the collective action with
misinformation
○ Fail to act
● Distributed systems must cope with failure/sabotage of its constituents
37
Proof of Work
● Effort is Investment● In exams, directly giving final
answer could be fraudulent○ must give long proof
● Uses computer cycle time to validate transactions
● Costly - hardware, energy wastage
38
Mining Process● Free software. Run it. Get Bitcoins!!
○ Not really.
● #(Rand No. + Prev Block#) < 0x00012● Because # is unpredictable, only way
to generate fitting value is to keep trying in a loop for Rand No. (nonce)
● Consumes huge amount of processing power - hardware + electricity
41
Mining ‘Difficulty’ Value● Measure of difficulty in finding hash
value below target value (256 bit number)
● Mining Difficulty α 1/Target Value
● Average mining time is about 10min per block
43
Resolving Multiple Chains● Mine on ‘longest’ chain
○ I.e. add block to the longest valid chain
● Other chains have to kept for a while● Significant resources/time goes into each block● Tampering with transactions will require
rebuilding many blocks again before others add new block
○ Hence immutable
● Each added block is a ‘confirmation’ that Txn is accepted
● Wait multiple confirmations if Txn is large
44
Mining Payout● Every 210k blocks BTC
reward halves● Started with 50 BTC/block● Today: 12.5 BTC/block● Fees for txns adds up with
more txns
fees
btc reward45
RBI Report
● December 2013: RBI warns investors about volatility● Not specifically regulated as of now
○ But they are keeping an eye on it○ Could/Will be regulated eventually
● Have to follow contract laws, pay income or capital gains taxes, only do legal activities as per other laws
47
BTC/USD
jul 19, 2010: 0.07$ -> oct 13, 2016: 635.02$ = 907,171% appreciation
1 Lakh -> 90.71 Crores49
Costly Pizzas
In 2010, a Florida programmer paid 10,000 BTC for 2 Pizzas
Oct 2016: $ 6,297,500 | ₹ 42,51,66,196.50
50
Blockchain is a storage technology.
(with multiple benefits: tamper-proof, forward growing, resilient, etc.)
Bitcoin is one application of it in the area of currencies. It can also be used in insurance, banking, retail, logistics, owner identification, authenticity validation,
medical records, etc.
There will be platforms (like Ethereum) that you can use to build your own apps.
Unmasking the Blockchain
53
References & Courtesy● http://blockstrap.com/en/a-complete-beginners-guide-to-blockchain-technology/● Types of Blockchains - https://blockchainhub.net/blockchains-in-general/● http://www.economist.com/news/briefing/21677228-technology-behind-bitcoin-lets-people-who-do-not-know-or-tr
ust-each-other-build-dependable ● http://ethereum.stackexchange.com/questions/118/whats-the-difference-between-proof-of-stake-and-proof-of-work ● https://www.igvita.com/2014/05/05/minimum-viable-block-chain/ ● http://www.economist.com/news/briefing/21677228-technology-behind-bitcoin-lets-people-who-do-not-know-or-tr
ust-each-other-build-dependable ● http://www.flaticon.com/ - for many of the free icons
55
References & Courtesy● http://ethereum.stackexchange.com/questions/268/ethereum-block-architecture● http://ethereum.stackexchange.com/questions/700/what-are-the-differences-between-bitcoin-blockchain-and-ether
eum-blockchain?noredirect=1&lq=1
● http://ethereum.stackexchange.com/questions/4351/are-there-any-drawbacks-of-being-turing-complete?noredirect=1&lq=1
● http://ethereum.stackexchange.com/questions/2286/what-diagrams-exist-to-illustrate-the-ethereum-blockchain-creation-process?noredirect=1&lq=1
● http://ethereum.stackexchange.com/questions/6400/what-is-the-exact-data-structure-of-each-block?noredirect=1&lq=1
● http://ethereum.stackexchange.com/questions/1294/what-is-actually-removed-during-a-contract-suicide-and-why-doesnt-this-cause-t?noredirect=1&lq=1
● https://ethereum.stackexchange.com/questions/315/why-are-suicides-used-in-contract-programming● http://blockstrap.com/en/a-complete-beginners-guide-to-blockchain-technology/
56