bitcoin (cryptocurrency)

65
Cryptocurrency Bitcoin Tsaschikher Nyamgerel 2015

Upload: tsasaa-tsas

Post on 11-Aug-2015

92 views

Category:

Technology


6 download

TRANSCRIPT

Page 1: Bitcoin (Cryptocurrency)

Cryptocurrency Bitcoin

Tsaschikher Nyamgerel2015

Page 2: Bitcoin (Cryptocurrency)

Overview

• What is cryptocurrency? (Introduction)• How it works• How to use it• Transaction• Security (Block Chain, Proof of work)• Statistics• Cryptocurrency comparisons• It’s market and its future• BitCoin vs LiteCoin

Page 3: Bitcoin (Cryptocurrency)

What is Cryptocurrency?• Cryptocurrency is electronic money or virtual currency. (Online cash, digital

cur…)

• Bitcoin is one of the biggest (successful) representation of the Cryptocurrency

• Bitcoin has no central authority (Decentralized) (P2P like torrent)– No government involved (no bank)

• BTC can be created offline (email address)– Anyone can create (without any permission)– 1461501637330902918203684832716283019655932542976 (2^160)

• 21 Million Bitcoins will be created, and or mined• Until year 2140.

– Limited or scarce like gold (Deflationary and protected from inflation)

Page 4: Bitcoin (Cryptocurrency)

Who and When?

• Bitcoin is proposed in 2008 by “Satoshi Nakamoto”

• Released Paper is found: bitcoin.org/bitcoin.pdf

• First appeared and operated on 1/3/2009

• Completely open source, so anyone can develop his own cryptocurrency (BitCoin, LiteCoin, AltCoin…)

• Released open source: github.com/Bitcoin/Bitcoin

Page 5: Bitcoin (Cryptocurrency)

Who and When?

It’s name also been suggested that• Samsung• Toshiba• Nakamichi• MotorolaAre the founders. (But there’s no confirmation)

Satoshi Nakamoto

Page 6: Bitcoin (Cryptocurrency)

How to Use Bitcoin?

• Generate BTC address

• Connect to BTC network

• Update or download transactional block chain

• Send and receive BTC– Offline clients:

• Install electrum, armory and hive..

– Online clients:• Register coinbase.com, blockchain.info/wallet..

Page 7: Bitcoin (Cryptocurrency)

What is Advantage?• Transactions transact directly with each other without using third party (no Bank)

• Almost no processing fees

• No bank or government control– Which means no identity revelation and no freezing account

• Transactions are computationally impractical to reverse (to protect sellers from fraud)

• Implement escrow mechanisms (to protect buyers)

• Very difficult and expensive to hack (Hacking 10 minutes cost around half billion USD)

Page 8: Bitcoin (Cryptocurrency)

How Does Transaction Work?• Use digital signature for transaction (identity like real signature)

• Binds the sender’s identity to the transaction

• Detail of transaction is broadcasted to all the nodes of the p2p network

• Receiver can get assurance from network about transaction (balance match, not spent..) based on cryptographic proof before it gets verified or even payed– Owner has money in his account and didn’t spend it

• Distributed network also give assurance for double spent

Page 9: Bitcoin (Cryptocurrency)

Identity (Digital Signature)

• Bitcoin uses the digital signature to prove that signature owner is the “account owner”– In other words, owner owns private key

• “Private Key” is used to create the signature

• “Public Key” is used to verify the signature– This allows anybody can verify digital signature if

they have its public key (account address)

Page 10: Bitcoin (Cryptocurrency)

Private Key• Private key is a single unsigned 256 bit integer (32 bytes)

– Usually picked at “random”• Needs to be secret (all the time)

– When you lose your private key, you’ll lose your all bitcoins in that account• Owner of the private key can spend corresponding account bitcoins

(funds)• The private key used to generate

– “Digital Signatures”• Signature is required to spend bitcoins (of the account)

– “Public Keys”• Public key is used to verify signatures and generate account address

Private key

Page 11: Bitcoin (Cryptocurrency)

Public Key• Elliptic curve multiplication function generate a public key from

private key (compressed 33 and uncompressed 65)• No need to be secret

– Used for verifying account owner• “Account address” is generated from public key

– Using a one-way cryptographic hash function• Used to verify the “Digital Signatures”

– Using this digital signature he can transact bitcoin (without revealing private key)

• Verifying digital signature, we can now that he has a private key (owner or not)

Public key

Page 12: Bitcoin (Cryptocurrency)

Account Address

• Bitcoin address is string of digits and characters and generated from public key– Using cryptographic hash (SHA256)

• Shared with anyone who wants to send you bitcoins

• User can have many addresses– 1461501637330902918203684832716283019655932542976 (possible bitcoin addresses)

Page 13: Bitcoin (Cryptocurrency)

Public Key and Address Generation

Public Key generation using Elliptic Curve Address generation

using Hash

Page 14: Bitcoin (Cryptocurrency)

Digital Signature• To send money (Transaction)

– User must prove that he is owner of the address• Which means he has the private key

– To do that user generate “digital signature” from• Transaction message• His private keySignature = f(private key, transaction message)

– Nodes in the network can verify using this signature that• He is the owner of the account and• He can spend money (from that account)

accept or reject = verify(transaction message, public key, signature)– BitCoin Digital Signature uses

• Elliptic Curve Digital Signature Algorithm (ECDSA) (en.wikipedia.org/wiki/Elliptic_Curve_Digital_Signature_Algorithm)

Transaction message is Hashed message so result will be constant.Signature = f(private key, Hash(M))

Page 15: Bitcoin (Cryptocurrency)

Advantage of Elliptic Curve

• Shorter keys are as strong as long key for RSA (IEEE paper)

• Low on CPU consumption. • Low on memory usage.

• RSA relies on the hardness of factorization (Studied for 2500 years)

• While Elliptic cure depends on discrete logarithm (25 years of research)

Page 16: Bitcoin (Cryptocurrency)

Transaction

• BitCoin is collective entries into a ledger

Page 17: Bitcoin (Cryptocurrency)

Transaction• Every transactions ever happened recorded on one global ledger

• To send money (Alice -> Bob)– Account has to have enough money

• To verify money in the account– We need to verify previous transactions

• That fund is also verified through links to previous transactions • All transactions are written on the global ledger

• Alice has 5 bitcoins– Means someone sent to Alice 5 bitcoins before – “Input” should be 5 BTC– “Output” can’t exceed 5 BTC

Page 18: Bitcoin (Cryptocurrency)

Transaction

• In fact, no records of account balances are kept

• Instead of balances, fund is verified through link to previous transactions

• Inputs should match the balance– To making sure that Alice can send 5 BTC

• Owning BTC means,– There are transactions that point to your account– And haven’t spent

Page 19: Bitcoin (Cryptocurrency)

Transaction

Now Alice can send 5 bitcoins to Bob

Page 20: Bitcoin (Cryptocurrency)

Transaction

Real Transaction exampleInput balance should match with output

Transactions are not encrypted so it is possible to browse and viewhttp://blockexplorer.com

ScriptSig contains:Signature + Public Key

Type: Address and PubKey

Page 21: Bitcoin (Cryptocurrency)

Transaction (Chain)

- Each transaction includes its previous transaction

Page 22: Bitcoin (Cryptocurrency)

Transaction

• When you install BitCoin wallet– It downloads every transactions– Checks each one’s validity all the way back to the

first transaction ever made– If you use bitcoin wallet with TOR network (which

hides IP address) you can use BTC without revealing anything but public key

Page 23: Bitcoin (Cryptocurrency)

Double Spending (Order or Timestamp)

• A double spend is an attack where the given set of coins is spent more than 1 transactions

• So, there is no guarantee that first transaction comes before second one– Because transactions are passed through the network node-by-

node

• We can’t trust timestamp also– Because anyone can lie about the time a transaction was created

• This opens up the potential fraud

Page 24: Bitcoin (Cryptocurrency)

Double Spending

• Double spend (Alice->Bob)1. Alice send bitcoin to Bob, don’t include fee2. Receive items 3. Before transaction confirms• Send the same bitcoin to herself include a fee

4. Miner (node) picks up the transaction with the fee and the one without fee will disappear (already spent)• This will happen only if there’s same block chain

happened (Rare)

Page 25: Bitcoin (Cryptocurrency)

Double Spending

• Solution:– BTC network records all bitcoin transfers in a

ledger (the block chain) – And ensuring for all transferred bitcoins that

they haven't been previously spent

– Block chain:• Is used to order transactions (TimeStamp)• While transaction chain keeps track of how

ownership changes

Page 26: Bitcoin (Cryptocurrency)

Block Chain

• Block chain (Public Ledger) is used to order transactions– Ordered and timestamped record of transactions

• One block of block chain:– Includes many transactions that considered to have

happened at the same time

• Transactions not yet in a block are called “unconfirmed” or unordered

Page 27: Bitcoin (Cryptocurrency)

Block Chain

• Node (also computer or miner)– Collects unconfirmed transactions into a block– Broadcasts the block to all nodes

Page 28: Bitcoin (Cryptocurrency)

Block Chain (Book and Pages)

• Node– Collects transactions that are happened at the same time– And puts them into a one block– Then link to the block chain

• If we think global ledger is the BOOK– One block is the page of that book– Multiple transactions listed in that page

• Miners (nodes) goal is– Take this page– Add to the global ledger BOOK

Page 29: Bitcoin (Cryptocurrency)

Block Chain

– To add block to the block chain• Every transactions inside the block paired and then

hashed together like a Merkle Tree

Page 30: Bitcoin (Cryptocurrency)

Block Chain

• Every transactions hashed together like a Merkle tree until it becomes one Merkle Root (Digest)

• Only the Merkle root included in the block’s hash• Finally resulting one block hash combined with the

block chain (linked together)

• Item here represents transaction

Block Chain (Digest)

New Block

Page 31: Bitcoin (Cryptocurrency)

Block Chain

• Problem– Multiple blocks can be created at the same time

• Can’t rely on the order because they may arrive in different order

• Solution– Vote the blocks and whichever wins will be selected

• How to vote?– Every nodes need to solve problem in order to vote

• Which makes it difficult to vote (from fake votes)

• Proof of work– That puzzle is called proof of work– Which measures (proves) computing power is used or not

Page 32: Bitcoin (Cryptocurrency)

Block Chain• In this picture,

– Three blocks are happened at the same time and – Each node build on top of the first one it received– Other nodes may have received the blocks in a different order and will be generating on

the first block they received.

Page 33: Bitcoin (Cryptocurrency)

Block Chain– Current block link gets broken when someone solves another

block (prev picture)

– The general rule is that • Node always immediately switch to the longest branch available.

– The Proof of Work (Reversing hash with certain threshold)• Makes it rare for blocks to be solved at the same time (Time Stamp)• And even more rare for this to happen multiple times in a row.

– The probability of a single hash succeeding is:• 0.000000000000000000004708677169344093260240169483005212

5

Page 34: Bitcoin (Cryptocurrency)

Proof of Work (POW)

• Proof of Work– Is a economic measure to deter spam email and denial of service

(Dos) attacks– It requires computing power before being allowed to use service

• Key feature– Work must be hard to compute– But easy to verify

• Bitcoin Proof of work is – Similar to Adam Back’s Hashcash– Used for block generation

Page 35: Bitcoin (Cryptocurrency)

Proof of Work (Bitcoin)

• Proof of work scheme is SHA-256

• And works relative to a given – Challenge string (Hashed previous block chain)– And proof (Nonce or random guess)

• Given challenge string, node needs to find proof that when hashed, result begins with a number of zero bits (Threshold).

• Hash(Proof + Challenge) = 000..0XXX..X– Depending on the zeros computation time would be doubled

Page 36: Bitcoin (Cryptocurrency)

Proof of Work

• Challenge

Proof of Work

When 1 zero added,work will be doubled

Because 2^5 = 2^4 * 2

Proof Challenge

Hash

0000000…0xxxxxxxxx…x

Threshold zeros

Keep insertingRandom bits

Prev BC Hash

Page 37: Bitcoin (Cryptocurrency)

Proof of Work

When resulting zeros are 40 means 2^40 = 1099511627776When 41 zeros means 2^40 * 2 (doubled)

Page 38: Bitcoin (Cryptocurrency)

Proof of Work• It is impossible to switch block in the middle of the chain

– Because hash value for the new block would be different– And reference would no longer point to it

• Which means block cannot be solved before the previous block is solved

Page 39: Bitcoin (Cryptocurrency)

Proof of Work

• After successfully solving the problem– Block will be accepted (to the next chain)

• Difficulty of work is adjusted by network so that block can be generated every 10 minutes– When many miners (nodes) joined to the network proof of

work become more difficult– Otherwise, it will become easier

• That is the reason transaction confirmation take 10 minutes on average (SAFETY reason)

Page 40: Bitcoin (Cryptocurrency)

Bitcoin Network• The steps to run the network are:

– New transactions are broadcast to all nodes (transaction)

– Each node collects new transactions put it into a block and works on finding a difficult proof-of-work for its block (problem solving)

– When a node finds a proof-of-work it broadcasts the block to all nodes (block)

– Nodes accept the block only if all transactions in it are valid and not already spent

– Nodes express their acceptance of the block by working on creating the next block in the chain and using the hash of the accepted block as the previous hash

Page 41: Bitcoin (Cryptocurrency)

Network (Safety)• If two blocks are found at the same time, this will be decided by

the vote

• Vote is not one-IP-address-one-vote but rather one-CPU-one-vote

• In the network, there is other nodes (CPU) will also solve and result (vote) will be the same as one of them

• One with the most vote will be accepted

• Modifying a past block, attacker have to redo all the proof of work of the previous blocks

Page 42: Bitcoin (Cryptocurrency)

Network (Safety)• Moreover, when two different blocks are found, nodes work on the first one

they received, but save the other branch in case it becomes longer

• Link will be broken when the next POW is found and other link becomes longer

• And nodes that are working on the other branch will then switch to the longer one.

• Majority of decision is represented by the longest chain, which has the greatest POW effort invested

• Outrunning block chain is same as the winning the lottery many consecutive times – Because hash is collision resistance (Hard to find)

Page 43: Bitcoin (Cryptocurrency)

Network (double spending)

• For attackers perspective:– Attacker needs to get input from previous block and add his own

(fake) transaction.– Then compute the next blocks until he catches the honest block chain.– Honest chain generates new block every 10 minutes.– The race between the honest chain and attacker chain can be

characterized as a Binomial Random Walk.– Probability is analogous to a Gambler’s Ruin problem

Waiting for 10 minutes makes transaction more secure!

Page 44: Bitcoin (Cryptocurrency)

How Bitcoin is Generated?• Reward is given to whoever solves a block• Which means

– Whenever miners succeed, they are allowed include in that transaction block special transaction for themselves.

• That is coin-based transaction and this is how new coins get included in the BTC system.

• This is the reward for work associated with adding a new transaction block to the existing transaction block chain for Bitcoin– Because these nodes are using a lot of computational power (Hardware and

electricity) to come up with these proofs

• Moreover, succeeded miner also get to collect the transaction fees that are specified in the transaction records

Page 45: Bitcoin (Cryptocurrency)

Bitcoin Generation (reward)

Whoever solved the hash can include their transaction into new block (for reward)

Also collects all transactions fees inside of that block

Page 46: Bitcoin (Cryptocurrency)

Bitcoin Generation

• Totally 21,000,000 BTC– Total number of BTC will be generated for reward (Maximum

number of BTC in BTC network)– BTC system is public, so anyone knows how many BTC have been

generated

• 25 BTC reward– Current BTC reward for solving new block (This was 50 at the

beginning)

• Transaction Fees– After all BTC generated, reward will depends on the transaction fees

Page 47: Bitcoin (Cryptocurrency)

Bitcoin Generation

• Reward size is cut in half every 210,000 blocks (4 years)– Every 10 minutes there’s new block generated– So 1 block * 6 (hour) * 24 * 365 * 4 = 210,240

• Every 2016 blocks proof of work is normalized (2 weeks)– Estimated time: 10 min * 6 (hour) * 24 (day) * 14 = 2016– When blocks are generated faster than 2 weeks, proof of

work becomes harder– Otherwise it becomes easier (fewer miners)

Page 48: Bitcoin (Cryptocurrency)

Bitcoin Generation

• At around year 2140, all bitcoins will have been generated

• BTC are fractional– Smallest possible unit is: 0.0000 0001 BTC

(Satoshi)– All other units• Bits or μBTC – 0.000001• mBTC - 0.001..

Page 49: Bitcoin (Cryptocurrency)

Bitcoin Unit

Page 50: Bitcoin (Cryptocurrency)

Is it slow? (Transaction)

• Bitcoin transactions are not slow, in fact it is INSTANT! But confirmations take 10 minutes on average (New block generation time)

• Confirmation is supposed to take care of double spending problem

• If customer buys small stuff like coffee customer doesn't have to wait at all. The merchant simply takes the risk

Page 51: Bitcoin (Cryptocurrency)

How to Get Bitcoin?

• There are currently four methods of acquiring Bitcoins:1. Mining (Requires large investment)2. Wiring in fiat currency to an BTC exchange

(www.coinbase.com)3. Buying from an individual4. Selling items for BTC

Page 52: Bitcoin (Cryptocurrency)

Where Do I Store Bitcoin?

• Bitcoins are stored in wallets– Wallets is a randomly generated string of numbers and

consists of: private key and public key• There are three different types of Wallets:

1. Online wallet service• Create and remember passwords for our behalf (coinbase.com)

2. Local wallet or offline wallet• Download and install on our computer (We need to download

all block chains on your computer ~ over 20GB)

3. Paper wallet• Keys are generated offline and printed on a physical piece of

paper

Page 53: Bitcoin (Cryptocurrency)

Local Wallet Example

Sending BTC

Receive using address

Receive using QR code

BTC addresses

Page 54: Bitcoin (Cryptocurrency)

BTC vs USD• Currently there is 14,083,600 BTC generated• 1 BTC = $234.54 USD ($221 USD 10 days ago)• Market Cap: 234 * 14,083,600 ~ $3.3B Billion USD (3.1 10 days ago)

Price bubble

1 BTC ~ $1000 USD

Page 55: Bitcoin (Cryptocurrency)

Potential Outcome of BTC

• BTC will either succeed with the mainstream or fail• If succeed:

– By 2025• The estimated world GDP is expected to be around $71T in the year

2025• “If” BTC can establish a 0.1% Market Cap or $71B and 25% are used

for transactions, then market price of one Bitcoin would be about.. ($14,947) (Old data from end of the 2013)

• Rule #1 of investing: (Because of “if”)– Invest only what you can afford to lose!

• Bitcoin is still experimental, so its future cannot be predicted by anyone.

Page 56: Bitcoin (Cryptocurrency)

Price– Previous data is from 2013

• Current GDP US$74.31 trillion (from wikipedia)

• Market cap: 0.0044% of the current GDP• 100.000 - 300.000 BTC are used for the transaction (every day) (0.0045% used for the

transaction) from 3.3B– Saving (not using)

– When it becomes 0.1% and– 25% of them used for the transaction

• 1 BTC ~ $15.000 USD

• Price depends on Market capacity• And number of transaction used

• Value of the bank balance is set by supply and demand of the market

Page 57: Bitcoin (Cryptocurrency)

Fee per day

12 – 17 BTC is used for everyday25 BTC from reward

Page 58: Bitcoin (Cryptocurrency)

Number of Transactions

~60.000 – 100.000 and increasing

Page 59: Bitcoin (Cryptocurrency)

Number of Transactions per Block

350 – 750 and increasing

Page 60: Bitcoin (Cryptocurrency)

Comparison of Crypto-currencies

Page 61: Bitcoin (Cryptocurrency)

BitCoin vs LiteCoin

Old data

Page 62: Bitcoin (Cryptocurrency)

Price and Market CapBitCoin LiteCoin

1 vs USD

$234.50 USD ~1.4 USD ($1.42771)

Market Capacity

$3,299,521,813.80 (~$3.3B USD)100%

$55,143,333.40 (~$55M USD)1.67%

# of Transactions

106,955 4,505

Page 63: Bitcoin (Cryptocurrency)

Conclusion• Bitcoin is decentralized cryptocurrency• Transferred person to person• No bank or government control• Low transaction fees• Bitcoin solves “double spend” problem through distributed network

– Proof of work– Hash

• Open to anyone– Public ledger– Block chain

• Very difficult and expensive to hack– Winning a lottery consecutive times in 10 minutes

• Transparent (open source)

Page 64: Bitcoin (Cryptocurrency)

References• https://bitcoin.org/bitcoin.pdf• http://papers.ssrn.com/sol3/papers.cfm?abstract_id=2544331• http://en.wikipedia.org/wiki/Proof-of-work_system• https://en.bitcoin.it/wiki/Proof_of_work• https://bitcoin.org/en/developer-guide#payment-processing• http://alphapixel.com/sites/default/files/download/BitCoinPresentation.pdf• https://www.stlouisfed.org/~/media/Files/PDFs/DWTF/Bitcoin-3-31-14.pdf• http://www.imponderablethings.com/2013/07/how-bitcoin-works-under-

hood.html• https://www.tbs-certificates.co.uk/FAQ/en/sha256.html• www.khanacademy.org/economics-finance-domain/core-finance/money-an

d-banking/bitcoin

• http://www.coindesk.com/price/

Page 65: Bitcoin (Cryptocurrency)

Thank you

• Questions?