Bitcoin Developer Basics: Transactions, Scripts + SegWit
What you'll learn
- Basic intro to encodings, endianness, and bitcoin's specific base58 encoding
- Learn the components of a bitcoin transaction
- How to parse a bitcoin transaction from bytes
- Intro to bitcoin Script, including writing your own bitcoin locking scripts
- How to write standard bitcoin locking scripts (P2SH)
- How SegWit changed the basic bitcoin transaction
- The standard SegWit locking script: P2WSH
- How to make legacy compatible SegWit scripts: P2SH-P2WSH
- This course is open to everyone, but it is in-depth bitcoin transaction protocol content.
- Developers that have experience with byte-formats, encodings, and bitcoin will likely find it more approachable
So you've heard about bitcoin? Ever wondered what's going on with the data in a transaction, or how bitcoin gets locked up and transferred from one holder to another?
This course by Base58 instructor niftynei, will take you on a deep dive of the fields, bytes, and scripts that make up the bitcoin blockchain data. In an software engineer focused manner, we'll go over everything you need to know to build your own bitcoin transaction parser, write your very own custom bitcoin locking scripts, and adapt your transactions to the modern SegWit format.
Step 1: Intro to bitcoin transactions
We'll start off learning about what a bitcoin transaction is. Specifically, what fields do they contain? We learn how to calculate a transaction id and what transaction fees are, and how are they calculated. Finally, we'll talk about coinbases and block rewards.
Topics: transaction fields, endianness, transaction ids, fees + transaction weights, coinbases
Step 2: Enter Script
In week two we start talking about Bitcoin's native "programming language": Script! We'll write our own script this week (and learn about hashes and preimages). Once we've written a script we'll try locking some bitcoins up to it, as well as unlocking them.
Topics: Script, standard scripts, P2SH, opcodes
Step 3: Transacting with SegWit
Now that we've seen how transactions are constructed and built, we'll introduce the bitcoin omnibus update bill, the SegWit soft-fork. SegWit impacted the structure of a transaction and its fee calculations, so we'll dive into how these updates work and two of the 'new' SegWit script types: P2WSH and P2SH-P2WSH.
Topics: SegWit! P2WSH, P2SH-P2WSH
Who this course is for:
- Developers who want to learn about blockchain protocols
- Bitcoiners that want to really understand how transactions work
- Beginning developers that are interested in protocol design
- Cryptocurrency curious devs!
- Protocol designers that want an in-depth course on bitcoin transaction design decisions
- Cryptographers that want an engineer-focused understanding of bitcoin transactions
niftynei is a lightning protocol engineer at Blockstream and the lead instructor and curriculum writer at Base58, the premier bitcoin protocol school. With over a decade of experience in writing and engineering software applications, she's excited to bring her 4 years of experience working in bitcoin to curious learners and software engineers across the globe.