-
Notifications
You must be signed in to change notification settings - Fork 0
HTLCs
This NIP proposes a method for creating, publishing, and trustlessly trading digital goods on Nostr using the Bitcoin blockchain. It leverages OP_RETURN for anchoring asset metadata and uses Hashed Time-Locked Contracts (HTLCs) for secure, trust-minimized transfers.
To enable decentralized digital commerce, artists and creators need a way to register, advertise, and exchange digital assets securely and transparently, without centralized platforms. This NIP outlines a trustless protocol that ties together Nostr and Bitcoin.
- Digital Good: A unique digital item (e.g., artwork, document, music file) that can be owned and transferred.
- OP_RETURN: A Bitcoin script opcode used to embed metadata in transactions.
- HTLC (Hashed Time-Locked Contract): A Bitcoin smart contract that allows conditional payments based on time and cryptographic hash preimages.
- Relay: A Nostr server that propagates and stores events.
- Assign a unique name/ID to each digital item.
- Prepare a JSON metadata object with fields like:
namedescriptioncreator_pubkeytimestamp-
hash(of the content or preview)
- Broadcast a Bitcoin transaction with an
OP_RETURNoutput containing a compact representation (e.g., hash or CID) of the digital good's metadata. - The
OP_RETURNrecord serves as an immutable on-chain anchor. - Specific encoding formats and usage of
OP_RETURNwill be covered in a separate NIP.
- Post a Nostr event with kind
XYZ(TBD) referencing the asset, including:- A
dtag with the unique name or identifier - A
descriptionfield - A
price - A reference to the Bitcoin
OP_RETURNtransaction ID - Optional contact/public key for negotiation or HTLC coordination
- A
- Buyer and seller negotiate terms via Nostr DM or out-of-band.
- Buyer creates an HTLC on Bitcoin with the agreed price and time lock.
- Seller reveals the preimage (e.g., a key to unlock the asset or proof of ownership) to claim the funds.
- Buyer then uses the preimage to finalize ownership.
- A new Nostr event is published by the buyer or seller indicating the transfer of ownership.
- Relays can update listings to reflect the new owner, timestamp, and optionally append to a chain of custody/history.
In the case of digital art or similar assets, the actual content can be stored in decentralized or cloud-based storage systems. For example:
- Blossom: A privacy-respecting storage system compatible with Nostr principles.
- Other cloud storage solutions: Such as IPFS, Arweave, or encrypted S3 buckets, depending on user preference.
The metadata should include references (e.g., URLs, CIDs) to where the content is stored.
- HTLC usage must be carefully implemented to avoid loss of funds.
- Relays must filter/verify ownership claims based on on-chain data.
- Metadata and asset claims should be cryptographically signed.
- Standardize metadata schema for digital goods.
- Define a canonical Nostr kind for these commerce events.