[[ch02_bitcoin_overview]]
== How Bitcoin Works

=== Transactions, Blocks, Mining and the Blockchain

Bitcoin is a system based on de-centralized trust, which means that there is no central trusted authority, but instead trust is achieved as an emergent property from the interactions of different participants in the bitcoin system. In this chapter we will examine bitcoin from a high-level by tracking a single transaction through the bitcoin system and watch as it becomes "trusted" and accepted by the bitcoin mechanism of distributed consensus. 

==== Bitcoin Overview

At a high level, the bitcoin system consists of users with wallets containing keys, transactions which are propagated across the network and miners who produce (through competitive computation) the consensus blockchain, the authoritative ledger of all transactions. 

[[blockchain-mnemonic]]
.Bitcoin Overview
image::images/Bitcoin Overview.png["Bitcoin Overview"]

==== A simple transaction

Alice, who we introduced in the previous chapter, is a new user who has just acquired her first bitcoin. Now she will make her first retail transaction, buying a cup of coffee at Bob's coffee shop in Palo Alto, California. Bob's coffee shop recently started accepting bitcoin payments, as advertised by a sign declaring _"Bitcoin Accepted Here"_ in the window. At the counter, the prices are listed in the local currency (US dollars) but at the register, customers have the option of paying in either dollars or bitcoin. Alice places her order for a cup of coffee and Bob enters the transaction on his point-of-sale system that has been adapted to convert each price to bitcoins at the prevailing market rate. The register displays the prices in both currencies, as well as showing a QR code containing a payment request for this transaction:


----
Total:
$1.50 USD
0.015 BTC
----

Bob says _"That's one-dollar-fifty, or fifteen milibits"_.

Alice uses her smartphone to scan the barcode on display. Her smartphone shows a payment of +0.0150 BTC+ to +Bob's Cafe+ and she selects +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.

