TeachMeBitcoin

Unlocking Script Overview

From TeachMeBitcoin, the free encyclopedia Reading time: 2 min

The Unlocking Script (ScriptSig)

In the Bitcoin protocol, every Transaction Input must provide a proof of ownership to spend the referenced coins. This proof is contained in a field called ScriptSig.

1. The Purpose of ScriptSig

ScriptSig is known as the "Unlocking Script." Its job is to provide data that satisfies the mathematical puzzle (the ScriptPubKey) placed on the coins by the previous owner.

2. A Two-Part Puzzle

To spend bitcoin, two scripts are combined and executed by the network's nodes:

  1. ScriptPubKey (The Lock): Stored in the previous transaction's output. It says: "To spend these coins, you must provide a signature from the owner of Address X."

  2. ScriptSig (The Key): Provided in your new transaction's input. It contains your signature and public key.

If the "Key" fits the "Lock," the transaction is valid.

3. Data Pushes

Technically, ScriptSig is a sequence of data pushes. It doesn't usually contain "logic" or "operators" (like OP_CHECKSIG). Instead, it pushes the necessary credentials onto the execution stack.

4. The Stack Concept

Bitcoin uses a stack-based execution model (Last-In, First-Out).

Property Value
Role Unlocking Script
Location Transaction Input
Contents Signature, Public Key, or Script
Nickname The Key

In the next section, we will deconstruct the Components found inside a standard ScriptSig.

☕ Help support TeachMeBitcoin

TeachMeBitcoin is an ad-free, open-source educational repository curated by a passionate team of Bitcoin researchers and educators for public benefit. If you found our articles helpful, please consider supporting our hosting and ongoing content updates with a clean donation:

Ethereum: 0x578417C51783663D8A6A811B3544E1f779D39A85
Bitcoin: bc1q77k9e95rn669kpzyjr8ke9w95zhk7pa5s63qzz
Solana: 4ycT2ayqeMucixj3wS8Ay8Tq9NRDYRPKYbj3UGESyQ4J
Address copied to clipboard!