Close Menu
  • Coins
    • Bitcoin
    • Ethereum
    • Altcoins
    • NFT
  • Blockchain
  • DeFi
  • Metaverse
  • Regulation
  • Other
    • Exchanges
    • ICO
    • GameFi
    • Mining
    • Legal
  • MarketCap
What's Hot

Bitcoin Hits $70K Wall as $20M Profit-Taking Caps Rally

27/04/2026

Ethereum Faces ‘Moment Of Truth’ As Price Eyes $2,450 Resistance – Breakout Loading?

27/04/2026

Top 5 Stablecoins Control 89% of $316B Market as Sector Edges Higher in March 2026

27/04/2026
Facebook X (Twitter) Instagram
  • Back to NBTC homepage
  • Privacy Policy
  • Contact
X (Twitter) Telegram Facebook LinkedIn RSS
NBTC News
  • Coins
    1. Bitcoin
    2. Ethereum
    3. Altcoins
    4. NFT
    5. View All

    Bitcoin Hits $70K Wall as $20M Profit-Taking Caps Rally

    27/04/2026

    Rushed quantum fix may backfire for Bitcoin, Samson Mow warns

    27/04/2026

    Bitcoin is Predicted to Reach $ 75,157 By Apr 10, 2026

    26/04/2026

    “BTC’s Net Inflation Rate Has Turned Negative”

    26/04/2026

    Ethereum Faces ‘Moment Of Truth’ As Price Eyes $2,450 Resistance – Breakout Loading?

    27/04/2026

    ETH Coin Targets $2,500 as Bulls Defend a Strong Support

    27/04/2026

    Ethereum Near Key Zone After 36% Gain – What’s Next?

    26/04/2026

    What’s Happening Between ETH And The Financial Systems?

    26/04/2026

    Japan’s Financial Giant Makes Bold Call

    27/04/2026

    Chainlink Unlocks 19M LINK, $165M Moved to Market

    27/04/2026

    Ripple Engineer Explains XRPL Update Pace, Focus Turns to Bug Fixes and Reliability

    26/04/2026

    ‘Midnight Isn’t Hurting Cardano,’ Insider Defends Charles Hoskinson’s Vision

    26/04/2026

    Top NFT Sales of the Week, Flying Tulip on Top

    27/04/2026

    Cardano NFT Marketplace Announces Permanent Closure, Shocking ADA Community

    24/04/2026

    Bored Ape Yacht Club turns five today and nobody seems to care

    23/04/2026

    WWE Partners with Blockchain Creative Labs for Official NFT Marketplace – Epic Digital Collectibles Ahead

    20/04/2026

    Bitcoin Hits $70K Wall as $20M Profit-Taking Caps Rally

    27/04/2026

    Ethereum Faces ‘Moment Of Truth’ As Price Eyes $2,450 Resistance – Breakout Loading?

    27/04/2026

    Top 5 Stablecoins Control 89% of $316B Market as Sector Edges Higher in March 2026

    27/04/2026

    Japan’s Financial Giant Makes Bold Call

    27/04/2026
  • Blockchain

    Nick Pell: The oil industry’s lobbying stifled electric vehicle growth, how battery technology transformed EVs, and Tesla’s game-changing charging strategy

    26/04/2026

    Illia Polosukhin: AI will replace traditional operating systems, blockchain serves as a root of trust for secure AI, and the need for user-owned AI is crucial

    26/04/2026

    Karen Hao: Profit motives drive AI development, current technologies harm society, and labor exploitation is rampant in the industry

    26/04/2026

    Christian Catalini: AI will transform job markets, coding professions face uneven automation, and human expertise remains critical in decision-making

    26/04/2026

    B.AI and Pundi X Unveil Autonomous AI Data Framework

    25/04/2026
  • DeFi

    Aave Takes Action to Resolve $290 Million Hack Crisis – Will Donate a Large Amount of ETH

    26/04/2026

    Aurelion allocates $48M in tokenized gold to new XAUE yield protocol

    26/04/2026

    DeFi heavyweights press SEC for formal broker rules after ‘non-custodial UI’ guidance

    26/04/2026

    DeFi losses are now 8,500% higher than TradFi breaches per dollar moved

    26/04/2026

    ‘Precautionary’- Wrapped Bitcoin (wBTC) tightens security after KelpDAO $293M exploit

    26/04/2026
  • Metaverse

    ‘8,000 Jobs’—Polymarket Sees Tech Layoff Surge As Meta AI Push Bites

    18/04/2026

    Planet Hares Partners With Magne.AI To Bridge Web3 Metaverse With Smartphone Mobile-Ready Applications For Mass Adoption

    08/04/2026

    Mark Zuckerberg’s Meta launches new AI initiative after metaverse retreat

    25/03/2026

    Meta partners with Arm to develop new CPUs for AI deployments

    24/03/2026

    Land values capitulate as $24M metaverse plot collapses to just $9,000

    20/03/2026
  • Regulation

    Top 5 Stablecoins Control 89% of $316B Market as Sector Edges Higher in March 2026

    27/04/2026

    Fed rate cut chance hits zero, threatening stagflation where Bitcoin thrives as a hedge against long term inflation

    27/04/2026

    “Fed Will Keep Interest Rates Unchanged for Two Years”

    26/04/2026

    Bitfarms Rebrand Signals Strong Push Into HPC and AI Data Centers

    26/04/2026

    Jeremy Grantham: The AI investment boom risks overvaluation, historical bubbles provide crucial insights, and value investing’s cyclical nature remains vital

    26/04/2026
  • Other
    1. Exchanges
    2. ICO
    3. GameFi
    4. Mining
    5. Legal
    6. View All

    Alex Wilson: Building crypto payment solutions requires collaboration, Shift4’s dual role enhances market entry, and navigating regulatory landscapes is crucial for success

    26/04/2026

    Infinite Launches Fiat and Stablecoin Bank Accounts Powered by Erebor Bank for US Businesses

    25/04/2026

    Gensyn Network Debuts Delphi, a Permissionless AI Prediction Market Platform, on Mainnet

    25/04/2026

    Moneygram and Stellar Expand USDC Push Amid Stablecoin Growth

    25/04/2026

    South Korea Poised to Lift Ban on Domestic ICOs After 7 Years

    19/12/2025

    Why 2025’s Token Boom Looks Both Familiar and Dangerous

    31/10/2025

    ICO for bitcoin yield farming chain Corn screams we’re so back

    22/01/2025

    Why 2025 Will See the Comeback of the ICO

    26/12/2024

    Tomoland Partners With Anome Protocol To Advance Web3 Gaming Engagement With DeFi Applications

    25/04/2026

    GameFi is effectively dead as 93% of projects collapse

    23/04/2026

    More than 90% of Web3 games failed after $15 billion boom as gamers never showed up: Caladan

    23/04/2026

    UXLINK Taps ANOME Protocol to Redefine Web3 Gaming, SocialFi, and NFTFi

    23/04/2026

    Olenox Announces Merge With CS Digital to Develop Low Cost, Off-Grid Bitcoin Mining Opportunities

    26/04/2026

    Bitdeer Sells All 185.7 BTC Mined This Week, Extending Zero-Holding Strategy

    25/04/2026

    Brazil and Venezuela Show Potential to Grow Latam’s Bitcoin Mining Share

    25/04/2026

    Largest Bank in Brazil Moves to Invest in Bitcoin Mining

    24/04/2026

    Mark Warner: Government and society are unprepared for AI advancements, rising unemployment among recent graduates, and the urgent need for regulatory action

    27/04/2026

    UK invites crypto giant Bybit to London to win over some of UAE’s innovation shine

    26/04/2026

    Prediction Market Lobbying Spend Rises Over 60% as Regulatory Pressure Builds in Washington

    26/04/2026

    New York Attorney General Sues Coinbase, Gemini Over Unlicensed Prediction Markets

    26/04/2026

    Bitcoin Hits $70K Wall as $20M Profit-Taking Caps Rally

    27/04/2026

    Ethereum Faces ‘Moment Of Truth’ As Price Eyes $2,450 Resistance – Breakout Loading?

    27/04/2026

    Top 5 Stablecoins Control 89% of $316B Market as Sector Edges Higher in March 2026

    27/04/2026

    Japan’s Financial Giant Makes Bold Call

    27/04/2026
  • MarketCap
NBTC News
Home»Bitcoin»Bitcoin OP_CAT use cases series #4: Recursive covenants
Bitcoin

Bitcoin OP_CAT use cases series #4: Recursive covenants

NBTCBy NBTC19/07/2024No Comments4 Mins Read
Share
Facebook Twitter LinkedIn Pinterest Email


This post was first published on Medium.

Recursive covenants

As we explained in series #1, a Bitcoin covenant is a mechanism that allows the sender of a Bitcoin transaction to impose certain conditions on how the receiver can spend the coins.

A recursive covenant is a type of covenant that applies not only to the immediate transaction but also to any subsequent transactions that spend the bitcoins. This means that the conditions imposed by the covenant could be enforced recursively in perpetuity.

The main difference between a regular non-recursive covenant and a recursive covenant is the scope of the conditions. A regular covenant only applies to the immediate next transaction, while a recursive one extends to all future transactions that spend the bitcoins.

Here’s a simple example to illustrate the difference:

  • Regular covenant: Alice sends Bob 1 BTC with the condition that Bob can only spend the BTC if he provides a valid signature from a specific public key. This condition only applies to the immediate transaction.
  • Recursive covenant: Alice sends Bob 1 BTC with the condition that Bob can only spend the BTC if he provides a valid signature from a specific public key, and that any future transactions spending the BTC must also provide a valid signature from the same public key. This condition applies to all future transactions that spend the BTC.

Recursive covenants can be more powerful and flexible than regular covenants. They represent a significant step forward in the programmability and flexibility of Bitcoin transactions, potentially opening up a wide array of new applications and use cases. For instance, they allow implementing more complex transaction logic required for interoperability with sidechains or other Layer 2 solutions.

Bitcoin smart contracts with state

In Bitcoin’s UTXO model, smart contracts are inherently one-off and stateless, as the UTXO containing the contract is consumed and destroyed when spent. Recursive covenants introduce a form of state that can be maintained and updated across multiple transactions. When a transaction spends a UTXO (Unspent Transaction Output) containing a stateful contract, the state of the contract is updated, and the new state is stored in the output of the spending transaction, all enforced by recursive covenants. Unlike traditional Bitcoin transactions, which are stateless and immutable once confirmed, stateful smart contracts enable the tracking and modification of state over time, akin to smart contracts on other blockchain platforms like Ethereum.

Let us illustrate how it works with a simple counter contract. This basic contract maintains a single state: how many times it has been called since deployment.

TX0, TX1 and TX2 screenshot

Counter in a chain of transactions with state 0, 1, and 2

The state is stored in an adjacent output next to the output containing the contract itself. More specifically, it is in an OP_RETURN output.

OP_RETURN OP_PUSHBYTES [counter value]

The Counter contract below resides in a Taproot output. There are two tricks worth highlighting:

  1. We choose to store state in a separate output, instead of the same taproot output. This allows us to avoid tweaking the taproot address in the contract, since the address remains unchanged. Tweaking involves heavy elliptic curve arithmetic, which necessitates either excessively long script or new opcode like OP_TAPLEAF_UPDATE_VERIFY/OP_TLUV.
  2. We use covenant to get the txid of the previous transaction, which in turns allows us to parse the raw transaction and access its outputs.

Counter contract

The contract ensure the spending transactions satisfy the following properties:

  • recursive covenant: the address of the first input is identical to the address of the first output
  • state transition: the second output (i.e., the state output) of the current transaction must have a counter value exactly one larger than that in the previous transaction’s second output
  • having one input and one two outputs

A single run results in the following transactions:

  • Deploy Transaction ID with initial state 0: https://mempool.space/signet/tx/142782e6dd8ffcf06554b8222637c237a65f47aab27c373da3ddd7b46cd8428c?source=post_page—–6a3127a24af4——————————–
  • Transaction ID with state 1 after incremented once: https://mempool.space/signet/tx/1d1112a7ba7d3dde969006ab3984564b67b5060d1d323d2d2bf963069b600f20?source=post_page—–6a3127a24af4——————————–
  • Transaction ID with state 2 after incremented twice: https://mempool.space/signet/tx/01a5ed59ec9497ec82d80dc2ba41025342d66a25eec6b4046ec5b8c4964295d1?source=post_page—–6a3127a24af4——————————–

Full code can be found at https://github.com/sCrypt-Inc/scrypt-btc-counter.

More sophisticated state machines can be implemented similarly, where state transition is enforced entirely on chain. There can be alternative places and ways to store and encode states, different from the counter contract.

Watch: Tokens on Bitcoin? One Sat Ordinals and sCrypt

Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
NBTC

Related Posts

Bitcoin Hits $70K Wall as $20M Profit-Taking Caps Rally

27/04/2026

Rushed quantum fix may backfire for Bitcoin, Samson Mow warns

27/04/2026

Bitcoin is Predicted to Reach $ 75,157 By Apr 10, 2026

26/04/2026

“BTC’s Net Inflation Rate Has Turned Negative”

26/04/2026
Add A Comment

Comments are closed.

Top Posts
Get Informed

Subscribe to Updates

Get the latest news from NBTC regarding crypto, blockchains and web3 related topics.

Your source for the serious news. This website is crafted specifically to for crazy and hot cryptonews. Visit our main page for more tons of news.

We're social. Connect with us:

Facebook X (Twitter) LinkedIn RSS
Top Insights

Bitcoin Hits $70K Wall as $20M Profit-Taking Caps Rally

27/04/2026

Ethereum Faces ‘Moment Of Truth’ As Price Eyes $2,450 Resistance – Breakout Loading?

27/04/2026

Top 5 Stablecoins Control 89% of $316B Market as Sector Edges Higher in March 2026

27/04/2026
Get Informed

Subscribe to Updates

Get the latest news from NBTC regarding crypto, blockchains and web3 related topics.

Type above and press Enter to search. Press Esc to cancel.