> Markdown version of [/videos/146-op_push_tx-and-its-applications-in-bitcoin-smart-contracts](https://www.wearedevelopers.com/videos/146-op_push_tx-and-its-applications-in-bitcoin-smart-contracts). Every page supports `.md` or `Accept: text/markdown`. Links point to the HTML versions so they work for humans too. Agent guide: [/agents.md](https://www.wearedevelopers.com/agents.md). --- # OP_PUSH_TX and its applications in Bitcoin smart contracts Lio, creator of sCrypt, proves Bitcoin script is natively Turing complete. Learn how the OP_PUSH_TX pseudo-opcode unlocks stateful, fully on-chain smart contracts without protocol modifications. - **Speakers:** Xiaohui Liu - **Event:** WeAreDevelopers LIVE - **Published:** May 16, 2021 - **Duration:** 21:45 - **URL:** https://www.wearedevelopers.com/videos/146-op_push_tx-and-its-applications-in-bitcoin-smart-contracts ## Summary Lio, creator of sCrypt, introduces OP_PUSH_TX, a powerful pseudo-opcode that dictates how Bitcoin funds can be spent by pushing a transaction's sighash preimage onto the stack. By combining this preimage with ECDSA signature verification, developers can strictly validate current transaction data and enforce robust UTXO spending controls—such as CheckLockTimeVerify and Pay-to-Script-Hash—without requiring protocol-level opcode modifications. This cryptographic technique unlocks a major milestone for Bitcoin smart contracts: the ability to natively maintain state across transactions. By partitioning a transaction's locking script into immutable code and mutable data, applications can seamlessly enforce strict state transitions across blocks. This operational statefulness proves that Bitcoin script is inherently Turing complete, a concept demonstrated by deploying Conway's Game of Life and fully on-chain, peer-to-peer games like Tic-Tac-Toe directly onto the network. Beyond gaming, this structural foundation enables developers to build dynamic financial instruments, fungible or non-fungible tokens, and security-focused tools like daily-spend-limit checking accounts. To eliminate the friction of raw Bitcoin Script development, sCrypt abstracts these intricate low-level mechanics into a high-level library, empowering builders to deploy sophisticated on-chain state and access controls with just a single line of code. **Keywords:** op_push_tx pseudo-opcode, bitcoin sv smart contracts, scrypt smart contract library, sighash preimage validation, ecdsa signature verification, utxo spending controls, checklocktimeverify implementation, pay-to-script-hash mechanics, on-chain state management, bitcoin turing completeness, conway's game of life on-chain, peer-to-peer on-chain gaming, transaction locking scripts, fungible token state contracts, on-chain financial instruments ## Chapters 1. **Introduction to Bitcoin script and OP_PUSH_TX** (00:18) — How the Bitcoin virtual machine evaluates stack-based instructions like OP_PUSH_TX to read transaction state. 1. **Generating sighash preimages for Bitcoin transactions** (02:34) — The process of signing a transaction format containing inputs, outputs, sequence, and spent UTXOs. 1. **Implementing pseudo opcodes using ECDSA signature verification** (04:34) — How checking cryptographic signatures against public keys ensures data integrity for the current transaction preimage. 1. **Controlling transaction spending with OP_PUSH_TX preimages** (08:10) — Practical examples using preimages to implement check lock time verify and pay to script hash without explicit opcode changes. 1. **Maintaining persistent state in Bitcoin smart contracts** (12:01) — Structuring a locking script into immutable code and mutable data parts to propagate counter state across transactions. 1. **Exploring on-chain games and custom token systems** (15:14) — Leveraging arbitrary state data to build cellular automata, non-fungible tokens, and complex financial instruments directly on the blockchain. 1. **Demonstrating a fully on-chain multiplayer game** (17:40) — A live example of a complete Tic-Tac-Toe game where each player move executes as an enforceable transaction on the network. 1. **Resources for building Bitcoin smart contracts** (19:59) — High-level libraries abstract away scripting complexity to enable rapid deployment of decentralized applications. ## Related Moments - [The Bitcoin SV UTXO smart contract model](https://www.wearedevelopers.com/videos/24-introduction-to-scrypt-a-smart-contract-language-for-bitcoin-sv) (from "Introduction to sCrypt - a smart contract language for Bitcoin SV") - [Executing Bitcoin scripts on a stack-based architecture](https://www.wearedevelopers.com/videos/15-a-technical-introduction-to-bitcoin-s-2nd-layer-the-lightning-network) (from "A Technical Introduction to Bitcoin's 2nd Layer- The Lightning Network") - [Comparing off-chain javascript execution with bitcoin script](https://www.wearedevelopers.com/videos/29-run-on-bitcoin) (from "Run on Bitcoin") - [Introduction to interoperable apps on Bitcoin](https://www.wearedevelopers.com/videos/151-an-introduction-to-operate-sv) (from "An introduction to Operate SV") - [Emphasizing token utility for network code execution](https://www.wearedevelopers.com/videos/999-why-you-should-care-about-the-decentralized-computing-movement) (from "Why You Should Care About the Decentralized Computing Movement") - [Developing a decentralized tic-tac-toe game with smart contracts](https://www.wearedevelopers.com/videos/52-smart-contract-fundamentals-my-first-dapp) (from "Smart Contract fundamentals - My first DApp") ## Related Articles - [Build With Bitcoin SV](https://www.wearedevelopers.com/magazine/6-build-with-bitcoin-sv) - [From Hype to Code: Real Blockchain Use Cases for Developers](https://www.wearedevelopers.com/magazine/620-from-hype-to-code-real-blockchain-use-cases-for-developers) - [Dev Digest 138 - Are you secure about this?](https://www.wearedevelopers.com/magazine/486-dev-digest-138-are-you-secure-about-this) - [Dev Digest 131 - AI'm not sure about OSS](https://www.wearedevelopers.com/magazine/472-dev-digest-131-ai-m-not-sure-about-oss) ## Related Jobs - [Senior Backend Engineer, Blockchain (Smart Contracts)](https://www.wearedevelopers.com/jobs/ext/1940851-senior-backend-engineer-blockchain-smart-contracts) at **Bitpanda** - [Backend Engineer, Python (Web3)](https://www.wearedevelopers.com/jobs/ext/1934515-backend-engineer-python-web3) at **Bitpanda** - [Software Engineer](https://www.wearedevelopers.com/jobs/ext/1304791-software-engineer) at **Bitpanda** - [Engineer, Offensive Security Organization](https://www.wearedevelopers.com/jobs/ext/1992296-engineer-offensive-security-organization) at **Twilio** - [Senior Software Engineer, Fraud](https://www.wearedevelopers.com/jobs/ext/1280398-senior-software-engineer-fraud) at **Twilio** - [Principal Software Engineer, Identity](https://www.wearedevelopers.com/jobs/ext/1469181-principal-software-engineer-identity) at **GitHub**