Timelock Awareness and Native Support for Attached UTXOs #165
StampBlaster5000
started this conversation in
CIPs
Replies: 1 comment
|
Oooh good idea! |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Status: Draft
Created: 2026-03-17
References: PSBT Support via attaching assets to UTXOs
Motivation: Counterparty’s UTXO attachment + PSBT atomic swaps unlocked real marketplace trading. Timelocks now let us add powerful safety and new patterns:
Without protocol awareness, timelocked listings create failed PSBT orders and confusion. Bitcoin enforces the timelock, but Counterparty’s indexer, API, and compose endpoints have zero awareness of CLTV, CSV, or nLockTime. The result is broken PSBT orders and no protocol-level visibility. We can fix this with minimal, backward-compatible changes — Bitcoin still does all the enforcement. This CIP makes them first-class and visible, empowering utxo bound assets with Bitcoin's Trustless vaults.
Proposed Changes
(indexer stores timelock data, API exposes it, new attach_with_timelock compose endpoint, optional new message)
Indexer / Database
When processing ATTACH_TO_UTXO (or the new message below), parse:
Store in utxos table.
API Extensions (fully backward-compatible)

/v2/utxos/ and balance endpoints add:
Optional New Protocol Message
Advanced: HTLC Support (optional extension, zero extra cost)
HTLCs (Hashed Timelock Contracts) combine a hashlock (reveal secret preimage) + timelock (CLTV or CSV). They enable conditional atomic trades, escrows, and cross-chain swaps directly on attached Counterparty assets.
If the indexer already parses CLTV/CSV for pure timelocks, HTLC detection comes for free (just look for the common sha256(...) + timelock branch pattern). Marketplaces can then show:

Wallet & Marketplace Behaviour
Benefits
Implementation Notes
All reactions