Bitcoin VerityOpen comparator

Level 9 · Advanced technical layer

Bitcoin Script and spending conditions

How locking scripts, witness data and a stack language decide whether a UTXO may be spent.

Article
84
Reading time
14 minutes
Reviewed
10 September 2026

In a nutshell

Bitcoin Script is a deliberately limited stack language for checking spending conditions. An output contains a rule; a later input must provide data that makes the rule evaluate successfully.

01

An output is locked by a rule

A transaction output carries a value and a scriptPubKey. A spending input identifies that exact output and supplies a scriptSig, witness, or both. Nodes retrieve the previous output and independently reject the spend if its rules fail.

02

A stack, not a general application

Opcodes push, compare, hash and verify data on a stack. Script has no general loops and cannot query a website, exchange price or private database, helping every node reach the same bounded, deterministic result.

03

Hashed and versioned conditions

P2SH commits to a redeemScript by hash; P2WSH and Taproot later introduced other ways to commit to conditions. A hash proves the revealed script matches the commitment, not that the policy is safe or recoverable.

04

Consensus differs from relay policy

Consensus rules decide what may enter a valid block. A node's standardness policy is a narrower local rule for its mempool and relay. Hand-written scripts can be valid yet difficult to propagate—or can permanently lock funds through a design error.

Level 9 · Advanced technical layer

Terms to know

scriptPubKey
The locking condition stored in a transaction output.
Witness
Input data supplied to satisfy a SegWit or Taproot condition.
Opcode
One instruction in Bitcoin Script.

Common misconception

Bitcoin Script watches the outside world and moves money automatically.

A more accurate explanation

It runs only while nodes verify a proposed spend and sees only deterministic transaction and blockchain data defined by the protocol.

A more accurate explanation

Is Script too limited?

Its signatures, hashes, branches and timelocks support multisig, payment channels and many custody policies. The restricted design is also a security trade-off.

84

Key takeaways

  1. 01A UTXO contains a spending condition, not an owner's name.
  2. 02Script is deterministic and stack based.
  3. 03Consensus validity and relay policy differ.
  4. 04Complex wallets need more recovery data than an address.

A child-friendly recap

In very simple terms

A Bitcoin output is like a box with an exact lock. Script says which signature, secret or waiting period must be shown before it can open.

Reviewed: 10 September 2026

Sources and further reading

Sources support particular facts and definitions; listing one does not mean the editors endorse every view of its author.

01
Bitcoin Developer Guide: transactions and scriptsBitcoin Developer Guide
developer.bitcoin.org
02
BIP 16: Pay to Script HashBitcoin Improvement Proposals
bips.dev
03
Bitcoin Core: Script interpreterBitcoin Core source code
github.com

Educational material, not an investment recommendation.