From e5b94a53d2ed406a9af7d48da95792c0a96c6f1b Mon Sep 17 00:00:00 2001 From: "Andreas M. Antonopoulos" Date: Mon, 7 Oct 2013 12:38:41 -0700 Subject: [PATCH] Chapter 0 draft, ready for review --- ch00.asciidoc | 118 ++++++++++++++++++++++++++++++++------------------ 1 file changed, 77 insertions(+), 41 deletions(-) diff --git a/ch00.asciidoc b/ch00.asciidoc index 1d9aa727..23831e14 100644 --- a/ch00.asciidoc +++ b/ch00.asciidoc @@ -5,14 +5,49 @@ ((("bitcoin"))) Bitcoin is digital money, a currency for and of the Internet. Bitcoin can be used to buy products or services online or in-person, just like cash or a credit card. Bitcoin can be transmitted as fast as an email from any person to any other person just by installing the software. Bitcoin is de-centralized: There is no central entity, not a bank or governing body that controls bitcoin. It operates by consensus, according to simple mathematical rules that are in the software for all to see. +Behind the scenes, bitcoin is a network, a protocol, a standard and a currency. For now think of it simply as digital money that can be sent, received and stored by anyone, worldwide simply by downloading compatible software and joining a network. -Bitcoin is not owned or controlled by any company, group or country. It exists as a set of standards and reference software and as a running network with several thousand nodes worldwide. Behind the scenes, bitcoin is a network, a protocol, a standard and a currency. For now think of it simply as digital money that can be sent, received and stored by anyone, worldwide simply by downloading compatible software and joining a network. - - -Under the hood, bitcoin is the culmination of decades of research in cryptography and distributed systems and represents four key innovations brought together in a unique and powerful combination. Bitcoin consists of a de-centralized peer-to-peer network, a public transaction ledger, a de-centralized mathematical and deterministic currency issuance, a de-centralized transaction verification system and a set of powerful APIs. All of these are "bitcoin", and each of these aspects of bitcoin will be examined in this book. +Bitcoin is the culmination of decades of research in cryptography and distributed systems and represents four key innovations brought together in a unique and powerful combination. Bitcoin consists of a de-centralized peer-to-peer network, a public transaction ledger, a de-centralized mathematical and deterministic currency issuance, a de-centralized transaction verification system and a set of powerful APIs. All of these are "bitcoin", and each of these aspects of bitcoin will be examined in this book. More than all of these parts, bitcoin is a digital economy platform, just like the Internet is a digital communications platform. With bitcoin, it is possible to build entire new financial systems, transaction types and economies on top of a purely digital, instantaneous and frictionless platform, an Internet for money. +=== History of bitcoin + +==== A brief history of money + +Money is a means of transferring or storing wealth, at its most basic. It exists in many abstract forms, least abstract (food) to highly abstract (personal cheque). Money has existed for thousands of years. The earliest form of money, recorded as an abstract account of value in written form, is heads of cattle. This is also the origin of the word "capital". Of course, a cow is not abstract, you can eat it. Very early in recorded history we see the emergence of money as an abstract token that represents some other value. Various cultures have used shells, coconuts, beans, salt, spices, feathers etc. These abstract forms of money may hold no inherent value but act only as a representation of value. Abstract forms of money are usually: + +* Lightweight and portable +* Hard to counterfeight +* Scarce in the local environment (doesn't grow on trees) +* Fungible (each unit is indistinguishable and interchangeable with another, a penny is a penny) + +((("precious metals"))) +Precious metals have been the predominant currency for thousands of years across the world, usually stamped into coins. Modern paper money started as representative of precious metal deposits, but is now representative of treasury debt issued by the central governments. National currencies are issued by government "fiat" and are commonly referred to as _fiat currencies_ by economists. Most of what we consider common features of our monetary system are really only recent inventions, of the late 20th century. While precious metals are excellent for storing value they are easier to counterfeit (alloys) and not lightweight or portable in large quantities. + +Digital money appeals to many people because it tends to combine some of the characteristics of precious metals (fungible, scarce, store of value) with the characteristics of paper money instruments (lightweight, hard to copy). In the past, currencies represented a compromise of sorts between the various desired characteristics of money. Bitcoin appeals to many as it is seen to be "no compromise" money. + +=== History of Cryptographic-Currencies +((("crypto-currency"))) + +Cryptographic currencies depend on cryptography to control the ownership of a piece of digital data. Using cryptographic digital signatures, a user can sign a digital asset or transaction and securely prove the ownership of that asset. + +Since the late 1980s when cryptography started becoming more broadly available and understood, many researchers started trying to use cryptography to build digital currencies. These early digital currency projects issued digital money, usually backed by a national currency or precious metal such as gold. + +While these earlier digital currencies worked, they had several fatal flaws. Firstly, early digital currencies used a central clearinghouse to settle all transactions at regular intervals, just like a traditional banking system. Secondly, these central clearinghouses and the organizations issuing the digital currency, were highly centralized organizations, usually corporations. Unfortunately, in most cases these nascent digital currencies were targetted by worried governments and eventually litigated to death. + +Bitcoin's major breakthrough is the removal of any central authority or clearinghouse. Bitcoin is decentralized by design and does not have a central issuer or clearinghouse. It is the first fully decentralized digital currency. To achieve this amazing feat, bitcoin has replace the need for a central clearinghouse with a form of distributed _consensus_ based on participants proving they are contributing to the network security via a _proof-of-work_ algorithm. + +The result of this deliberate decentralization is that bitcoin has removed two major areas of risk for digital currencies: + +* Third Party Risk - Counterparty Risk + +When a transaction occurs in a traditional financial payment network there are at least three parties to the transaction: the buyer, seller, and counteparty clearing house. This introduces a source of risk in the system - counterparty risk. Buyers and seller must not only trust each other, but also trust the central clearinghouse. With national currencies the central clearinghouse is the central bank and is therefore inextricably connected to the political process. Trust in the counterparty (central bank) is simply an extension of trust in the government and democratic process. Where digital currencies struggled to create the clearinghouse and imbue it with trust, bitcoin completely removes the need for counterparty trust by removing the counterparty. + +* External Risks + +All world currencies today are controlled by sovereign nation states. This control has significant political and economic benefits and is, of course, zealously protected. As a result, attempts to create competing and independent digital currencies, have quickly come under legal, or sometimes extra-legal, attack. Without a central organization, clearinghouse or controlling authority, bitcoin is not easy to attack. It is resilient to interference because control of the network and security of the currency is distributed as much as possible. + ==== Quick Glossary bitcoin:: @@ -36,19 +71,19 @@ secret key (aka private key):: transaction:: ((("transaction"))) - A transfer of bitcoins from one address to another. + In simple terms, a transfer of bitcoins from one address to another. More precisely, a transaction is a signed data structure expressing a transfer of value. Transactions are transmitted over the bitcoin network, collected by miners and included into blocks, made permanent on the blockchain. hash:: ((("hash"))) - A digital fingerprint of some binary input + A digital fingerprint of some binary input. block:: ((("block"))) - A grouping of transactions, marked with a timestamp, and a fingerprint of the previous block. The block header is hashed to find a proof-of-work, thereby validating the transactions. + A grouping of transactions, marked with a timestamp, and a fingerprint of the previous block. The block header is hashed to find a proof-of-work, thereby validating the transactions. Valid blocks are added to the main blockchain by network consensus. network:: ((("network"))) - A peer-to-peer network that propagates transactions and blocks among all nodes + A peer-to-peer network that propagates transactions and blocks among all nodes. blockchain:: ((("blockchain"))) @@ -268,28 +303,14 @@ Due to restrictions by Apple, there are no wallet applications for iOS. However, ===== Web wallets -TBD +Web wallets are bitcoin wallets that are offered as a service by various online providers. These web wallets may be held by the online service, in which case the security of the funds depends entirely on that online service provider. This is very similar to a traditional banking environment where a third party has control and maintains security over your funds. However, unlike traditional banking these companies are rarely regulated. Therefore, web wallets should be used with caution. -Risks? Control? +Web wallets are extremely convenient for new users and a great way to introduce someone to bitcoin. However, they should not be used to store large amounts of value without taking security measures, most importantly two-factor authentication. Web wallets are vulnerable to hacks and also to remote compromise via trojans or key-loggers on your own desktop computer. Many users have lost bitcoin because their account was accessed from an insecure and compromised computer, which subsequently activated an unauthorized withdrawal. - -=== History of bitcoin - -==== A brief history of money - -Money is a means of transferring or storing wealth, at its most basic. It exists in many abstract forms, least abstract (food) to highly abstract (personal cheque). Money has existed for thousands of years. The earliest form of money, recorded as an abstract account of value in written form, is heads of cattle. This is also the origin of the word "capital". Of course, a cow is not abstract, you can eat it. Very early in recorded history we see the emergence of money as an abstract token that represents some other value. Various cultures have used shells, coconuts, beans, salt, spices, feathers etc. These abstract forms of money may hold no inherent value but act only as a representation of value. Abstract forms of money are usually: - -* Lightweight and portable -* Hard to counterfeight -* Scarce in the local environment -* Fungible - -((("precious metals"))) -Precious metals have been the predominant currency for thousands of years across the world, usually stamped into coins. Modern paper money started as representative of precious metal deposits, but is now representative of treasury debt issued by the central governments. National currencies are issued by government "fiat" and are commonly referred to as _fiat currencies_ by economists. Most of what we consider common features of our monetary system are really only recent inventions, of the late 20th century. - -==== A brief history of crypto currencies -((("crypto-currency"))) -Crypto-currencies are digital currencies based on cryptography. The development of crypto currencies started in ...... Essentially, crypto currencies aim to achieve an entirely abstract digital currency, one whose value can be transmitted digitally to a party as payment itself. There are two core challenges with a purely digital currency: how do you control the creation of new currency units and how do you prevent copying or counterfeiting. +[TIP] +==== +Always use two-factor authentication on online wallets. The risk of compromise by key-logger or compromized desktop is very high. Additionally, do not store all your bitcoin online or in a single wallet, instead spread the risk a bit. +==== ==== Public key cryptography and crypto-currency ((("public key"))) @@ -297,18 +318,6 @@ Public-key cryptography, or assymetric cryptography, is a key part of a crypto-c In a nutshell, public-key cryptography is like a digital padlock, which can only be opened by the owner of a secret key. The owner of that key can hand out as many copies of the padlock as they want, and others can use it to "lock" bitcoins inside transactions recorded on the blockchain. Only the owner of the key can then unlock and "redeem" these transactions, as only they can open the digital padlock. -In more specific terms, bitcoin uses Elliptic Curve Cryptography (ECC) on the secp256k1 curve, defined by http://www.secg.org/index.php?action=secg,docs_secg[SEC 2: Recommended Elliptic Curve Domain Parameters version 2.0]. The name secp256k1 indicates a curve whose points are a prime field, with a 256-bit prime and the k indicating a Koblitz curve variant. - -The end-user, or the wallet application they are using, will generate a new key-pair using a random seed. The key pair consists of a secret part the _private key_ and a public part, the _public key_. - -In bitcoin, the public key is represented as a _bitcoin address_, which looks like this **`1HvHT6B3ZVT8nWCdVx3CKr8PRUMCNhZTqD`**. - -The address itself is encoded in a format known as +Base58Check+, which is +Base58+ with a checksum. Base58 encoding is similar to a commonly used +Base64+ encoding used in HTTP and other protocols, but with a reduced 58-character set, removing ambiguous characters such as +O,0,o,I,i,l,1|+. - -The Base58Check address includes a checksum, composed of the last 4 digits of the SHA256 of the address, appended to the address. The resulting 27-34 character string starts with the number **`1`**, which is the "main" network prefix. We will see examples of other prefixes on addresses, such as **`3`** for the test-net bitcoin test network as well as those denoting alternative crypto-currencies. - -By sharing this bitcoin address (eg. 1HvHT6B3ZVT8nWCdVx3CKr8PRUMCNhZTqD), the owner of this address can request payments from others. When others "send" bitcoin to this address, essentially they are creating a transaction assigning ownership of pre-existing bitcoin in the blockchain to this address. This makes it possible for the owner of this address to create future transactions "spending" some or all of those pre-existing bitcoins, by using the secret key to sign a spending transaction. - ==== Peer-to-Peer networks ((("peer-to-peer"))) @@ -324,6 +333,30 @@ The bitcoin network essentially carries two types of data: unconfirmed transacti A new bitcoin client can join the network and request any block, reconstructing the blockchain from the first (Genesis) block, all the way to the most recently mined block. Since each client also contains a static digital copy of the first block embedded in the source code, it can independently verify the entire blockchain. For example, a new client would request block with height "1", and verify that it is correct and contains the correct signature for block "0", the genesis block. Now, the client has bootstrapped the blockchain, independently verifying block "1", and now has a blockchain of height "1". From here, the client can request a block with height "2" from the network. If that can be validated as a valid block that can be added, then the blockchain is confirmed to height "2" etc. After a day or more, several hundred thousand blocks later, the network node can catch up and find that it has the same height as the majority of the network. Since the node has independently verified all of the blocks, it can confirm each transaction and bitcoin ever spent as valid without reference to any external authority. The only block trusted is the genesis block embedded within, the rest of the trust is derived experientially and independently. +=== Finite monetary supply + +Bitcoins are "minted" during the creation of each block at a fixed and diminishing rate. Each block, generated on average every 10 imnutes, contains a _reward_ that consists of entirely new bitcoins. The reward was 50BTC for the first four years of operation of the network. Every four years the reward is decreased by 50%, resulting in a dimishing rate of issuance over time. In 2012, the reward was decreased to 25BTC and it will decrease again to 12.5BTC in 2016. By approximately 2140, the last fragments of a bitcoin will be mined, for a total of 21 million bitcoins. + +The algorithm that constrains bitcoin issuance to a geometrically decreasing curve, was modelled after the diminishing returns of mining for precious metals like gold, which are more and more difficult (costly) to extract over time. + +The finite and diminishing issuance creates a fixed monetary supply that resists inflation. Unlike a fiat currency which can be printed in infinite numbers by a central bank, bitcoin can never be inflated by printing. + +==== Monetary supply + +Bitcoin's monetary supply is defined as the number of coins in circulation (minted). Like any other currency, this measure of monetary supply is called M0, which represents the narrowest measure of the money supply. Just like any other currency, bitcoin can also have a _fractional reserve banking_ which means that an organization can trade bitcoins "off blockchain" which are not part of the M0 monetary measure, but of the broader monetary supply measures M1-M3. + +While the total bitcoins in circulation will not exceed 21m, that monetary base can support a much broader economy through fractional reserve banking and expansion of the available credit. + +=== Divisibility and deflation + +The most important and debated consequence of a fixed and diminishing monetary issuance is that the currency will tend to be inherently _deflationary_. Deflation is the phenomenon of appreciation of value due to a mismatch in supply and demand that drives up the value (and exchange rate) of a currency. The opposite of inflation, price deflation means that your money has more purchasing power over time. + +Many economists argue that a deflationary economy is a disaster that should be avoided at all costs. That is because in a period of rapid deflation, the incentives for regular people are to hoard the money and not spend it, hoping that prices will fall. Such a phenomenon unfolded during Japan's "Lost Decade", when a complete collapse of demand pushed the currency into a deflationary spiral. + +Bitcoin experts argue that deflation is not bad *per se*. Rather, we associate deflation with a collapse in demand because that is the only example of deflation we have to study. In a fiat currency with the possibility of unlimited printing, it is very difficult to enter a deflationary spiral unless there is a complete collapse in demand and an unwillingness to print money. Deflation in bitcoin is not caused by a collapse in demand, but by predictably constrained supply. + +In practice, it has become evident that the hoarding instinct caused by a deflationary currency can be overcome by discounting from vendors, until the discount overcomes the hoarding instinct of the buyer. Since the seller is also motivated to hoard, the discount becomes the equilibrium price at which the two hoarding instincts are matched. With discounts of 30% on the bitcoin price, most bitcoin retailers are not experiencing difficulty overcoming the hoarding instinct and generating revenue. It remains to be seen whether the deflationary aspect of the currency is really a problem when it is not driven by rapid economic retraction. + ==== Why would I use bitcoin ===== As a merchant @@ -333,13 +366,16 @@ Bitcoin's transaction fees are relatively flat and extremely low, compared to tr Unlike traditional payment systems, bitcoin offers irreversible payments. Once a transaction is confirmed in the blockchain, the bitcoins are locked with the merchant keys and _cannot_ be reversed by anyone. This is especially important for merchants who operate online or shipping-based businesses, where a reversed charge on shipped merchandise is a significant and recurring problem. ===== As a consumer + +Bitcoin is a tremendously useful currency. It offers consumers the ability to operate their own bank account, which is global in scope and entirely controlled by the user. Consumers can use their bitcoin anywhere in the world, instantly and with very low fees, without revealing their identity or providing pages and pages of personal information just to buy a product. A bitcoin user can also transmit bitcoin to a friend or family member, instantly and anywhere in the world without the need for bank accounts, expensive wire transfers or the permission of their government. + ===== As a developer, integrator Bitcoin is a developer's paradise. Where traditional banking and payment systems depend on exclusion as the means of securing the systems, bitcoin uses computation as the basis for its trust model. As a result, the network, protocol, transaction language and APIs are completely open and anyone can interact with the entire bitcoin system at any level. There is a wealth of progrmmatic interfaces at every layer, allowing developers and integrators to mash, code, hack and interface with bitcoin's internals. ===== As an entrepreneur -Bitcoin represents a new frontier, and they need everything (quote) +TBD ===== As an investor