Bitcoin Script: a Reading List

While thinking about and implementing BitAuth2017, I compiled a list of articles and resources about Bitcoin Script — the scripting language which is used in Bitcoin to define and satisfy various transaction authentication requirements.

Here’s a short reading list of the articles and resources I find myself referencing repeatedly. I hope others will find it useful too.


Getting Started

Diving Deeper

P2SH

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.
  • Hashmal: Might be the best right now, but requires installing software locally (written in python).
  • BitcoinIDE: Web based, and provides an excellent stack visualization.
  • Bitcoin Script Explorer: 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

  • BIP 141: If the Segregated Witness soft fork happens, there are some new and interesting changes in store for Bitcoin Script, including Bitcoin Script language versioning and reduced limitations on script sizes.

Have something I should add to this list? Please leave a comment or send me a note!