Grokking Bitcoin
Kalle Rosenbaum
Foreword by David A. Harding
  • April 2019
  • ISBN 9781617294648
  • 480 pages
  • printed in black & white

Filled with clear explanations and many excellent illustrations, this book makes even the most highly technical topic accessible.

From the Foreword by David A. Harding, Contributor to Bitcoin documentation

If you think Bitcoin is just an alternative currency for geeks, it's time to think again. Grokking Bitcoin opens up this powerful distributed ledger system, exploring the technology that enables applications both for Bitcoin-based financial transactions and using the blockchain for registering physical property ownership. With this fully illustrated, easy-to-read guide, you'll finally understand how Bitcoin works, how you can use it, and why you can trust the blockchain.

About the Technology

Inflation, depressed economies, debased currencies … these are just a few of the problems centralized banking has caused throughout history. Bitcoin, a digital currency created with the ambition to shift control away from change-prone governments, has the potential to bring an end to those problems once and for all. It’s time to find out how it can help you.

About the book

Grokking Bitcoin explains why Bitcoin’s supporters trust it so deeply, and why you can too. This approachable book will introduce you to Bitcoin’s groundbreaking technology, which is the key to this world-changing system. This illustrated, easy-to-read guide prepares you for a new way of thinking with easy-to-follow diagrams and exercises. You’ll discover how Bitcoin mining works, how to accept Bitcoin, how to participate in the Bitcoin network, and how to set up a digital wallet.

Table of Contents detailed table of contents

Chapter 1 Introduction to Bitcoin

What is Bitcoin?

The big picture

Step 1—​Transactions

Step 2—​The Bitcoin network

Step 3—​The blockchain

Step 4—​Wallets

Problems with money today


Privacy issues



The Bitcoin approach


Limited supply


How is Bitcoin used?


Cross-border payments



Noncurrency uses

How is Bitcoin valued?

When not to use Bitcoin

Other cryptocurrencies

Chapter 2 Cryptographic hash functions and digital signatures

Cryptographic hashes

Why are cryptographic hash functions useful?

How does a cryptographic hash function work?

Properties of a cryptographic hash function

Illustration of “hard”

Some well-known hash functions


Digital signatures

Typical use of digital signatures

Preparation: John generates a key pair

John signs his payment

Lisa verifies the signature

Private key security

Chapter 3 Addresses

Replacing names with public keys

New payment process

Shortening the public key

Hashing the public key to 20 bytes

Why SHA256 and RIPEMD160?

Avoiding expensive typing errors


Back to privacy

Chapter 4 Wallets

First wallet version

Private key backups

A few words on password strength

Problems with password-encrypted backups

Hierarchical deterministic wallets

Deriving a master extended private key

Deriving a child extended private key

Back to backup

Mnemonic sentences

Encoding a seed into a mnemonic sentence

Decoding a mnemonic sentence into a seed

Extended public keys

Deriving hardened private keys

Public key math

Public key multiplication

Why is this secure?

Xpub derivation

Public key encoding

Chapter 5 Transactions

Problems with the old system

Paying using a transaction

Creating the transaction

Lisa confirms the transaction

Anyone verifies the transaction

Account-based and value-based systems


Why use a program?

Why signature script and pubkey script?

Fancy payment types

Multiple signatures


Pay-to-script-hash addresses

More stuff in transactions

Rewards and coin creation

Transition from version 4.0

Trust in Lisa

Chapter 6 The blockchain

Lisa can delete transactions

Building the blockchain

Lisa builds a block

How does this process protect you from deletes?

Why use a blockchain?

Lightweight wallets

Bloom filters obfuscate addresses

Merkle trees

Creating the merkle root

Proving that a transaction is in a block

How it really works

Security of lightweight wallets

Chapter 7 Proof of work

Cloning Lisa

Block collisions

Drawing lucky numbers

Probability of splits

Forcing honest lucky numbers

Producing a valid proof of work

Why is this good?

Comparing with lucky numbers

What if you run out of nonces?

Miners have to move out

Adding more hashrate

Problems with a high block rate

What’s fixed?

Difficulty adjustments

Rules for timestamps

Chain strength vs. chain length

What harm can miners do?

Double spending

Protecting against double-spend attacks

Transaction fees

Bigger blocks are slower

But wasn’t this about transaction fees?

Block size is limited

When the block subsidy is 0

Chapter 8 Peer-to-peer network

The shared folder

Let’s build a peer-to-peer network

How do peers talk?

The network protocol

John sends the transaction

Tom forwards the transaction

The cafe’s lightweight wallet is notified

Including the transaction in a block

Notifying wallets

More confirmations

Bitcoin at a glance

Bootstrapping the network

Step 1—​Run the software

Step 2—​Connect to nodes

Step 3—​Synchronize

Step 4—​Normal operation

Running your own full node

Downloading Bitcoin Core

Verifying the software

Unpacking and starting

Initial blockchain download

Chapter 9 Transactions revisited

Time-locked transactions

Time measurements

Relative time locks

Time-locked outputs

Absolute time-locked outputs

Relative time-locked outputs

Atomic swaps

Storing stuff in the Bitcoin blockchain

Bloated UTXO set

Creating a token in Bitcoin

Starting the car with proof of ownership

Replacing pending transactions

Opt-in replace-by-fee

Child pays for parent

Different signature types

Chapter 10 Segregated witness

Problems solved by segwit

Transaction malleability

Inefficient signature verification

Waste of bandwidth

Script upgrades are hard


Segwit addresses

Spending your segwit output

Verifying the segwit transaction

Including your segwit transaction in a block


New hashing method for signatures

Bandwidth savings

Upgradable script

Wallet compatibility

Block limits

Block size limit

Signature operations limit

Increasing the limits

Chapter 11 Bitcoin upgrades

Bitcoin forks

Nonconsensus rule changes

Hard forks

Soft forks

Differences between hard and soft forks

Transaction replay

Replay protection

Upgrade mechanisms

Using coinbase signaling—​BIP16

Using incremented block version number signaling—​BIP34, 66, and 65

Using block version bits signaling—​BIP9

Using BIP9 to deploy relative lock time

Using BIP9 to deploy segwit

User-activated soft forks

Appendix A: Appendix A: Using bitcoin-cli

Communicating with bitcoind

Using curl

Graphical user interface

Getting to know bitcoin-cli

Getting to work

Creating an encrypted wallet

Backing up the wallet

Receiving money

Sending money

Appendix B: Appendix B: Answers to exercises

Appendix C: Appendix C: Web resources

What's inside

  • Bitcoin transactions
  • The blockchain
  • Bitcoin mining
  • Bitcoin wallets

About the reader

Intended for anyone interested in learning about Bitcoin technology. While a basic understanding of technical concepts is beneficial, no programming skills are necessary.

About the author

Kalle Rosenbaum is a computer scientist, an avid Bitcoin supporter, and the founder of Popeller, a Bitcoin consultancy.

placing your order...

Don't refresh or navigate away from the page.
print book $39.99 pBook + eBook + liveBook
Additional shipping charges may apply
Grokking Bitcoin (print book) added to cart
continue shopping
go to cart

eBook $31.99 3 formats + liveBook
Grokking Bitcoin (eBook) added to cart
continue shopping
go to cart

Prices displayed in rupees will be charged in USD when you check out.
customers also reading

This book 1-hop 2-hops 3-hops

FREE domestic shipping on three or more pBooks