handouts/ho08.tex
author Christian Urban <christian dot urban at kcl dot ac dot uk>
Thu, 20 Nov 2014 01:38:08 +0000
changeset 318 f376d16470e0
child 319 e6afcdabd3ea
permissions -rw-r--r--
added
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
318
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     1
\documentclass{article}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     2
\usepackage{../style}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     3
\usepackage{../graphics}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     4
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     5
\begin{document}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     6
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     7
\section*{Handout 7 (Bitcoins)}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     8
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     9
In my opinion Bitcoins are a Ponzi
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    10
scheme\footnote{\url{http://en.wikipedia.org/wiki/Ponzi_scheme}}---still
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    11
the ideas behind them are really beautiful and not too
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    12
difficult to understand. Since many colourful claims about
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    13
Bitcoins float around in the mainstream media, it will be
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    14
instructive to re-examine such claims from a more technically
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    15
informed vantage point. For example, it is often claimed that
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    16
Bitcoins are anonymous and free from any potential government
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    17
meddling. It turns out that the first claim ignores a lot of
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    18
research in de-anonymising social networks, and the second
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    19
underestimates the persuasive means a government has at their
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    20
disposal. Below I will follow the very readable explanations
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    21
about Bitcoins from
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    22
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    23
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    24
\url{http://www.michaelnielsen.org/ddi/how-the-bitcoin-protocol-actually-works/}\smallskip\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    25
\url{http://www.imponderablethings.com/2013/07/how-bitcoin-works-under-hood.html}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    26
\end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    27
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    28
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    29
Let us start with the question who invented Bitcoins? You
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    30
could not make up the answer, but we actually do not know who
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    31
is the inventor. All we know is that the first paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    32
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    33
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    34
\url{https://bitcoin.org/bitcoin.pdf}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    35
\end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    36
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    37
\noindent is signed by Satoshi Nakamoto, which however is
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    38
likely only a pen name. There is a lot of speculation who
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    39
could be the inventor, or inventors, but we simply do not
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    40
know. This part of Bitcoins is definitely anonymous. The first
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    41
Bitcoin transaction was made in January 2009. The rules in
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    42
Bitcoin are set up so that there will only be 21 Million
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    43
Bitcoins with the maximum reached around year 2140. Contrast
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    44
this with other fiat currencies where money can be printed
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    45
almost at will. The smallest unit of a Bitcoin is called a
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    46
Satoshi which is the $10^{-8}$ part of a Bitcoin. Remember a
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    47
Penny is the $10^{-2}$ part of a Pound.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    48
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    49
The two main cryptographic building blocks of Bitcoins are
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    50
cryptographic hashing (SHA-256) and public-private keys using 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    51
elliptic-curve encryption for digital signatures. Hashes are 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    52
used to generate `fingerprints' of data that ensures its
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    53
integrity. Public-private keys are used for signatures. For 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    54
example sending a message, say $msg$, together with the 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    55
encrypted version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    56
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    57
\[
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    58
msg, \{msg\}_{K^{priv}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    59
\]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    60
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    61
\noindent allows everybody with access to the public key to
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    62
verify the message came from the person who knew the private
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    63
key. Signatures are used in Bitcoins for verifying the
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    64
addresses where the Bitcoins come from. Addresses in Bitcoins
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    65
are essentially the public keys. There are $2^{160}$ possible
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    66
addresses, which is such a vast amount that there is not test
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    67
for duplicates\ldots{}or already used addresses.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    68
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    69
Traditional banking involves a central ledger which specifies
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    70
the current balance in each account, for example 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    71
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    72
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    73
\begin{tabular}{l|r}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    74
account & balance\\\hline
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    75
Alice   & \pounds{10.01}\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    76
Bob     & \pounds{4.99}\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    77
Charlie & -\pounds{1.23}\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    78
Eve     & \pounds{0.00}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    79
\end{tabular}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    80
\end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    81
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    82
\noindent Bitcoins work differently in that there is no
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    83
central ledger, but a public record of all transactions. This
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    84
means spending money corresponds to sending messages of
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    85
the very rough form 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    86
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    87
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    88
$\{\text{I, Alice, am giving Bob one Bitcoin.}\}_{K^{priv}_{Alice}}$
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    89
\end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    90
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    91
\noindent They are encrypted with Alice's private key such
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    92
that everybody, including Bob, can use Alice's public key
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    93
$K^{pub}_{ALice}$ in order to verify the message came really
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    94
from Alice, or more precisely from the person who knows
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    95
$K^{priv}_{Alice}$. The problem with such messages in a
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    96
distributed system is what happens if Bob receives 10, say, of
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    97
these messages. Did Alice intend to send him 10 Bitcoins, or
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    98
did the message by Alice get duplicated by for example an
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    99
attacker re-playing a sniffed message. What is needed is
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   100
a kind of serial number for such messages. Meaning transaction 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   101
messages look more like 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   102
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   103
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   104
$\{\text{I, Alice, am giving Bob Bitcoin \#1234567.}\}_{K^{priv}_{Alice}}$
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   105
\end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   106
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   107
\noindent There are two problems that need to be solved. One is
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   108
who is assigning serial numbers to bitcoins and also how can
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   109
Bob verify that Alice actually owns this Bitcoin to pay
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   110
him? In a system with a bank as trusted third-party, Bob
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   111
could do the following:
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   112
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   113
\begin{itemize}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   114
\item Bob asks the bank whether the Bitcoin with that serial
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   115
      number belongs to Alice and Alice hasn’t already spent
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   116
      this Bitcoin.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   117
\item If yes, then Bob tells the bank he accepts this Bitcoin.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   118
      The bank updates the records to show that the Bitcoin
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   119
      with that serial number is now in Bob’s possession and
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   120
      no longer belongs to Alice. 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   121
\end{itemize}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   122
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   123
\noindent But banks would need to be trusted and would also be
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   124
an easy target for any government interference, for example.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   125
Think of the early days of music sharing where the company
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   126
Napster was the single point of ``failure'' which was taken
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   127
offline by law enforcement. 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   128
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   129
Bitcoin solves the problem of not being able to rely on a bank
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   130
by making everybody the bank. Everybody who cares can have the
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   131
entire transaction history starting with the first transaction
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   132
made in January 2009. This history of transactions is called 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   133
\emph{blockchain}. Bob can use his copy of the blockchain for 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   134
determining whether Alice owned the Bitcoin and if yes 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   135
transmits the message to every other participant on the 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   136
Bitcoin network. The blockchain looks roughly like a very long 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   137
chain of individual blocks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   138
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   139
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   140
\includegraphics[scale=0.4]{../pics/bitcoinblockchain0.png}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   141
\end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   142
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   143
\noindent Each block contains a list of individual
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   144
transactions. They are hashed so that the data in the
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   145
transactions cannot be tampered with. This hash is the unique
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   146
serial number of each block. Each block also contains a
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   147
reference of the previous block. Since this
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   148
previous-block-reference is also hashed, the whole chain is
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   149
robust against tampering. We can check this by checking the
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   150
entire blockchain whether the references and hashes are
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   151
correctly recorded. I have not tried it myself, but it is said
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   152
that with the current amount of data in the blockchain it
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   153
takes roughly a day to check the consistency of the blockchain
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   154
on a ``normal'' computer. Fortunately this consistency test
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   155
from the beginning usually only needs to be done once.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   156
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   157
Recall I wrote earlier Bitcoins that do not maintain a ledger
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   158
listing all the current balances in each account.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   159
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   160
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   161
\includegraphics[scale=0.4]{../pics/blockchain.png}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   162
\end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   163
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   164
\end{document}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   165
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   166
bit coin
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   167
https://bitcoin.org/bitcoin.pdf
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   168
https://bitcoin.org/bitcoin.pdf
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   169
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   170
A fistful of bitcoins
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   171
http://cseweb.ucsd.edu/~smeiklejohn/files/imc13.pdf
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   172
http://cseweb.ucsd.edu/~smeiklejohn/files/imc13.pdf
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   173
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   174
Ross Anderson & Co (no dispute resolution; co-ercion)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   175
http://www.cl.cam.ac.uk/~sjm217/papers/fc14evidence.pdf
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   176
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   177
http://www.michaelnielsen.org/ddi/how-the-bitcoin-protocol-actually-works/
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   178
http://www.imponderablethings.com/2013/07/how-bitcoin-works-under-hood.html
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   179
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   180
http://randomwalker.info/bitcoin/