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

Solana Advances with USDC Payment Integration

09/07/2026

Bitcoin just broke below the floor of its famous Rainbow Chart into the ‘BTC is dead’ zone

09/07/2026

Uniswap integrated Sky’s LitePeg to enable 1:1 swaps among DAI, USDS and USDC

09/07/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 just broke below the floor of its famous Rainbow Chart into the ‘BTC is dead’ zone

    09/07/2026

    European Company Managing $11 Billion Reveals Bitcoin (BTC) Year-End 2026 Price Prediction! Bull or Bear?

    09/07/2026

    Why the Electronic Cash Narrative is Making a Comeback

    09/07/2026

    Here Is How Michael Saylor Can Actually Save Strategy

    09/07/2026

    ETH Tests $1,800 Breakout Level

    09/07/2026

    Ethereum is about to replace itself: Inside the Lean Rebuild

    09/07/2026

    Ether climbs toward $2K as Bitmine buys ETH, Robinhood L2 boost

    09/07/2026

    Ethereum climbs toward $1800 – THESE 2 metrics flash caution

    09/07/2026

    Bitcoin Pioneer Adam Back Questions Telegram Founder Durov Over GRAM Token Supply

    09/07/2026

    Week in Review – June 8 – June 14

    09/07/2026

    Ripple’s RLUSD on Top 9 Stablecoin List: New Milestone Reached

    09/07/2026

    Is 2026 the Year of Stellar XLM? The Biggest Updates From the Year So Far

    09/07/2026

    BIG3 NFT Buyers Sue Ice Cube’s Basketball League Over Alleged Unfulfilled Promises

    08/07/2026

    Cristiano Ronaldo Retirement Puts Billion-Dollar NFT Market to the Test

    06/07/2026

    Bonk-Owned NFT Marketplace Exchange Art to Shut Down on August 1

    04/07/2026

    Element NFT Marketplace Expands Reach to Ink to Enhance NFT Accessibility

    27/06/2026

    Solana Advances with USDC Payment Integration

    09/07/2026

    Bitcoin just broke below the floor of its famous Rainbow Chart into the ‘BTC is dead’ zone

    09/07/2026

    Uniswap integrated Sky’s LitePeg to enable 1:1 swaps among DAI, USDS and USDC

    09/07/2026

    ETH Tests $1,800 Breakout Level

    09/07/2026
  • Blockchain

    South Korean consortium completes digital local currency pilot on Kaia blockchain

    08/07/2026

    XRP Ledger Missing From Stablecoin Data as Ethereum and Tron Dominate With 81% Share

    08/07/2026

    Meme coin trading lifts Solana addresses 38%, BNB Chain volume 45%

    08/07/2026

    What Is a Stablechain? Payment Blockchains Explained

    08/07/2026

    UNDP signed agreement with Stellar to scale blockchain payments after pilots in 5 countries

    08/07/2026
  • DeFi

    Uniswap integrated Sky’s LitePeg to enable 1:1 swaps among DAI, USDS and USDC

    09/07/2026

    Nado expands xPoint rewards for xStocks users on Ink Chain

    09/07/2026

    Aave rolls out vaults for yield-hungry fintech investors

    09/07/2026

    Is Monad’s record $477mln TVL organic or incentive-driven? Assessing…

    08/07/2026

    Uniswap floats extending UNIfication burns to v4 pools

    08/07/2026
  • Metaverse

    Is Solana Gaming Back? Kintara Activity Fuels Renewed Optimism in Onchain MMOs

    24/06/2026

    The Sandbox launches AI game engine ‘The Sandbox Studio’ for next-generation creators

    10/06/2026

    Meta commits $13M in funding for Oversight Board through 2028

    29/05/2026

    Why Animoca’s Yat Siu says the future is 100 billion AI agents

    07/05/2026

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

    18/04/2026
  • Regulation

    Keel Infrastructure upsizes convertible note offering to $400 million amid strong demand

    09/07/2026

    Are retail traders selling their bitcoin to buy the SpaceX IPO?

    09/07/2026

    AI Stocks Now Make Up 40% of the U.S. Market

    09/07/2026

    Tether Designates Independent Director to Twenty One Capital’s Board

    09/07/2026

    A crypto pioneer who turned a $20 million family stake into a billion-dollar fund doubles down on bitcoin

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

    Solana Advances with USDC Payment Integration

    09/07/2026

    France World Cup Winning Odds Climb to 35% as Polymarket Volume Tops $3.9 Billion

    09/07/2026

    Open USD Stablecoin Puts Circle And Tether On Notice

    09/07/2026

    OKX Ventures Secures 20% Stake in Coinone, Becoming Joint Third-Largest Shareholder

    09/07/2026

    ICO market slows sharply with only six completions in 2026

    30/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

    Yield Guild Games Sunsets YGG Play Publishing Unit, Cuts 35 Jobs

    06/07/2026

    GO1 and Xiaohai Set up Potential Rematch at EWC 2026 Fatal Fury Bracket in Paris

    06/07/2026

    Nexus Acquires Homegrown App Marketplace One Store, Expanding into Global Web3 Game Hub

    21/06/2026

    GMATRIXS and Plum Protocol Partner to Blend GameFi with Meme Assets, Driving Multi-Chain Web3 User Experience

    16/06/2026

    Bitcoin miners have until 2027 to prove they deserve power on America’s overloaded grid

    09/07/2026

    Malaysia raids lead to seizure of 75,578 crypto mining rigs

    09/07/2026

    Malaysian Sweep in Crypto Mining Strikes at Illegal Operations

    08/07/2026

    Galaxy turns Helios Bitcoin mine into AI hub for CoreWeave

    08/07/2026

    Prediction Markets Price Platner’s Maine Senate Exit as All but Certain by Late July

    09/07/2026

    US Judge Denies Kalshi Bid to Block New York Sports Betting Regulations

    09/07/2026

    Satoshi Ownership Lawsuit Fails

    09/07/2026

    EU to again vote to extend ‘chat control’ rules

    09/07/2026

    Solana Advances with USDC Payment Integration

    09/07/2026

    Bitcoin just broke below the floor of its famous Rainbow Chart into the ‘BTC is dead’ zone

    09/07/2026

    Uniswap integrated Sky’s LitePeg to enable 1:1 swaps among DAI, USDS and USDC

    09/07/2026

    ETH Tests $1,800 Breakout Level

    09/07/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

NBTC is the editorial account for NBTC News, covering Bitcoin, Ethereum, DeFi, blockchain infrastructure, exchanges, mining, regulation and digital asset markets. The editorial team focuses on clear sourcing, timely updates and practical context for crypto readers.

Related Posts

Bitcoin just broke below the floor of its famous Rainbow Chart into the ‘BTC is dead’ zone

09/07/2026

European Company Managing $11 Billion Reveals Bitcoin (BTC) Year-End 2026 Price Prediction! Bull or Bear?

09/07/2026

Why the Electronic Cash Narrative is Making a Comeback

09/07/2026

Here Is How Michael Saylor Can Actually Save Strategy

09/07/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

Solana Advances with USDC Payment Integration

09/07/2026

Bitcoin just broke below the floor of its famous Rainbow Chart into the ‘BTC is dead’ zone

09/07/2026

Uniswap integrated Sky’s LitePeg to enable 1:1 swaps among DAI, USDS and USDC

09/07/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.