Cover image for Mastering Bitcoin

Book description

If you are interested in learning more about the technical operation of bitcoin, or if you are building the next great bitcoin killer­app or business, you will find this book essential reading. From the basic use of a bitcoin wallet to buy a cup of coffee, to running a bitcoin marketplace with hundreds of thousands of transactions, or collaboratively building new financial innovations that will transform our understanding of currency and credit, this book will help you engineer money. You are about to unlock the API to a new economy. This book is your key.

Table of Contents

  1. Preface
    1. Writing the Bitcoin Book
    2. Intended Audience
    3. Early-Release Note
    4. Why Are There Bugs On The Cover?
    5. Conventions Used in This Book
    6. Using Code Examples
    7. Safari® Books Online
    8. How to Contact Us
    9. Quick Glossary
    10. Acknowledgments
      1. Early Release Draft (Github Contributions)
        1. (Name - Github ID)
  2. 1. Introduction
    1. What is Bitcoin?
    2. History of Bitcoin
    3. Bitcoin Uses, Users and Their Stories
    4. Getting Started
      1. Quick Start - Web Wallet
      2. Getting your first bitcoins
      3. Sending and receiving bitcoins
  3. 2. How Bitcoin Works
    1. Transactions, Blocks, Mining and the Blockchain
      1. Bitcoin Overview
      2. Buying a cup of coffee
    2. Bitcoin Transactions
      1. Common Transaction Forms
    3. Constructing A Transaction
      1. Getting the right inputs
      2. Creating the outputs
      3. Adding the transaction to the ledger
        1. Transmitting the transaction
        2. How it propagates
        3. Bob’s view
    4. Bitcoin Mining
    5. Mining transactions in blocks
    6. Spending the transaction
  4. 3. The Bitcoin Client
    1. Bitcoin Core - The Reference Implementation, aka Satoshi Client
      1. Bitcoin Core - Running the client for the first time
      2. Bitcoin Core - Compiling the client from the source code
    2. Using bitcoind from the command line
      1. Running bitcoind
      2. Wallet setup and encryption
      3. Wallet backup, plain-text dump and restore
      4. Wallet addresses and receiving transactions
      5. Exploring and decoding transactions
      6. Exploring blocks
      7. Creating, signing and submitting transactions based on unspent outputs
    3. Alternative clients, libraries and toolkits
      1. Libbitcoin and sx tools
        1. Installing sx
        2. Generating and manipulating keys with sxBitcoin Core
        3. Deterministic keys with sx
  5. 4. Keys, Addresses, Wallets
    1. Introduction
    2. Keys
      1. Public key cryptography and crypto-currency
      2. Private and Public Keys
      3. Private Keys
        1. Generating a private key from a random number
        2. New key with sx tools
      4. Public Keys
      5. Elliptic Curve Cryptography Explained
      6. Generating a public key
    3. Bitcoin Addresses
      1. Base58 and Base58Check Encoding
        1. Base-58 Encoding
        2. Base58Check Encoding
      2. Key Formats
        1. Private Key Formats
        2. Decode from Base58Check to Hex
        3. Encode from Hex to Base58Check
        4. Encode from Hex (Compressed Key) to Base58Check encoding
        5. Public Key Formats
        6. Compressed Public Keys
        7. Compressed Private Keys
    4. Implementing Keys and Addresses in Python
    5. Wallets
      1. Non-Deterministic (Random) Wallets
      2. Deterministic (Seeded)
      3. Mnemonic Code Words (BIP0039)
      4. Deterministic Chains (Electrum Key Chains)
      5. Deterministic Trees (BIP0032)
    6. Advanced Keys and Addresses
      1. Encrypted Private Keys (BIP0038)
      2. Pay To Script Hash (P2SH) and Multi-Sig Addresses
        1. Multi-signature addresses and P2SH
      3. Vanity Addresses
        1. Generating Vanity Addresses
        2. Vanity Address Security
      4. Paper Wallets
  6. 5. Transactions
    1. Introduction
    2. Transaction Lifecycle
      1. Creating Transactions
      2. Broadcasting Transactions to the Bitcoin Network
      3. Propagating Transactions on the Bitcoin Network
      4. Mining Transactions into Blocks
    3. Transaction Structure
    4. Transaction Outputs and Inputs
      1. Transaction Outputs
        1. Spending Conditions (Encumbrances)
      2. Transaction Inputs
      3. Transaction Fees
      4. Adding Fees to Transactions
    5. Transaction Scripts and Script Language
      1. Script Construction (Lock + Unlock)
      2. Scripting Language
      3. Turing Incompleteness
      4. Stateless Verification
    6. Standard Transactions
      1. Pay to Public Key Hash (P2PKH)
      2. Pay-to-Public-Key
      3. Mutli-Signature
      4. Data Output (OP_RETURN)
      5. Pay to Script Hash (P2SH)
        1. Pay-to-Script-Hash Addresses
        2. Benefits of Pay-to-Script-Hash
        3. Redeem Script and isStandard Validation
    7. Transaction Script Language Operators, Constants and Symbols
  7. About the Author
  8. Copyright