Mastering Bitcoin

Book description

Want to join the technological revolution that’s taking the world of finance by storm? Mastering Bitcoin is your guide through the seemingly complex world of bitcoin, providing the requisite knowledge to help you participate in the internet of money. Whether you’re building the next killer app, investing in a startup, or simply curious about the technology, this practical book is essential reading.

Publisher resources

View/Submit Errata

Table of contents

  1. Praise for Mastering Bitcoin
  2. Preface
    1. Writing the Bitcoin Book
    2. Intended Audience
    3. Why Are There Bugs on the Cover?
    4. Conventions Used in This Book
    5. Code Examples
    6. Using Code Examples
    7. Safari® Books Online
    8. How to Contact Us
    9. Acknowledgments
      1. Early Release Draft (GitHub Contributions)
  3. Quick Glossary
  4. 1. Introduction
    1. What Is Bitcoin?
    2. History of Bitcoin
    3. Bitcoin Uses, Users, and Their Stories
    4. Getting Started
      1. Quick Start
      2. Getting Your First Bitcoins
      3. Sending and Receiving Bitcoins
  5. 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
  6. 3. The Bitcoin Client
    1. Bitcoin Core: The Reference Implementation
      1. Running Bitcoin Core for the First Time
      2. Compiling Bitcoin Core from the Source Code
    2. Using Bitcoin Core’s JSON-RPC API from the Command Line
      1. Getting Information on the Bitcoin Core Client Status
      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 Bitcoin Explorer
        1. Installing Bitcoin Explorer
        2. Installing Libbitcoin
      2. pycoin
      3. btcd
        1. Installing btcd
        2. Controlling btcd
  7. 4. Keys, Addresses, Wallets
    1. Introduction
      1. Public Key Cryptography and Cryptocurrency
      2. Private and Public Keys
      3. Private Keys
        1. Generating a private key from a random number
      4. Public Keys
      5. Elliptic Curve Cryptography Explained
      6. Generating a Public Key
    2. Bitcoin Addresses
      1. Base58 and Base58Check Encoding
      2. Key Formats
        1. Private key formats
        2. Decode from Base58Check
        3. Encode from hex to Base58Check
        4. Encode from hex (compressed key) to Base58Check
        5. Public key formats
        6. Compressed public keys
        7. Compressed private keys
    3. Implementing Keys and Addresses in Python
    4. Wallets
      1. Nondeterministic (Random) Wallets
      2. Deterministic (Seeded) Wallets
      3. Mnemonic Code Words
      4. Hierarchical Deterministic Wallets (BIP0032/BIP0044)
        1. HD wallet creation from a seed
        2. Private child key derivation
        3. Using derived child keys
        4. Extended keys
        5. Public child key derivation
        6. Hardened child key derivation
        7. Index numbers for normal and hardened derivation
        8. HD wallet key identifier (path)
        9. Navigating the HD wallet tree structure
        10. Experimenting with HD wallets using Bitcoin Explorer
    5. 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
  8. 5. Transactions
    1. Introduction
    2. Transaction Lifecycle
      1. Creating Transactions
      2. Broadcasting Transactions to the Bitcoin Network
      3. Propagating Transactions on the Bitcoin Network
    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 Chaining and Orphan Transactions
    6. Transaction Scripts and Script Language
      1. Script Construction (Lock + Unlock)
      2. Scripting Language
      3. Turing Incompleteness
      4. Stateless Verification
    7. Standard Transactions
      1. Pay-to-Public-Key-Hash (P2PKH)
      2. Pay-to-Public-Key
      3. Multi-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
  9. 6. The Bitcoin Network
    1. Peer-to-Peer Network Architecture
    2. Nodes Types and Roles
    3. The Extended Bitcoin Network
    4. Network Discovery
    5. Full Nodes
    6. Exchanging “Inventory”
    7. Simplified Payment Verification (SPV) Nodes
    8. Bloom Filters
    9. Bloom Filters and Inventory Updates
    10. Transaction Pools
    11. Alert Messages
  10. 7. The Blockchain
    1. Introduction
    2. Structure of a Block
    3. Block Header
    4. Block Identifiers: Block Header Hash and Block Height
    5. The Genesis Block
    6. Linking Blocks in the Blockchain
    7. Merkle Trees
    8. Merkle Trees and Simplified Payment Verification (SPV)
  11. 8. Mining and Consensus
    1. Introduction
      1. Bitcoin Economics and Currency Creation
    2. Decentralized Consensus
    3. Independent Verification of Transactions
    4. Mining Nodes
    5. Aggregating Transactions into Blocks
      1. Transaction Age, Fees, and Priority
      2. The Generation Transaction
      3. Coinbase Reward and Fees
      4. Structure of the Generation Transaction
      5. Coinbase Data
    6. Constructing the Block Header
    7. Mining the Block
      1. Proof-Of-Work Algorithm
      2. Difficulty Representation
      3. Difficulty Target and Retargeting
    8. Successfully Mining the Block
    9. Validating a New Block
    10. Assembling and Selecting Chains of Blocks
      1. Blockchain Forks
    11. Mining and the Hashing Race
      1. The Extra Nonce Solution
      2. Mining Pools
        1. Managed pools
        2. P2Pool
    12. Consensus Attacks
  12. 9. Alternative Chains, Currencies, and Applications
    1. A Taxonomy of Alternative Currencies and Chains
    2. Meta Coin Platforms
      1. Colored Coins
      2. Mastercoin
      3. Counterparty
    3. Alt Coins
      1. Evaluating an Alt Coin
      2. Monetary Parameter Alternatives: Litecoin, Dogecoin, Freicoin
        1. Litecoin
        2. Dogecoin
        3. Freicoin
      3. Consensus Innovation: Peercoin, Myriad, Blackcoin, Vericoin, NXT
        1. Peercoin
        2. Myriad
        3. Blackcoin
        4. VeriCoin
        5. NXT
      4. Dual-Purpose Mining Innovation: Primecoin, Curecoin, Gridcoin
        1. Primecoin
        2. Curecoin
        3. Gridcoin
      5. Anonymity-Focused Alt Coins: CryptoNote, Bytecoin, Monero, Zerocash/Zerocoin, Darkcoin
        1. Zerocoin/Zerocash
        2. CryptoNote
        3. Bytecoin
        4. Monero
        5. Darkcoin
    4. Noncurrency Alt Chains
      1. Namecoin
      2. Ethereum
    5. Future of Currencies
  13. 10. Bitcoin Security
    1. Security Principles
      1. Developing Bitcoin Systems Securely
      2. The Root of Trust
    2. User Security Best Practices
      1. Physical Bitcoin Storage
      2. Hardware Wallets
      3. Balancing Risk
      4. Diversifying Risk
      5. Multi-sig and Governance
      6. Survivability
    3. Conclusion
  14. A. Transaction Script Language Operators, Constants, and Symbols
  15. B. Bitcoin Improvement Proposals
  16. C. pycoin, ku, and tx
    1. Key Utility (KU)
      1. Transaction Utility (TX)
  17. D. Bitcoin Explorer (bx) Commands
    1. Examples of bx command use
  18. Index
  19. Colophon
  20. Copyright

Product information

  • Title: Mastering Bitcoin
  • Author(s): Andreas M. Antonopoulos
  • Release date: December 2014
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9781449374044