Cryptocurrency Bitcoin: Tsaschikher Nyamgerel 2015

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 65

Cryptocurrency Bitcoin

Tsaschikher Nyamgerel
2015
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
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)
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


Who and When?
It’s name also been suggested that
• Samsung
• Toshiba
Satoshi Nakamoto
• Nakamichi
• Motorola
Are the founders. (But there’s no confirmation)
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..
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)
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


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)
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
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
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)


Public Key and Address
Generation

Public Key generation


using Elliptic Curve Address generation
using Hash
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 key
Signature = 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))
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)
Transaction
• BitCoin is collective entries into a ledger
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
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
Transaction

Now Alice can send 5 bitcoins to Bob


Transaction
Transactions are not encrypted so it is possible to browse and view
http://blockexplorer.com Type: Address and PubKey

ScriptSig contains:
Signature + Public Key

Input balance should match with output Real Transaction example


Transaction (Chain)

- Each transaction includes its previous transaction


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
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


Double Spending
• Double spend (Alice->Bob)
1. Alice send bitcoin to Bob, don’t include fee
2. 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)
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
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
Block Chain
• Node (also computer or miner)
– Collects unconfirmed transactions into a block
– Broadcasts the block to all nodes
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
Block Chain
– To add block to the block chain
• Every transactions inside the block paired and then
hashed together like a Merkle Tree
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)

Block Chain (Digest)

New Block


Item here represents transaction
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
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.


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.0000000000000000000047086771693440932602401694830052
125
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
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
Proof of Work

Keep inserting
Challenge Random bits

Proof of Work
Proof Challenge Prev BC Hash

Hash

When 1 zero added,


work will be doubled
0000000…0xxxxxxxxx…x

Because 2^5 = 2^4 * 2 Threshold zeros


Proof of Work

When resulting zeros are 40 means 2^40 = 1099511627776


When 41 zeros means 2^40 * 2 (doubled)
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
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)
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
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
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)
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!


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
Bitcoin Generation (reward)

Also collects all transactions fees inside of that block

Whoever solved the hash can include their


transaction into new block (for reward)
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
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)
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..
Bitcoin Unit
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
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 individual
4. Selling items for BTC
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
Local Wallet Example
Sending BTC

BTC addresses
Receive using address

Receive using QR code


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


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.
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
Fee per day

25 BTC from reward 12 – 17 BTC is used for everyday


Number of Transactions

~60.000 – 100.000 and increasing


Number of Transactions per Block

350 – 750 and increasing


Comparison of Crypto-currencies
BitCoin vs LiteCoin

Old data
Price and Market Cap
BitCoin LiteCoin
1 vs USD
$234.50 USD ~1.4 USD ($1.42771)
Market Capacity
$3,299,521,813.80 $55,143,333.40
(~$3.3B USD) (~$55M USD)
100% 1.67%
# of Transactions
106,955 4,505
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)
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.p
df
• 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-
and-banking/bitcoin
• http://www.coindesk.com/price/
Thank you
• Questions?

You might also like