2 min read

CS 251 - Lecture 2 and HW1 Notes

  • you can generate a secret key / signing key, and then you can trace the public key from signing key, and the P2PKHBA (Pay 2 Public Key Hash Bitcoin Address) from the public key

Validating a scriptSig involved appending a scriptPubKey to it and running the combined script to ensure it outputs a True.

the sum of bitcoin in the unspent outputs cannot exceed the input.

On to Homework 1, which is basically a simple python-bitcoinlib walkthrough for the most part to create signed transactions.

I have to say, the starter code is annoyingly bad. No comments, no file headers, no description of inputs and outputs, no test cases. I guess this is the difference between real world coding and university classes... There are some clear mistakes in the starter code, which have to be debugged slowly. And this code must be several years old, so they basically didn't bother to update it for the errata. Probably every year the TAs teaching the class have to issue corrections...

Some useful notes and links

Bitcoins the hard way: Using the raw Bitcoin protocol
All the recent media attention on Bitcoin inspired me to learn how Bitcoin really works, right down to the bytes flowing through the netwo...
Useful to understand the raw protocol

Peter Todd's examples are probably the most suitable tutorials at the right level of abstractions

petertodd/python-bitcoinlib
Python3 library providing an easy interface to the Bitcoin data structures and protocol. - petertodd/python-bitcoinlib
A from-scratch tour of Bitcoin in Python
Musings of a Computer Scientist.

And I give up... It's not impossible to understand or do the exercises... but it's just not very useful... I find myself wanting to rewrite all of the Bitcoin homework code, with proper headers and sample code. But at the same time, no one seems to use this stuff anymore. Bitcoin development is basically dead.