1
0
mirror of https://github.com/bitcoinbook/bitcoinbook synced 2024-11-23 00:28:14 +00:00
bitcoinbook/ch00.asciidoc

209 lines
16 KiB
Plaintext
Raw Normal View History

[[ch00_intro_what_is_bitcoin]]
== Introduction
2013-07-29 21:26:15 +00:00
=== What is Bitcoin?
2013-08-11 23:20:38 +00:00
Bitcoin is digital money, a currency for and of the Internet. More specifically, bitcoin is digital cash, the value itself encoded digitally and transferred from owner to owner.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other money is digital too, but different - third party, counterparty risk.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
It 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.
2013-07-29 23:12:02 +00:00
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.
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.
2013-08-03 20:39:56 +00:00
=== Stories
It is easiest to experience bitcoin from the perspective of a few specific stories that we will explore in detail throughout the book.
Each story represents a specific real use of bitcoin in different contexts.
==== Alice buys a cup of coffee from Bob's Cafe
Alice wants to buy a cup of coffee using bitcoin. She visits Bob's Cafe, a coffee shop that accepts bitcoin payments, as advertised by a sign declaring _"Bitcoin Accepted Here"_ in the window. At the counter, the prices may be listed in a local currency like Euros or Dollars. At the register, Bob would ring up a coffee, displaying
----
Total:
$1.50 USD
0.015 BTC
----
Or Bob might say _"That's one-dollar-fifty, or fifteen milibits"_.
Alice would use a smartphone to scan the barcode on display and send the payment. Her smartphone would show a payment of +0.0150 BTC+ to +Bob's Cafe+ and she would select +Send+ to authorize the payment. Within a few seconds (about the same time as a credit card authorization), Bob would see the transaction on the register, completing the transaction. Alice has purchased a cup of coffee for 15 millibits (or 0.015 bitcoin)
2013-08-03 20:46:00 +00:00
[TIP]
====
In the USA, it is customary to tip 20% for good service at coffee shops. Alice may choose to tip in dollars, or may add bitcoin.
====
2013-07-29 21:26:15 +00:00
==== A currency
2013-07-29 23:12:02 +00:00
2013-08-11 23:20:38 +00:00
Bitcoin is a currency, the operates much like any "foreign" currency. The main difference is that it is not issued by a national government. Bitcoin currency units are called "bitcoins". Unlike traditional currencies, bitcoins are divisible to much smaller units. The smallest unit is the _satoshi_, one hundred-millionth of a bitcoin (1/100,000,000). Bitcoin can be exchanged for other currencies at specialized currency exchanges that support crypto-currencies like bitcoin. There, a customer can exchange US dollars ($) or Euros (€) for bitcoin, at the prevailing market exchange rate.
Symbols: B⃦, Ƀ, ฿
Currency Code: BTC (unofficial), XBT (possible ISO standard)
[[table_bitcoinunits]]
[options="header"]
|=======
| Unit Name | Notation | Value
| bitcoin | BTC or B⃦ | 1 BTC
| millibitcoin | mBTC or mB⃦ | 0.001 BTC or 1/1000th
| microbitcoin | μBTC or μB⃦| 0.000001 BTC or 1/1m
| satoshi | | 0.00000001 BTC or 1/100m
|=======
2013-08-03 20:39:56 +00:00
2013-08-11 23:20:38 +00:00
Table of bitcoin units from bitcoin wiki (link:$$https://en.bitcoin.it/wiki/Units$$[])
2013-07-29 23:12:02 +00:00
2013-07-29 21:26:15 +00:00
==== A network and protocol
2013-07-29 23:12:02 +00:00
2013-08-03 20:39:56 +00:00
Bitcoin operates on top of a peer-to-peer network, also called "bitcoin". The bitcoin network is used to propagate transactions, new blocks and alert messages. The network operates using a relatively simple network protocol for peer discovery and blockchain replication.
One interesting feature of bitcoin is that the issuance of the currency decreases automatically over time, halving every four years, reaching an absolute maximum of 21 million bitcoins issued sometime around the year 2140.
[[chart_bitcoin_decreasing_issuance]]
Chart of decreasing issuance over time
==== Transactions
People can pay for goods and services using bitcoin as the currency.
Bitcoin transactions, which transfer value from one bitcoin address to another, are recorded in a distributed ledger, called the _blockchain_. In simple terms, think of the ledger as a book with lines like this:
----
A gives 1 bitcoin to B
C gives 2 bitcoin to D
----
The ledger is a record of all bitcoin transactions and can be independently verified by every node.
2013-08-05 18:39:21 +00:00
==== The blockchain
2013-07-29 23:12:02 +00:00
2013-08-05 18:39:21 +00:00
Bitcoin's core innovation is the _blockchain_, a distributed, timestamped ledger. The ledger consists of a cryptographically verified chain of _blocks_, each of which contains transactions, new coins and a signature (hash) of the previous block. Each full bitcoin node in the network will keep a complete local replica of the blockchain, and independently verify all transactions and balances from that replica.
2013-08-03 20:39:56 +00:00
2013-08-05 18:39:21 +00:00
==== Mining for blocks
Bitcoin's security is underpinned by computation. The blockchain is formed by solving a problem, called the _proof-of-work_ (PoW) that requires a predictable computational effort, one that takes approximately 10 minutes for the entire network of bitcoin nodes to solve. The process is called _mining_, since it has diminishing returns, just like mining for precious metals. It works a bit like a global lottery, where every bitcoin miner attempts to find a solution to a cryptographic equation. The first miner to find a solution, broadcasts it on the peer-to-peer bitcoin network for others to verify and include in the blockchain. For any transaction to be included in the global blockchain, it must be verified and included inside a new block. Each block includes the fingerprint of the previous block int he chain and any new transactions that have occured in the intervening 10 minutes.
When a bitcoin miner discovers a new solution to the proof of work algorithm, they create a new block which includes newly minted bitcoin in a transaction that pays to the miner's own bitcoin address. Bitcoin miners earn the newly minted bitcoin as a reward by creating a transaction to pay themselves. They can do this only if they discover a solution to the proof-of-work problem, thus providing an incentive to participate in mining and thereby to computationally secure the transactions.
Essentially, the bitcoin currency units are issued through mining, just like a central bank issues new money by printing bank notes. The amount of newly created bitcoin in each block decreases every four years. It started at 50 bitcoin per block in 2008 and halved to 25 bitcoin per block in 2012. It will halve again to 12.5 bitcoin per block in 2016. Based on this formula, bitcoin mining rewards decrease exponentially until approximately 2140 when all 21 million bitcoin have been issued.
Bitcoin miners also earn fees from transactions. Every transaction may include a transaction fee, in the form of a surplus of bitcoin between the transaction's inputs and outputs. The bitcoin miner gets to "keep the change" on the transactions.
At the time of writing this, the fees usually represent 1% or less of a bitcoin miner's income, the vast majority coming from the newly minted bitcoins. However, as the reward decreases over time, a greater proportion of bitcoin mining earnings will come from fees, until after 2140 all bitcoin miner earnings will be in the form of transaction fees.
2013-07-29 23:12:02 +00:00
2013-08-03 20:39:56 +00:00
2013-07-29 21:26:15 +00:00
==== A transaction language
2013-07-29 23:12:02 +00:00
2013-08-05 18:39:21 +00:00
A simple bitcoin transaction transfers value from one bitcoin address to another. However, there is much more to bitcoin transactions than that. Each transaction is a signed script that is evaluated using a stack-based interpreter. The language of transactions is Forth-like and not Turing-complete as it does not include looping constructs.
A transaction script can make a bitcoin payment payable to the owner of a bitcoin address, to multiple bitcoin addresses, to anyone who solves a riddle, to anyone who guesses a number or to infinitely more complex requirements.
The transaction script language is extremely powerful and can be used to express very complex and novel transactions. It is examined in more detail in <<complex_transactions>>.
==== An Application Programming Interface (API)
The reference bitcoin software implementation, known as the _Satoshi Client_ and with the application name +bitcoin-qt+ or +bitcoind+, offers a client-level API. The API is available as a JSON/RPC interface and offers programmatic access to bitcoin wallets, th blockchain and the bitcoin network.
2013-07-29 21:26:15 +00:00
=== Getting Bitcoin
2013-08-11 23:20:38 +00:00
There are many different implementations of bitcoin, from the front-end user interface to various libraries, servers and bitcoin network nodes.
The reference implementation of bitcoin, which combines a full bitcoin network node, a wallet and a user interface is known as the _Satoshi Client_, or also as its executable name +bitcoind+ on Unix-like systems and +bitcoin-qt+ for the graphical user interface component. The Satoshi client is maintained by a network of volunteers as an open source project hosted on Github link:$$https://github.com/bitcoin/bitcoin$$[].
==== Full node client or lightweight client?
A full node client is one that stores a local copy of the entire blockchain (the distributed transaction ledger), from the first block (the _Genesis Block_) to the most current block. The blockchain is usually stored in a database, to make indexing and retrieval easier. It is a multi-gigabyte file, at least 8GB at this time. As a result, a full-node client may take several days and quite a bit of disk space to become fully "synchronized" with the network, meaning it has downloaded a full copy of the blockchain up to the most recent block.
By comparison, a lightweight client does not store a full copy of the blockchain. Instead, it relies on selected trusted servers which can answer queries about the blockchain. As a result, a lightweight client can bootstrap instantly and start processing transactions. However, a lightweight client is always reliant on an external trusted source of data on the blockchain, whereas a full node client can independently validate any transaction without trusted third parties or the counterparty risks they introduce.
==== Desktop, mobile, web or hybrid wallet?
Bitcoin clients exist in many forms, and for many platforms. The examples in this book will use the reference client as well as several other desktop, mobile and web examples. For practical bitcoin use you may want to try a desktop, mobile and web wallet, or a web/mobile hybrid.
[TIP]
============================================================================
For the purposes of following the examples in this book, we recommend you download and install several bitcoin clients, to compare their capabilities and try out the examples. You must at least download the reference client +bitcoin+, as well as a lightweight client such as Electrum, or Multibit.
============================================================================
2013-07-29 21:26:15 +00:00
==== Obtaining the bitcoin software
2013-08-11 23:20:38 +00:00
===== Reference Client
Versions for Windows, Mac, Linux and source code can be found at link:$$http://bitcoin.org/en/download$$[]
===== Mobile client
On Android, you can find many bitcoin clients by searching for "bitcoin wallet" in the official application market. The most notable are:
* Andreas Shildbach's Android Bitcoin Wallet link:$$https://play.google.com/store/apps/details?id=de.schildbach.wallet$$[]
* Mycelium light-weight node link$$https://play.google.com/store/apps/details?id=com.mycelium.wallet$$[]
* Blockchain.info hybrid web/mobile wallet link:$$https://play.google.com/store/apps/details?id=piuk.blockchain.android$$[]
Due to restrictions by Apple, there are no wallet applications for iOS. However, you can use web wallets in your iOS browser.
===== Web wallets
TBD
Risks? Control?
2013-07-29 21:26:15 +00:00
=== History of bitcoin
2013-07-29 21:26:15 +00:00
==== A brief history of money
2013-08-11 23:20:38 +00:00
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
* etc
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.
2013-07-29 21:26:15 +00:00
==== A brief history of crypto currencies
2013-08-11 23:20:38 +00:00
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.
2013-07-29 21:26:15 +00:00
==== Public key cryptography and crypto-currency
2013-08-11 23:20:38 +00:00
Public-key cryptography, or assymetric cryptography, solves a key problem of a purely digital currency, by allowing /..../
2013-07-29 21:26:15 +00:00
==== Peer-to-Peer networks
2013-08-05 18:39:21 +00:00
2013-08-11 23:20:38 +00:00
2013-07-29 21:26:15 +00:00
==== Why would I use bitcoin
2013-08-11 23:20:38 +00:00
2013-07-29 21:26:15 +00:00
===== As a merchant
2013-08-11 23:20:38 +00:00
Bitcoin's transaction fees are relatively flat and extremely low, compared to traditional payment networks. The current fee implementation is based on the size of a transaction's storage entry in the blockchain in bytes, with most transactions simply accepting the minimum fee of 0.5 millibits, or approximately 5 US cents at the time of writing, much lower than any other payment system.
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.
2013-07-29 21:26:15 +00:00
===== As a consumer
===== As a developer, integrator
2013-08-11 23:20:38 +00:00
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.
2013-07-29 21:26:15 +00:00
===== As an entrepreneur
2013-08-11 23:20:38 +00:00
Bitcoin represents a new frontier, and they need everything (quote)
===== As an investor
Bitcoin is a strange assrt class. It's not exactly a commodity, a currency, a stock or a fund. It is a bit of all of those and more, an asset class unto itself. Furthermore, there are other crypto-currencies and they can be traded for each other. Crypto currencies are a whole new world of asset classes that underpin independent and low-friction online economies.