Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
LABS
Glossary

Programmable Covenant

A Programmable Covenant is a smart contract that encodes restrictive rules governing the future use or transfer of a digital asset, such as a token.
Chainscore © 2026
definition
BLOCKCHAIN SMART CONTRACT

What is a Programmable Covenant?

A Programmable Covenant is a specialized smart contract that enforces predefined rules on how a user's assets can be spent, restricting future transactions to a specific set of conditions.

A Programmable Covenant is a type of smart contract that imposes spending constraints on UTXOs (Unspent Transaction Outputs) or account balances, limiting their use to a defined set of future transactions. Unlike standard smart contracts that execute arbitrary logic upon invocation, covenants are proscriptive: they dictate what can be done with the assets in the future, often requiring that outputs from a transaction themselves contain new covenant conditions. This creates a chain of enforced rules, enabling complex, stateful protocols directly on the base layer of a blockchain like Bitcoin or Ethereum.

The core mechanism involves embedding validation logic that checks not only the current transaction's signatures but also the structure and scripts of its outputs. Common implementations use OP_CHECKTEMPLATEVERIFY (CTV) in Bitcoin or similar pattern-matching opcodes to enforce that funds can only be sent to a specific script hash or a set of pre-approved subsequent transactions. This enables powerful primitives such as vaults for enhanced security (requiring a timelocked withdrawal), payment pools, congestion-controlled transactions, and non-custodial peer-to-peer derivatives without relying on centralized intermediaries.

From a technical perspective, programmable covenants enhance blockchain functionality by enabling recursive enforceability and off-chain protocol design. They allow developers to construct decentralized applications with guaranteed execution paths, reducing the need for active, trust-based coordination. Key considerations include the trade-off between increased functionality and potential constraints on fungibility, as covenanted coins are not freely spendable. Their development represents a significant evolution in extending the programmability of primarily value-transfer blockchains like Bitcoin beyond simple multi-signature schemes.

how-it-works
MECHANICS

How Do Programmable Covenants Work?

An explanation of the technical mechanisms that enable and enforce programmable covenants on blockchain networks.

A programmable covenant is a smart contract or script that enforces spending conditions on a blockchain's native asset, such as Bitcoin or Litecoin, by restricting how its UTXOs can be spent in future transactions. Unlike standard transactions that only require a valid cryptographic signature, a covenant embeds rules directly into the output script, creating a stateful constraint that travels with the coin. This is achieved through opcodes like OP_CHECKTEMPLATEVERIFY (CTV) or via recursive covenants in systems like Bitcoin Script or Simplicity, which allow the output to inspect and validate the structure of the transaction that spends it.

The core mechanism involves output introspection, where the locking script can examine specific fields of the spending transaction before allowing it to be valid. For example, a covenant can mandate that funds can only be sent to a predetermined address, or that they must be split into specific amounts. This creates a self-contained state machine where the coin's entire future transaction graph is predefined. Implementation often requires a soft fork to introduce new opcodes, as seen with CTV proposals, or leverages existing but limited opcodes in a clever, recursive manner to simulate more complex conditions.

From a developer's perspective, building with covenants involves designing the constraint logic and encoding it into the output's scriptPubKey. A common pattern is the vault covenant, where funds can only be withdrawn to a "hot" wallet after a timelock delay, providing enhanced security against theft. Another is congestion control, where a covenant ensures transaction fees are paid from a specific set of inputs. The execution is deterministic and trustless; the network nodes validate that every spending transaction strictly adheres to the pre-committed rules embedded in the parent UTXO.

Key technical challenges include avoiding infinite recursion—where a covenant could create an unspendable output—and managing state bloat on the blockchain. Solutions involve carefully designing covenant logic to have a finite termination condition. Furthermore, the privacy implications are significant, as the publicly visible script reveals the future flow of funds. Despite these challenges, programmable covenants enable powerful new DeFi primitives on UTXO-based chains, such as non-custodial escrows, decentralized exchanges, and structured financial products without relying on a separate token or sidechain.

key-features
CORE MECHANICS

Key Features of Programmable Covenants

Programmable covenants are smart contract-like conditions embedded directly into Bitcoin transactions, enabling complex spending logic without altering the base protocol. They enforce rules on how UTXOs can be spent in the future.

01

Stateful Spending Conditions

Programmable covenants encode stateful logic directly into a transaction output, dictating the precise conditions under which the funds can be spent next. This is a fundamental shift from Bitcoin's default model, where an output can be spent by anyone with the correct signature. Key mechanisms include:

  • Vaults & Delayed Withdrawals: Enforce a mandatory time-locked "cooling-off" period before large withdrawals.
  • Recovery Paths: Predefine alternative spending paths for key loss or security breaches.
  • Spending Limits: Cap the amount that can be transferred in a single transaction.
02

Transaction Graph Constraint

A core feature is the ability to constrain the shape of the transaction graph. The covenant can specify properties of the next transaction, such as:

  • Output Script Templates: The covenant can enforce that funds must be sent to a specific type of address or script.
  • Amount Control: It can require that a certain minimum amount remains in a covenant-controlled output, enabling recursive or looping logic.
  • Fee Limits: It can impose constraints on the miner fee of the subsequent transaction. This creates a chain of pre-authorized transactions, enabling complex multi-step protocols.
03

Protocol-Level Enforceability

Unlike off-chain agreements or centralized custodians, programmable covenants are enforced at the consensus layer. The rules are written into the scriptPubKey or taproot leaf and are validated by every full node on the network. This provides:

  • Cryptographic Guarantees: Breach of the covenant's rules is mathematically impossible; the network will reject any non-compliant spending transaction.
  • Trust Minimization: Eliminates reliance on third-party watchtowers or honest majority assumptions for security.
  • Global Verifiability: Anyone can audit the covenant's rules by inspecting the on-chain script.
04

Implementation via OP_CHECKTEMPLATEVERIFY

The proposed Bitcoin soft fork OP_CHECKTEMPLATEVERIFY (CTV) is a canonical implementation path for simple covenants. It enables a specific form of covenant by allowing a script to commit to the hash of a transaction template. Key aspects:

  • Non-Turing-Complete: CTV is intentionally limited to prevent unbounded computation, aligning with Bitcoin's security philosophy.
  • Template Commitment: The output commits to the hash of a specific future transaction's core fields (version, locktime, sequences, outputs).
  • Use Cases: Powers congestion-controlled transactions, non-interactive payment pools, and simplified vault constructions without recursive script execution.
05

Enhanced Custody & Security Models

Covenants enable revolutionary self-custody security models that were previously impossible. They allow users to impose their own security policies directly on their bitcoin.

  • Recursive Vaults: Funds can be programmed to always return to a more secure, time-locked state after any action, creating a defensive "backstop."
  • Fraud Monitoring Delegation: A "watchtower" can be authorized via covenant to move funds to a safe address if fraud is detected, without ever holding custody.
  • Inheritance Planning: Pre-programmed, time-released transfers can be set up without needing a will or third-party executor.
06

Decentralized Finance Primitives

By enabling conditional and multi-step logic on-chain, covenants create foundational DeFi primitives for Bitcoin.

  • Non-Custodial Escrow: Two-party agreements where funds are released only upon mutual consent or a timeout, enforceable by code.
  • Peer-to-Peer Derivatives: Simple options or futures contracts can be collateralized and settled automatically on-chain.
  • Decentralized Exchanges (DEX): Enable atomic swap-like protocols with improved liquidity and order book functionality through constructions like payment pools.
  • Structured Products: Enable the creation of tokens representing shares in a covenant-controlled pool of bitcoin with defined redemption rules.
examples
PROGRAMMABLE COVENANT

Examples & Use Cases

Programmable covenants enable complex, conditional logic to be embedded directly into the spending conditions of a UTXO, unlocking a wide range of advanced blockchain applications.

02

Decentralized Exchange (DEX) Orders

Covenants can power non-custodial, on-chain order books. A user can lock funds in a UTXO with a covenant that states: "These funds can only be spent in a transaction that provides a valid signature from a specific counterparty AND delivers a specified amount of another asset." This creates a trustless limit order that is executed atomically without relying on a central operator or complex smart contract layers.

03

Recoverable Wallets & Inheritance

Covenants enable sophisticated wallet recovery schemes. A wallet can be programmed so that after a period of inactivity (e.g., 6 months), the spending authority automatically shifts from the primary private key to a set of backup keys held by family members or a legal entity. This logic is enforced on-chain, providing a decentralized solution for inheritance and key loss prevention without a central service.

05

CoinJoin & Privacy Enhancements

Covenants can enforce participation in CoinJoin transactions to improve privacy. A UTXO can be created with a rule that it must be spent in a transaction with at least 5 other specific input types (other covenant-bound UTXOs). This forces coins to be mixed according to a predefined protocol, reducing the ability for chain analysis to trace funds and enabling stronger, protocol-level privacy guarantees.

06

Structured Financial Products

Covenants can encode the rules for bonds, options, or recurring payments. For instance, a bond covenant could automatically distribute coupon payments to token holders at specific block heights, with the principal repayable only after maturity. This creates self-executing financial instruments on a base layer, reducing counterparty risk and operational overhead compared to traditional systems.

technical-implementation
PROGRAMMABLE COVENANT

Technical Implementation

A deep dive into the architectural principles and execution mechanics that enable programmable covenants, moving from conceptual constraints to on-chain enforcement.

A programmable covenant is a smart contract or script that imposes spending conditions on a specific UTXO, restricting how its funds can be spent in future transactions, thereby enabling complex, stateful logic directly on the base layer. Unlike simple multi-signature schemes, covenants embed the logic for future state transitions within the locking script itself, creating a deterministic path for the movement of assets. This is achieved by inspecting and constraining the data in the transaction's outputs, such as requiring funds to be sent to a specific address, held for a time-lock, or used only within a predefined set of subsequent contracts.

The technical implementation hinges on the ability of a script to introspect the transaction context in which it is being spent. This is enabled by opcodes like OP_CHECKSIGFROMSTACK (in Bitcoin-like systems) or through more direct introspection capabilities in virtual machines like the Ethereum Virtual Machine (EVM). The covenant script validates not only signatures but also parses the proposed spending transaction's outputs, enforcing rules on their scriptPubKey or data fields. For example, a vault covenant might require that any spend first moves funds to a time-locked recovery address, a condition verified by checking the output scripts in the transaction that is attempting to unlock the vault UTXO.

Advanced implementations leverage recursive covenants and state trees to create sophisticated applications. A recursive covenant enforces that its output contains a new, slightly updated instance of the same covenant script, allowing for multi-step state machines. This can be used to build payment pools, decentralized exchanges (DEXs) with on-chain order books, or non-custodial sidechains. The security model is paramount, as bugs in covenant logic can permanently lock funds; thus, implementations often use formal verification and extensive auditing. The evolution of covenant-capable opcodes, such as those proposed in Bitcoin upgrades like OP_CTV (CheckTemplateVerify) or OP_VAULT, demonstrates the ongoing refinement of this powerful primitive for base-layer programmability.

ecosystem-usage
PROGRAMMABLE COVENANT

Ecosystem Usage & Protocols

Programmable covenants are a class of smart contracts that enforce spending conditions on a specific set of assets, enabling complex, self-contained financial logic without relying on external state.

01

Core Mechanism

A programmable covenant is a smart contract that places constraints on how a specific UTXO (Unspent Transaction Output) can be spent in the future. Unlike general-purpose contracts, its logic is bound to the asset itself, creating a self-contained state machine. Key components include:

  • Stateful Logic: The contract's internal state (e.g., a counter, a hash) is stored directly within the UTXO.
  • Pre-signed Transactions: Often uses a set of pre-defined, partially-signed transaction templates that are the only valid spending paths.
  • Deterministic Execution: The outcome is fully determined by the current state and the spending input, enhancing predictability and security.
02

Vaults & Security

A primary use case is creating recovery vaults or time-locked wallets. These covenants enforce multi-signature rules and introduce mandatory delay periods for large withdrawals. For example:

  • A withdrawal may require 2-of-3 signatures.
  • If a "fast" key is used, a 24-hour timelock is triggered, allowing a separate set of guardian keys to freeze the transaction.
  • This design mitigates theft by introducing a cooling-off period for suspicious transactions, a significant improvement over simple multisig.
03

Decentralized Exchanges (DEX)

Covenants enable non-custodial trading protocols without centralized order books. In a covenant-based DEX:

  • Liquidity is locked in a covenant that only allows swaps following a specific constant product formula (e.g., x*y=k).
  • The covenant validates swap transactions directly, ensuring the pool's rules are enforced at the protocol level.
  • This creates trust-minimized Automated Market Makers (AMMs) where the liquidity cannot be withdrawn except as defined by the covenant's immutable logic.
04

Payment Pools & Channels

Covenants are foundational for scalable payment systems like payment pools and state channels. They allow multiple users to fund a single UTXO with rules governing how it can be redistributed.

  • Key Features:
    • Users can join/exit without on-chain transactions for every update.
    • Internal balances are managed off-chain, with the covenant enforcing the final settlement.
    • Enables complex routing protocols for instant, low-fee micropayments across a network, similar to the Lightning Network but with different technical trade-offs.
05

Non-Fungible Tokens (NFTs)

Covenants enable native NFTs with embedded logic, moving beyond simple ownership records. The NFT itself can enforce rules for its future sale or use.

  • Example Applications:
    • Royalty Enforcement: A covenant can mandate that a percentage of any sale is sent to the creator's address, enforceable at the protocol level.
    • Licensing Logic: The NFT could contain code that restricts transfers unless certain conditions are met.
    • This creates programmable digital assets whose behavior is intrinsic, not dependent on a marketplace's policy.
06

Implementation: Bitcoin vs. Altcoins

Implementation varies by blockchain due to differing scripting capabilities.

  • Bitcoin: Requires creative use of OP_CHECKTEMPLATEVERIFY (CTV) or Taproot with ANYPREVOUT to simulate covenants, as direct recursive covenant opcodes are not present.
  • Ethereum & EVM Chains: Achieved through delegatecall patterns or storing logic in proxy contract storage slots, though not as UTXO-native.
  • Utxo-based Altcoins (e.g., Stacks, Liquid): Some have explicit covenant opcodes (like cltv in Clarity) that make these constructs more straightforward and efficient to implement.
security-considerations
PROGRAMMABLE COVENANT

Security Considerations

Programmable covenants introduce powerful new capabilities for controlling on-chain assets, but they also create novel security vectors that must be carefully evaluated by developers and auditors.

01

Logic Immutability & Upgrade Risks

Once deployed, a covenant's logic is typically immutable. This creates a critical trade-off:

  • Permanent Bugs: A logic error or vulnerability is frozen on-chain, potentially locking or exposing funds forever.
  • Upgrade Mechanisms: If an upgrade path is included (e.g., via a multisig), it introduces a centralization risk and becomes a high-value attack target.
  • Example: A flawed withdrawal condition could make assets permanently inaccessible.
02

Oracle & Data Dependency Risks

Covenants often rely on external data (oracles) to trigger state changes, creating significant attack surfaces:

  • Oracle Manipulation: An attacker compromising the data feed (e.g., price oracle) can trigger unauthorized covenant actions.
  • Data Liveness: If the required external data becomes unavailable, the covenant may be bricked, freezing assets.
  • Solution: Use decentralized oracle networks and implement circuit breakers for critical price dependencies.
03

Complexity & Audit Surface

The expressiveness of covenants increases system complexity, which is inversely proportional to security.

  • State Explosion: Managing numerous conditional states and paths increases the chance of unhandled edge cases.
  • Composability Risks: Interacting with other smart contracts (DeFi protocols) can lead to reentrancy or unexpected interactions.
  • Best Practice: Formal verification and exhaustive property-based testing are recommended for complex covenant logic.
04

Key Management & Authorization

Covenants delegate authority through cryptographic proofs, shifting key management challenges.

  • Signature Logic Flaws: Bugs in the multisig or threshold signature verification can allow unauthorized spends.
  • Key Loss: If a covenant's spending condition requires an n-of-m multisig and keys are lost, funds may become unrecoverable.
  • Social Engineering: The rules themselves (e.g., "transfer to this address after 90 days") can be targeted for manipulation off-chain.
05

Transaction Malleability & Replay

The specific construction of covenant-enforced transactions can introduce new vulnerabilities.

  • Fee Bumping Attacks: A malicious actor might front-run or replace a covenant transaction by paying a higher fee, altering the intended outcome.
  • Chain Reorgs: A blockchain reorganization could invalidate a transaction that a covenant's state depends on, requiring logic to handle reorg resilience.
  • Solution: Use anti-malleability techniques and sequence numbers, and design for probabilistic finality.
06

Privacy & Surveillance Risks

The transparent nature of covenants on a public blockchain creates unique privacy concerns.

  • Wealth Identification: Covenants can make high-value, long-term locked assets easily identifiable on-chain, painting a target for attacks.
  • Pattern Analysis: The predictable flow of funds according to public rules allows for sophisticated chain analysis, potentially deanonymizing users.
  • Mitigation: Techniques like Scriptless Scripts or integration with privacy-preserving L2s can help obfuscate covenant logic and state.
ARCHITECTURAL DIFFERENCES

Comparison: Covenants vs. Standard Smart Contracts

A technical comparison of the core properties, capabilities, and trade-offs between blockchain covenants and standard smart contracts.

FeatureCovenantsStandard Smart Contracts

Primary Function

Enforce spending conditions on a specific UTXO or output

Execute arbitrary logic and manage on-chain state

Scope of Control

Single UTXO or transaction output

Contract's internal state and any funds sent to its address

State Management

Stateless; conditions are validated per transaction

Stateful; maintains persistent storage on-chain

Composability

Chained via transaction graphs; limited inter-covenant calls

High; contracts can call and interact with other contracts

Development Paradigm

Constraint-based programming

General-purpose, Turing-complete programming

Typical Use Case

Vaults, payment pools, non-custodial escrow

DeFi protocols, DAOs, NFTs, decentralized applications

Privacy Implications

Higher; logic is in spending conditions, not published state

Lower; contract logic and often state are fully public

Example Implementation

Bitcoin Script (CheckTemplateVerify), Taproot Trees

Ethereum Solidity, Solana Rust, Avalanche Go

PROGRAMMABLE COVENANTS

Frequently Asked Questions (FAQ)

Programmable covenants are a powerful and advanced blockchain primitive that enable conditional control over assets. This FAQ addresses common technical questions about their mechanics, applications, and current ecosystem status.

A programmable covenant is a smart contract or script that imposes persistent, conditional rules on how a digital asset, like a UTXO or token, can be spent or transferred in the future. Unlike a standard transaction that simply sends value from A to B, a covenant embeds logic into the asset itself, restricting its future movement to a predefined set of valid transactions. This is achieved by enforcing constraints on the outputs of any spending transaction, such as requiring a specific destination address, a minimum time lock, or a multi-signature authorization. Covenants enable complex, self-enforcing financial agreements directly on-chain.

ENQUIRY

Get In Touch
today.

Our experts will offer a free quote and a 30min call to discuss your project.

NDA Protected
24h Response
Directly to Engineering Team
10+
Protocols Shipped
$20M+
TVL Overall
NDA Protected Directly to Engineering Team
Programmable Covenant: Definition & Use Cases | ChainScore Glossary