Betting on Bitcoin Upgrades: A Smart Contract Wager on OP_CAT Activation

Posted by sCrypt-ts

Apr 22, 2025/09:42 UTC

The Bitcoin Improvement Proposal (BIP) 0347 introduces OP_CAT, an upgrade aimed at enhancing Bitcoin's scripting capabilities by enabling the concatenation of two stack elements. This functionality paves the way for more complex covenants and smart contracts within the Bitcoin ecosystem. Amidst debates on soft forks concerning their functionality, security, and adoption, a practical approach demonstrates the potential impact of such upgrades through a real-world application: a trustless bet between two parties, Alice and Bob, on the activation of OP_CAT by a certain block height.

Alice and Bob engage in a wager to test their predictions about OP_CAT's activation, locking 1 BTC each into a smart contract with clear rules. The contract stipulates that if OP_CAT is active by block height 900,000, Alice wins the total of 2 BTC; otherwise, Bob claims the prize. This setup eliminates the need for oracles or third-party arbitrators, relying solely on Bitcoin's blockchain to resolve the bet. The mechanism exemplifies a financial commitment from both parties, underscoring the "skin in the game" ethos prevalent in cryptocurrency ventures.

Crafting a smart contract for this bet involves navigating the challenge posed by OP_SUCCESS126, a placeholder opcode that, until OP_CAT's activation, leads any script executing it to succeed immediately. This characteristic could potentially allow Alice to claim the funds prematurely if not properly addressed in the contract's logic. By employing a Taproot output with a single script path featuring two conditional branches, the contract differentiates between OP_CAT’s post-activation behavior and OP_SUCCESS126’s pre-activation state, ensuring the bet operates as intended without external data inputs.

The technical foundation of the contract is laid out using sCrypt, a language designed for constructing smart contracts on Bitcoin. It incorporates mechanisms like absolute timelocks to prevent premature fund release and employs a unique assertion that checks the outcome of concatenating two strings via sha256, effectively determining the winner based on OP_CAT's activation status. This design principle ensures that the contract self-executes based on the predefined conditions, reflecting a direct application of Bitcoin's native scripting capabilities to create a decentralized bet.

This implementation not only serves as a proof of concept for betting on future Bitcoin protocol upgrades but also sets a precedent for other prediction markets without requiring soft forks or external oracles. It embodies a purely on-chain logic approach, leveraging existing Bitcoin opcodes to enforce the terms of the bet, demonstrating the robustness and flexibility of Bitcoin's scripting language for facilitating complex contractual agreements directly within the blockchain.

Link to Raw Post
Bitcoin Logo

TLDR

Join Our Newsletter

We’ll email you summaries of the latest discussions from authoritative bitcoin sources, like bitcoin-dev, lightning-dev, and Delving Bitcoin.

Explore all Products

ChatBTC imageBitcoin searchBitcoin TranscriptsSaving SatoshiBitcoin Transcripts Review
Built with 🧡 by the Bitcoin Dev Project
View our public visitor count

We'd love to hear your feedback on this project?

Give Feedback