handouts/ho08.tex
changeset 346 5a6e8b7d20f7
parent 339 0e78c809b17f
child 347 efad8155513f
equal deleted inserted replaced
345:7f0ac1355f0b 346:5a6e8b7d20f7
    79 you step on somebody else's shoes. Compare this with the
    79 you step on somebody else's shoes. Compare this with the
    80 email-addresses you wanted to register with, say
    80 email-addresses you wanted to register with, say
    81 Gmail, but which are always already taken.
    81 Gmail, but which are always already taken.
    82 
    82 
    83 One major difference between Bitcoins and traditional banking
    83 One major difference between Bitcoins and traditional banking
    84 is that you do not have a place, or places, that record the
    84 is that you do not have a place, or few places, that record the
    85 balance on your account. Traditional banking involves a
    85 balance on your account. Traditional banking involves a
    86 central ledger which specifies the current balance in each
    86 central ledger which specifies the current balance in each
    87 account, for example 
    87 account, for example 
    88 
    88 
    89 \begin{center}
    89 \begin{center}
   116 The problem with such messages in a distributed system is that
   116 The problem with such messages in a distributed system is that
   117 what happens if Bob receives 10, say, of these transactions?
   117 what happens if Bob receives 10, say, of these transactions?
   118 Did Alice intend to send him 10 Bitcoins, or did the message
   118 Did Alice intend to send him 10 Bitcoins, or did the message
   119 get duplicated by for example an attacker re-playing a sniffed
   119 get duplicated by for example an attacker re-playing a sniffed
   120 message? What is needed is a kind of serial number for such
   120 message? What is needed is a kind of serial number for such
   121 transactions. This means transaction messages look more like 
   121 transactions. This means transaction messages shoul look more like 
   122 
   122 
   123 \begin{center}
   123 \begin{center}
   124 $\{\text{I, Alice, am giving Bob Bitcoin \#1234567.}\}_{K^{priv}_{Alice}}$
   124 $\{\text{I, Alice, am giving Bob Bitcoin \#1234567.}\}_{K^{priv}_{Alice}}$
   125 \end{center}
   125 \end{center}
   126 
   126 
   214 ``consolidate'' your funds: if it were only possible to split
   214 ``consolidate'' your funds: if it were only possible to split
   215 transactions, then the amounts would get smaller and smaller. 
   215 transactions, then the amounts would get smaller and smaller. 
   216 
   216 
   217 In Bitcoins you have the ability to both combine incoming
   217 In Bitcoins you have the ability to both combine incoming
   218 transactions, but also to split outgoing transactions to
   218 transactions, but also to split outgoing transactions to
   219 potentially more than one receiver. The latter is needed.
   219 potentially more than one receiver. The latter is also needed.
   220 Consider again the rightmost transactions in
   220 Consider again the rightmost transactions in
   221 Figure~\ref{txngraph} and suppose Alice is a coffeeshop owner
   221 Figure~\ref{txngraph} and suppose Alice is a coffeeshop owner
   222 selling coffees for 1 Bitcoin. Charles received a transaction
   222 selling coffees for 1 Bitcoin. Charles received a transaction
   223 from Zack over 5 Bitcoins, say. How does Charles pay for the
   223 from Zack over 5 Bitcoins, say. How does Charles pay for the
   224 coffee? There is no explicit notion of \emph{change} in the
   224 coffee? There is no explicit notion of \emph{change} in the
   321 on the network that she is still the rightful owner of the
   321 on the network that she is still the rightful owner of the
   322 Bitcoin. After being outvoted, Bob would be a tad peeved. 
   322 Bitcoin. After being outvoted, Bob would be a tad peeved. 
   323 
   323 
   324 The reflex reaction to such a situation would be to make the
   324 The reflex reaction to such a situation would be to make the
   325 process of validating a transaction as cheap as possible. The
   325 process of validating a transaction as cheap as possible. The
   326 intention is that Bob will get enough peers to agree with him
   326 intention is that Bob will easily get enough peers to agree with him
   327 that he is the rightful owner. But such a solution has always
   327 that he is the rightful owner. But such a solution has always
   328 the limitation of Alice setting up an even bigger network of
   328 the limitation of Alice setting up an even bigger network of
   329 puppy identities. The really cool idea of Bitcoin is to go
   329 puppy identities. The really cool idea of Bitcoin is to go
   330 into the other direction of making the process of transaction
   330 into the other direction of making the process of transaction
   331 validation (artificially) as expensive as possible, but reward
   331 validation (artificially) as expensive as possible, but reward
   417 \begin{equation}
   417 \begin{equation}
   418 \includegraphics[scale=0.38]{../pics/bitcoin_unconfirmed.png}
   418 \includegraphics[scale=0.38]{../pics/bitcoin_unconfirmed.png}
   419 \label{unconfirmed}
   419 \label{unconfirmed}
   420 \end{equation}
   420 \end{equation}
   421 
   421 
   422 \noindent The puzzle is given as follows: There are some
   422 \noindent The puzzle is stated as follows: There are some
   423 unconfirmed transactions. Choosing some of them, the miner
   423 unconfirmed transactions. Choosing some of them, the miner
   424 (i.e.~the person/computer that tries to solve a puzzle) will
   424 (i.e.~the person/computer that tries to solve a puzzle) will
   425 form a putative block to be added to the blockchain. This
   425 form a putative block to be added to the blockchain. This
   426 putative block will contain the transactions and the reference
   426 putative block will contain the transactions and the reference
   427 to the previous block. The serial number of such a block is
   427 to the previous block. The serial number of such a block is
   435 The intention of the proof-of-work puzzle is that the
   435 The intention of the proof-of-work puzzle is that the
   436 blockchain is at every given moment linearly ordered, see the
   436 blockchain is at every given moment linearly ordered, see the
   437 picture shown in \eqref{unconfirmed}. If we don’t have such a
   437 picture shown in \eqref{unconfirmed}. If we don’t have such a
   438 linear ordering at any given moment then it may not be clear
   438 linear ordering at any given moment then it may not be clear
   439 who owns which Bitcoins. Assume a miner David is lucky and
   439 who owns which Bitcoins. Assume a miner David is lucky and
   440 finds a suitable salt to confirm the transactions. Should he
   440 finds a suitable salt to confirm some transactions. Should he
   441 celebrate? Not yet. Typically the blockchain will look as
   441 celebrate? Not yet. Typically the blockchain will look as
   442 follows
   442 follows
   443 
   443 
   444 \begin{center}
   444 \begin{center}
   445 \includegraphics[scale=0.65]{../pics/block_chain1.png}
   445 \includegraphics[scale=0.65]{../pics/block_chain1.png}
   463 given time, miners only work to extend whichever fork is
   463 given time, miners only work to extend whichever fork is
   464 longest in their copy of the block chain. Why should miners
   464 longest in their copy of the block chain. Why should miners
   465 work on the longest fork? Well their incentive is to mine
   465 work on the longest fork? Well their incentive is to mine
   466 Bitcoins. If somebody else already solved a puzzle, then it
   466 Bitcoins. If somebody else already solved a puzzle, then it
   467 makes more sense to work on a new puzzle and obtain the
   467 makes more sense to work on a new puzzle and obtain the
   468 Bitcoins for solving that puzzle, rather than wast efforts on
   468 Bitcoins for solving that puzzle, rather than waste efforts on
   469 a fork that is shorter and therefore less likely to be
   469 a fork that is shorter and therefore less likely to be
   470 ``accepted''. Note that whoever solved a puzzle on the
   470 ``accepted''. Note that whoever solved a puzzle on the
   471 ``loosing'' fork will actually not get any Bitcoins as reward.
   471 ``loosing'' fork will actually not get any Bitcoins as reward.
   472 Tough luck.
   472 Tough luck.
   473 
   473 
   503 before the rest of the world, but to be lucky many times is
   503 before the rest of the world, but to be lucky many times is
   504 very unlikely. This principle of having to race against the
   504 very unlikely. This principle of having to race against the
   505 rest of the world avoids the ploy of double spend.
   505 rest of the world avoids the ploy of double spend.
   506 
   506 
   507 In order to raise the bar for Alice even further, merchants
   507 In order to raise the bar for Alice even further, merchants
   508 accepting Bitcoin use the following rule of thumb: A
   508 accepting Bitcoins use the following rule of thumb: A
   509 transaction is ``confirmed'' if 
   509 transaction is ``confirmed'' if 
   510 
   510 
   511 \begin{itemize}
   511 \begin{itemize}
   512 \item[(1)] it is part of a block in the longest fork, and 
   512 \item[(1)] it is part of a block in the longest fork, and 
   513 \item[(2)] at least 5 blocks follow it in the longest fork. In
   513 \item[(2)] at least 5 blocks follow it in the longest fork. In
   514            this case we say that the transaction has ``6
   514            this case we say that the transaction has 6
   515            confirmations''. 
   515            confirmations. 
   516 \end{itemize} 
   516 \end{itemize} 
   517 
   517 
   518 \noindent A simple calculation shows that this amount of
   518 \noindent A simple calculation shows that this amount of
   519 confirmations can take up to 1 hour and more. While this seems
   519 confirmations can take up to 1 hour and more. While this seems
   520 excessively long, from the merchant's point of view it is not
   520 excessively long, from the merchant's point of view it is not
   521 that long at all. For this recall that ordinary creditcards
   521 that long at all. For this recall that ordinary creditcards
   522 can have their transactions been rolled-back for 6 months or
   522 can have their transactions been rolled-back for 6 months or
   523 so. The point however is that the odds for Alice being able to
   523 so. The point however is that the odds for Alice being able to
   524 cheat are very low, unless she can muster more than 50\% of
   524 cheat are very low, unless she can muster more than 50\% of
   525 the world Bitcoin mining capacity.
   525 the world Bitcoin mining capacity. In this case she could
       
   526 out-race the rest of the world. The point is however that
       
   527 amassing such an amount of computing power is practically
       
   528 impossible for a single person or even a moderately large 
       
   529 group.
   526 
   530 
   527 Connected with the 6-confirmation rule is an interesting
   531 Connected with the 6-confirmation rule is an interesting
   528 phenomenon. On average, it would take several years for a
   532 phenomenon. On average, it would take several years for a typical
   529 typical computer to solve a proof-of-work puzzle, so an
   533 computer to solve a proof-of-work puzzle, so an individual’s chance of
   530 individual’s chance of ever solving one before the rest of the
   534 ever solving one before the rest of the world, which typically takes
   531 world, which typically takes only 10 minutes, is negligibly
   535 only 10 minutes, is negligibly low. Therefore many people join groups
   532 low. Therefore many people join groups called \emph{mining
   536 called \emph{mining pools} that collectively work to solve blocks, and
   533 pools} that collectively work to solve blocks, and distribute
   537 distribute rewards based on work contributed. These mining pools act
   534 rewards based on work contributed. These mining pools act
   538 somewhat like lottery pools among co-workers, except that some of
   535 somewhat like lottery pools among co-workers, except that some
   539 these pools are quite large, and comprise more than 20\% of all the
   536 of these pools are quite large, and comprise more than 20\% of
   540 computers in the network. It is said that BTC, a large mining pool,
   537 all the computers in the network. It is said that BTC, a large
   541 has limited its number of members in order to not solve more than 6
   538 mining pool, has limited its members to not solve more than 6
   542 blocks in a row. Otherwise this would undermine the trust in Bitcoins,
   539 blocks in a row. Otherwise this would undermine the trust in
   543 which is also not in the interest of BTC, I guess.  Some statistics on
   540 Bitcoins, which is also not in the interest of BTC, I guess.
   544 mining pools can be seen at
   541 Some statistics on mining pools can be seen at
       
   542 
   545 
   543 \begin{center}
   546 \begin{center}
   544 \url{https://blockchain.info/pools}
   547 \url{https://blockchain.info/pools}
   545 \end{center}
   548 \end{center}
   546 
   549 
   547 \subsubsection*{Bitcoins for Real}
   550 \subsubsection*{Bitcoins for Real}
   548 
   551 
   549 Let us now turn to the nitty gritty details. As a user you 
   552 Let us now turn to the nitty gritty details. As a participant in the
   550 need to generate and store a public-private key pair. The 
   553 Bitcoin networ you need to generate and store a public-private key
   551 public key you need to advertise in order to receive payments 
   554 pair. The public key you need to advertise in order to receive
   552 (transactions). The private key needs to be securely stored. 
   555 payments (transactions). The private key needs to be securely stored.
   553 For this there seem to be three possibilities
   556 For this there seem to be three possibilities
   554 
   557 
   555 \begin{itemize}
   558 \begin{itemize}
   556 \item an electronic wallet on your computer
   559 \item an electronic wallet on your computer
   557 \item a cloud-based storage (offered by some Bitcoin service)
   560 \item a cloud-based storage (offered by some Bitcoin services)
   558 \item paper-based
   561 \item paper-based
   559 \end{itemize}
   562 \end{itemize}
   560 
   563 
   561 \noindent The first two options of course offer convenience
   564 \noindent The first two options of course offer convenience for making
   562 for making and receiving transactions. But given the nature of
   565 and receiving transactions. But given the nature of the private keys
   563 the private key and how much security relies on them (recall
   566 and how much security relies on them (recall if somebody gets hold of
   564 if somebody gets hold of it, your Bitcoins are quickly lost
   567 it, your Bitcoins are quickly lost forever) I would opt for the third
   565 forever) I would opt for the third option for anything except
   568 option for anything except for trivial amounts of Bitcoins. As we have
   566 for trivial amounts of Bitcoins. As we have seen securing a
   569 seen earlier in the course, securing a computer system that it can
   567 computer system that it can withstand a breakin is still very
   570 withstand a breakin is still very much an unsolved problem.
   568 much an unsolved problem.
       
   569 
   571 
   570 An interesting fact with Bitcoin keys is that there is no
   572 An interesting fact with Bitcoin keys is that there is no
   571 check for duplicate addresses. This means when generating a
   573 check for duplicate addresses. This means when generating a
   572 public-private key, you should really start with a carefully
   574 public-private key, you should really start with a carefully
   573 chosen random number such that there is really no chance to
   575 chosen random number such that there is really no chance to
   575 possibilities. Again if you share an address with somebody
   577 possibilities. Again if you share an address with somebody
   576 else, he or she has access to all your unspend transactions.
   578 else, he or she has access to all your unspend transactions.
   577 The absence of such a check is easily explained: How would one
   579 The absence of such a check is easily explained: How would one
   578 do this in a distributed system? The answer you can't. It is
   580 do this in a distributed system? The answer you can't. It is
   579 possible to do some sanity check of addresses that are already
   581 possible to do some sanity check of addresses that are already
   580 used in the black chain, but this is not a fail-proof method.
   582 used in the blockchain, but this is not a fail-proof method.
   581 One really has to trust on the enormity of the $2^{160}$
   583 One really has to trust on the enormity of the $2^{160}$
   582 number.
   584 space for addresses.
   583 
   585 
   584 Let us now look at the data that is stored in an transaction 
   586 Let us now look at the concrete data that is stored in an transaction 
   585 message:
   587 message:
   586 
   588 
   587 \lstinputlisting[language=Scala]{../slides/msg}
   589 \lstinputlisting[language=Scala]{../slides/msg}
   588 
   590 
   589 \noindent The hash in Line 1 is the hash of all the data that
   591 \noindent The hash in Line 1 is the hash of all the data that
   635 
   637 
   636 \begin{center}
   638 \begin{center}
   637 \url{http://bitcoinmagazine.com/13774/government-bans-professor-mining-bitcoin-supercomputer/}
   639 \url{http://bitcoinmagazine.com/13774/government-bans-professor-mining-bitcoin-supercomputer/}
   638 \end{center}
   640 \end{center}
   639 
   641 
   640 
   642 \noindent
   641 \subsubsection*{Anonymity and Government Meddling}
   643 Bitcoin mining nowadays is only competitive, or profitable,
       
   644 if you get the energy for free, or use special purpose 
       
   645 computing devices.
       
   646 
       
   647 \subsubsection*{Anonymity with Bitcoins}
   642 
   648 
   643 One question one often hears is how anonymous is it actually
   649 One question one often hears is how anonymous is it actually
   644 to pay with Bitcoins? Paying with paper money used to be a
   650 to pay with Bitcoins? Paying with paper money used to be a
   645 quite anonymous act (unlike paying with creditcards, for
   651 quite anonymous act (unlike paying with creditcards, for
   646 example). But this has changed nowadays: You cannot come to a
   652 example). But this has changed nowadays: You cannot come to a
   668 the great majority of Bitcoin users are not identified with
   674 the great majority of Bitcoin users are not identified with
   669 relatively high confidence and ease in the near future.''
   675 relatively high confidence and ease in the near future.''
   670 \end{quote}
   676 \end{quote}
   671 
   677 
   672 \noindent The only thing I can add is that with Bitcoins we
   678 \noindent The only thing I can add is that with Bitcoins we
   673 will have even more fun hearing confessions like the infamous
   679 will in the future have even more fun hearing confessions from
       
   680 famous or not-so famous people like the infamous
   674 ``I did not
   681 ``I did not
   675 inhale''.\footnote{\url{www.youtube.com/watch?v=Bktd_Pi4YJw}}
   682 inhale''.\footnote{\url{www.youtube.com/watch?v=Bktd_Pi4YJw}}
   676 The whole point of the blockchain is that it public and will
   683 The whole point of the blockchain is that it public and will
   677 always be. 
   684 always be. 
   678 
   685 
   679 There are some precautions that are suggested, like to use a
   686 There are some precautions one can take for ensuring anonymity, like
   680 new public-private key pair for every new transaction, and to
   687 to use a new public-private key pair for every new transaction, and to
   681 access Bitcoin only through the Tor network. But the
   688 access Bitcoin only through the Tor network. But the transactions in
   682 transactions in Bitcoins are designed such that they allow one
   689 Bitcoins are designed such that they allow one to combine incoming
   683 to combine incoming transactions. In such cases we know they
   690 transactions. In such cases we know they must have been made by the
   684 must have been made by the single person who new the
   691 single person who knew the corresponding private keys. So using
   685 corresponding private keys. So using different public-private
   692 different public-private keys for each transaction might not actually
   686 keys for each transaction might not actually make the
   693 make the de-anonymisation task much harder. And the point about
   687 de-anonymisation task much harder. And the point about
   694 de-ano\-nymising `anonymous' social networks is that the information
   688 de-ano\-nymising `anonymous' social networks is that the
   695 is embedded into the structure of the transition graph. And this
   689 information is embedded into the structure of the transition
   696 cannot be erased with Bitcoins. 
   690 graph. And this cannot be erased with Bitcoins.
   697 
       
   698 One paper that has fun with spotting transactions to Silk Road (2.0)
       
   699 and to Wikileaks is
       
   700 
       
   701 \begin{center}
       
   702 \url{http://people.csail.mit.edu/spillai/data/papers/bitcoin-transaction-graph-analysis.pdf}
       
   703 \end{center}
       
   704 
       
   705 \noindent
       
   706 A paper that gathers some statistical data about the blockchain is
       
   707 
       
   708 \begin{center}
       
   709 \url{https://eprint.iacr.org/2012/584.pdf}
       
   710 \end{center}
       
   711 
       
   712 \subsubsection*{Government Meddling}
   691 
   713 
   692 Finally, what are the options for a typical western government
   714 Finally, what are the options for a typical western government
   693 to meddle with Bitcoins? This is of course one feature the
   715 to meddle with Bitcoins? This is of course one feature the
   694 proponents of Bitcoins also tout: namely that there aren't any
   716 proponents of Bitcoins also tout: namely that there aren't any
   695 options. In my opinion this is far too naive and far from the
   717 options. In my opinion this is far too naive and far from the
   703 \begin{itemize}
   725 \begin{itemize}
   704 \item The government could compel ``mayor players'' to
   726 \item The government could compel ``mayor players'' to
   705       blacklist Bitcoins (for example at Bitcoin exchanges).
   727       blacklist Bitcoins (for example at Bitcoin exchanges).
   706       This would impinge on what is called \emph{fungibility}
   728       This would impinge on what is called \emph{fungibility}
   707       of Bitcoins and make them much less attractive to
   729       of Bitcoins and make them much less attractive to
   708       baddies. Suddenly their hard-earned Bitcoin money cannot
   730       baddies. Suddenly their ``hard-earned'' Bitcoin money cannot
   709       be spent anymore.The attraction of this option is that
   731       be spent anymore.The attraction of this option is that
   710       this blacklisting can be easily done ``whole-sale'' and
   732       this blacklisting can be easily done ``whole-sale'' and
   711       therefore be really be an attractive target for
   733       therefore be really be an attractive target for
   712       governments \& Co.      
   734       governments \& Co.      
   713 \item The government could attempt to coerce the developer
   735 \item The government could attempt to coerce the developer
   727       \hspace{3mm}
   749       \hspace{3mm}
   728       \includegraphics[scale=0.031]{../pics/nsautah2.jpg}
   750       \includegraphics[scale=0.031]{../pics/nsautah2.jpg}
   729       \end{center}
   751       \end{center}
   730       
   752       
   731       this would not be such a high bar to jump over. Remember
   753       this would not be such a high bar to jump over. Remember
   732       it ``only'' takes to temporarily be in control of 50\%+
   754       it ``only'' takes to be temporarily in control of 50\%+
   733       of the mining capacity in order to undermine the trust
   755       of the mining capacity in order to undermine the trust
   734       in the system. Given sophisticated stories like Stuxnet
   756       in the system. Given sophisticated stories like Stuxnet
   735       (where we still not know the precise details) maybe even
   757       (where we still not know the precise details) maybe even
   736       such large facilities are not really needed. What
   758       such large facilities are not really needed. What
   737       happens, for example, if a government starts DoS attacks
   759       happens, for example, if a government starts DoS attacks
   753       the trust is undermined, the Bitcoin system would need
   775       the trust is undermined, the Bitcoin system would need
   754       to be evolved to Bitcoins 2.0. But who says that Bitcoin
   776       to be evolved to Bitcoins 2.0. But who says that Bitcoin
   755       2.0 will honour the Bitcoins from Version 1.0?
   777       2.0 will honour the Bitcoins from Version 1.0?
   756       \end{itemize} 
   778       \end{itemize} 
   757 
   779 
   758 \noindent Finally, a government would potentially not really
   780 \noindent A government would potentially not really
   759 need to follow up with such threads. Just the rumour that it
   781 need to follow up with such threads. Just the rumour that it
   760 would, could be enough to get the Bitcoin-house-of-cards to
   782 would, could be enough to get the Bitcoin-house-of-cards to
   761 tumble. Some governments have already such an ``impressive''
   783 tumble. Some governments have already such an ``impressive''
   762 trackrecord in this area, such a thread would be entirely
   784 trackrecord in this area, such a thread would be entirely
   763 credible. Because of all this, I would not have too much hope
   785 credible. Because of all this, I would not have too much hope
   764 that Bitcoins are free from government \& Co interference when
   786 that Bitcoins are free from interference by government \& Co when
   765 it will stand in its way, despite what everybody else is
   787 it will stand in their way, despite what everybody else is
   766 saying. To sum up, the technical details behind Bitcoins are
   788 saying. To sum up, the technical details behind Bitcoins are
   767 simply cool. But still the entire Bitcoin ecosystem is in my
   789 simply cool. But still the entire Bitcoin ecosystem is in my
   768 humble opinion rather fragile. 
   790 humble opinion rather fragile. 
   769 
   791 
   770 \subsubsection*{Further Reading}
   792 \subsubsection*{Further Reading}
   780 achieve rather impressive results, what could we achieve if
   802 achieve rather impressive results, what could we achieve if
   781 the UN, say, would find the money and incentivise people to,
   803 the UN, say, would find the money and incentivise people to,
   782 for example, solve protein folding
   804 for example, solve protein folding
   783 puzzles?\footnote{\url{http://en.wikipedia.org/wiki/Protein_folding}}
   805 puzzles?\footnote{\url{http://en.wikipedia.org/wiki/Protein_folding}}
   784 For this there are projects like
   806 For this there are projects like
   785 Folding@home\footnote{\url{http://folding.stanford.edu}}. 
   807 Folding@home.\footnote{\url{http://folding.stanford.edu}} 
   786 This might help with curing diseases such as Alzheimer or
   808 This might help with curing diseases such as Alzheimer or
   787 diabetes. The same point is made in the article
   809 diabetes. The same point is made in the article
   788 
   810 
   789 \begin{center}\small
   811 \begin{center}\small
   790 \url{http://gizmodo.com/the-worlds-most-powerful-computer-network-is-being-was-504503726}
   812 \url{http://gizmodo.com/the-worlds-most-powerful-computer-network-is-being-was-504503726}