Bitcoin Script Explorer

Fork me on GitHub

The Bitcoin Script Explorer is a tool to help programmers learn about Bitcoin Script. It shows all of the steps involved in executing a Bitcoin Script program.

What is Bitcoin Script?

The Bitcoin blockchain consists of a sequence of transactions, where each transaction may spend the outputs of a previous transaction.

Bitcoin Script is a minimal stack-based programming language. Each Bitcoin transaction has an associated Bitcoin Script program, and the result of running this program determines whether this transaction is valid or not.

A Bitcoin Script program is assembled from two sections. The pubKey, which comes from the previous transaction, specifies what conditions must be met in order to spend the bitcoins from that transaction. The scriptSig, which comes from the spending transaction, satisfies these conditions. These two sources are concatenated together to form the complete Bitcoin Script program, which can then be run.

See example transactions

Standard tx (successful) >
Standard tx (failed) >
Unspendable output >
Hash puzzle output >

pubKey

The pubKey comes from the previous transaction. It specifies what conditions must be met to spend the bitcoins from that transaction, which usually consists of a proof of ownership. The goal of the pubKey section is to ensure that only desired parties may spend the bitcoins in its transaction.

The pubKey forms the second part of the combined script.

scriptSig

The scriptSig comes from the spending transaction. This section of the program satisfies the conditions imposed by the pubKey. The goal of the scriptSig section is to make the program return "success."

The scriptSig forms the first part of the combined script.

Script

The script consists of a list of operators, which come from the raw hex contained in scriptSig and pubKey.

Use J and K to navigate.

Click here to return to the initial state >

State

This shows the state of the program after the highlighted operation was run. The state consists only* of a stack of binary strings and a value representing whether the script has succeeded or failed.