Getting Started

Mastering Bitcoin by Andreas M. Antonopoulos – Chapter 5, Transactions : This chapter is worth reading in it’s entirety. It’s an excellent primer, and uses (in my opinion) the clearest language and terminology.

: This chapter is worth reading in it’s entirety. It’s an excellent primer, and uses (in my opinion) the clearest language and terminology. Bitcoin Developer Guide: Standard Transactions : The Bitcoin Developer Guide contains a fantastic overview of the entire Bitcoin system.

: The Bitcoin Developer Guide contains a fantastic overview of the entire Bitcoin system. Bitcoin Wiki: Script: The Bitcoin Wiki contains hundreds of pages of excellent technical information and discussion. If you have a question, it’s likely been asked, answered, and explained in detail on the wiki.

Diving Deeper

P2SH

BIP 16: Pay to Script Hash : P2SH is almost a separate topic on it’s own, and can take some experimentation to understand fully. BIP 16 is the standard which defines the P2SH transaction type, and is a great place to start.

: P2SH is almost a separate topic on it’s own, and can take some experimentation to understand fully. BIP 16 is the standard which defines the P2SH transaction type, and is a great place to start. Bitcoin multisig the hard way: Understanding raw P2SH multisig transactions: If you’re having trouble understanding exactly how P2SH multisig works, this article is perfect. It walks through every detail with a full example.

Read the Code

Bitcoin Core Reference Implementation: The Bitcoin Script implementation in Bitcoin Core is surprisingly easy to read. If you’re really having trouble answering a specific question, you might find that reading the code is the fastest (and most definitive) way to answer it.

Script Testing Environments

These can be hard to find, and are the original reason I compiled this list.

There’s definitely an opportunity here for a well-designed, well-maintained, open source project for writing and debugging Bitcoin Script.

The following projects provide some pretty solid options, in various states of repair, and in no particular order. (I usually need to flip between several before I find one that seems to handle a given input in a helpful way.)

Bitcoin Script Execution Debugger : This one isn’t particularly intuitive, but it’s extremely utilitarian. The clear Execution Trace section makes this one my favorite.

: This one isn’t particularly intuitive, but it’s extremely utilitarian. The clear Execution Trace section makes this one my favorite. Hashmal : Might be the best right now, but requires installing software locally (written in python).

: Might be the best right now, but requires installing software locally (written in python). BitcoinIDE : Web based, and provides an excellent stack visualization.

: Web based, and provides an excellent stack visualization. Bitcoin Script Explorer : Promising — a little confusing to use, but includes some great examples.

: Promising — a little confusing to use, but includes some great examples. Script Playground: No frills, but simple to use. Also seems very reliable.

Note: Always test on Testnet before using real money. Many sad stories begin with someone creating a custom raw bitcoin transaction.

Looking to the Future