Book #27 - Programming Bitcoin

Programming Bitcoin: Learn How to Program Bitcoin from Scratch
by Jimmy Song (2019)

Thursday evenings - 5 pm pacific time / 7 pm central time

 

Meetup: https://www.meetup.com/the-south-padre-island-reading-group/events/285731823
Zoom: https://zoom.us/j/84281187589
Discord: https://bit.ly/35RhGXM
O’Reilly:
Jupyter notebook exercises:

 

Finished!

Congratulations everyone, we’ve completed the book! Next we’re on to a hackergarden in a few weeks with a Go bitcoin repo that has some issues we might try to address. Also I’ll be reading about Sapio as a side reading with perhaps some ad-hoc meetups. (I have not taken a position on BIP-119 yet. I’d like to understand it better first.)

Other topics, among others, we plan to look at - taproot, lightning network (the book), and drivechains

 

Chapter 13
Segwit

May 18, 2022

Presenter

Chapter 13
Segwit

May 18, 2022

Presenter

Pay-to-Witness-Pubkey-Hash (p2wpkh)
pswpkh Transactions

Doug

p2sh-p2wpkh

Amit

Pay-to-Witness-Script-Hash (p2wsh)

Casey

p2sh-p2wsh
Other improvements

Casey

 

Chapter 11
SPV (Merkle Trees)

May 5, 2022

Presenter

Chapter 11
SPV (Merkle Trees)

May 5, 2022

Presenter

Motivation
Merkle Tree
Merkle Parent
Merkle Parent Level

Amit

Merkle Root
Merkle Root in Blocks
Using a Merkle Tree

Doug

Merkle Block

Casey

 

Chapter 10
Networking

April 21, 2022

Presenter

Chapter 10
Networking

April 21, 2022

Presenter

Network Messages
Parsing the Payload

Doug

Network Handshake
Connecting to the Network

Amit

Getting Block Headers
Headers Response

Casey

 

Chapter 9
Blocks

April 14, 2022

Presenter

Chapter 9
Blocks

April 14, 2022

Presenter

Coinbase Transaction

Casey

Block Headers

Casey

Proof-of-Work

Doug

 

Chapter 8
Pay-to-Script Hash

March 17, 2022

Presenter

Chapter 8
Pay-to-Script Hash

March 17, 2022

Presenter

Bare Multisig

Doug

Problems with Bare Multisig

Doug

Pay-to-Script-Hash (p2sh)

Casey

 

Chapter 7
Transaction Creation and Validation

March 3, 2022
March 17, 2022

Presenter

Chapter 7
Transaction Creation and Validation

March 3, 2022
March 17, 2022

Presenter

Validating Transactions

Doug

Creating Transactions

Amit - March 17, 2022

Creating Your Own Transactions on testnet

Casey

 

Chapter 6
Script

February 24, 2022

Presenter

Chapter 6
Script

February 24, 2022

Presenter

Mechanics of Script
How Script Works
Example Operations
Parsing the Script Fields
Combining the Script Fields

Casey

Standard Scripts
p2pk

Doug

Problems with p2pk
Solving the Problems with p2pkh

Casey

Scripts Can Be Arbitrarily Constructed

Doug

 

Chapter 5
Transaction

February 17, 2022

Presenter

Chapter 5
Transaction

February 17, 2022

Presenter

Transaction Components

Praveen

Version
Inputs

Casey

Outputs

Casey

Locktime

Doug

Transaction Fee

Doug

 

Chapter 4
Serialization

February 10, 2022

Presenter

Chapter 4
Serialization

February 10, 2022

Presenter

Uncompressed SEC Format

Doug

Compressed SEC Format

Casey

DER Signature

Amit

Base58

Casey

Big- and Little-Endian Redux

Doug

Extra notes from January 27

p is the order of the finite field

n is the order of the cycle of points from the generator point G, such that n*G=0

Both p and n are prime.

Both p and n are very close to 2256 , and n < p

Integers in the range [0, 2256) - 1] can be stored in 32 bytes and can be displayed with 64 hex characters

So, too, can integers in the range [0, p] or [0, n]

Extra notes from February 3

Notes on Signing and Verification

Chapter 3
Elliptic Curve Cryptography

January 27, 2022
February 3, 2022

Presenter

Chapter 3
Elliptic Curve Cryptography

January 27, 2022
February 3, 2022

Presenter

Elliptic Curves over Reals
Elliptic Curves over Finite Fields

Melissa

Point Addition over Finite Fields
Scalar Multiplication for Elliptic Curves
Scalar Multiplication Redux

Casey

Mathematical Groups

Doug

Defining the Curve for Bitcoin

Casey - February 3

Public Key Cryptography
Signing and Verification

Casey - February 3

 

 

Chapter 2
Elliptic Curves

January 20, 2022

Presenter

Chapter 2
Elliptic Curves

January 20, 2022

Presenter

Definition

Melissa Simpson

Point Addition

Melissa Simpson

Math of Point Addition

Casey

Point Addition for When x1 != x2

Casey

Point Addition for When P1 = P2

Doug

Coding One More Exception

Doug


Notes on Chapter 1 -

  • Here’s a full proof of Fermat’s Little Theorem for those who are interested in the nitty-gritty details ttps://www.coursera.org/learn/number-theory-cryptography/lecture/8ZcIG/fermats-little-theorem

Chapter 1
Finite Fields

January 6, 2022
January 13, 2022

Presenter

Chapter 1
Finite Fields

January 6, 2022
January 13, 2022

Presenter

Learning Higher-Level Math
Finite Field Definition
Defining Finite Sets

Casey

Modulo Arithmetic

Melissa - January 13

Finite Field Addition and Subtraction

Doug - January 13

Finite Field Multiplication and Exponentiation

Doug - January 13

Finite Field Division

Casey - January 13

Redefining Exponentiation

Casey - January 13