> For the complete documentation index, see [llms.txt](https://hub.bsvblockchain.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hub.bsvblockchain.org/higher-learning/bsv-academy/bitcoin-script-new.md).

# Bitcoin Script - new

<figure><img src="/files/sgq9lewMao20wCLmoeCj" alt=""><figcaption></figcaption></figure>

Every Bitcoin transaction is governed by a program — a small but powerful set of instructions that determines **who can spend funds, under what conditions, and when**. That program is **Bitcoin Script**: a stack-based, Forth-inspired language built directly into the Bitcoin protocol. Unlike general-purpose programming languages, Script is deliberately simple, predictable, and deterministic — yet within that simplicity lies remarkable expressive power. From the basic act of sending coins to a public key, to multi-party spending conditions, hash puzzles, time locks, and self-referencing transaction logic, Script is the engine that makes programmable money possible on the Bitcoin blockchain.

This learning path takes you on a structured journey through Bitcoin Script — from its historical roots in the **FORTH programming language**, through the mechanics of the **script evaluation engine**, into the full library of **opcodes**, and on to real-world **script templates** and advanced techniques such as **OP\_PUSH\_TX**. Whether you are writing smart contracts, building wallets, designing token protocols, or simply deepening your understanding of how Bitcoin works under the hood, this path gives you the knowledge and vocabulary you need to work confidently with Bitcoin transactions.

### Why Bitcoin Script Matters

Bitcoin Script is not an optional layer on top of Bitcoin — it **is** Bitcoin, in a very real sense. Every unspent transaction output **(UTXO)** on the blockchain is locked by a script (the **locking script**, or **scriptPubKey**). Every attempt to spend that output must provide a corresponding **unlocking script** (**scriptSig**) that, when evaluated by the **script engine**, leaves a non-zero value on the stack. Understanding this mechanism is essential for any developer building applications on Bitcoin — because it is where ownership, authorization, and programmable logic all converge.

Beyond simple payments, Bitcoin Script enables a rich design space: **multi-signature wallets** that require approvals from several parties, **time-locked transactions** that cannot be spent before a specified block height or timestamp, **hash puzzles** that unlock funds when a pre-image is revealed, and — at the frontier of protocol engineering — **OP\_PUSH\_TX** techniques that allow a script to inspect and constrain the transaction that spends it, enabling recursive and stateful computation on-chain. Mastering Script means mastering the fundamental mechanism through which Bitcoin achieves programmability at scale.

### You Will Explore

•       **The FORTH legacy:** Trace Bitcoin Script's design back to the FORTH programming language and understand why a stack-based approach was chosen for transaction validation.

•       **The transaction protocol:** Examine how transactions are structured — inputs, outputs, locking scripts, unlocking scripts, nLockTime, and nSequence — and how they interact with the script evaluator.

•       **Stack mechanics and opcodes:** Work through the main and alt stack model, master the grammar rules of Script, and explore the full opcode library including flow control, cryptographic operations, and arithmetic.

•       **Standard script templates:** Build and evaluate the real-world patterns used every day on the Bitcoin network: P2PK, P2PKH, P2MS (multisig), hash puzzles, P2MSH, and R-Puzzles.

•       **OP\_PUSH\_TX and transaction introspection:** Understand how the ECDSA signature pre-image can be used to enforce output conditions from within a script, enabling complex stateful logic without changing the protocol.

•       **Turing completeness on Bitcoin:** Explore how finite state machines can be built using Bitcoin Script and UTXOs, and what it means for Script to be Turing-complete despite having no jump instructions.&#x20;

### Who Is This Path For?

This path is designed for **developers and technical professionals** who want to understand Bitcoin at the protocol level. You should be comfortable with general programming concepts — variables, functions, conditional logic — but you do not need prior experience with blockchain development. A basic familiarity with **hexadecimal notation** and **cryptographic hash functions** (such as SHA-256) will be helpful but is not required. Each course introduces new vocabulary carefully, and key terms are explained as they appear.

If you are coming from a background in **software engineering, systems programming, or cryptography**, you will find the material immediately applicable to real-world Bitcoin&#x20;


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://hub.bsvblockchain.org/higher-learning/bsv-academy/bitcoin-script-new.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
