<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Privacy Magazine - Bitcoin Takeover</title>
	<atom:link href="https://bitcoin-takeover.com/category/privacy-magazine/feed/" rel="self" type="application/rss+xml" />
	<link>https://bitcoin-takeover.com/</link>
	<description>Independent Bitcoin media by Vlad Costea: long-form podcast interviews, a free open-source magazine, and essays on privacy, scaling and Bitcoin culture.</description>
	<lastBuildDate>Wed, 13 Nov 2024 11:18:49 +0000</lastBuildDate>
	<language>en-US</language>
	<item>
		<title>Decentralized Online Marketplace Protocol (DOMP): Enabling Trustless Marketplaces</title>
		<link>https://bitcoin-takeover.com/domp/</link>
		<dc:creator><![CDATA[Vlad Costea]]></dc:creator>
		<pubDate>Wed, 13 Nov 2024 11:18:49 +0000</pubDate>
		<category><![CDATA[Articles]]></category>
		<category><![CDATA[Bitcoin]]></category>
		<category><![CDATA[Privacy Magazine]]></category>
		<guid isPermaLink="false">https://bitcoin-takeover.com/?p=13983</guid>
		<description><![CDATA[<p>● Abstract ● Introduction ● Background ○ Bitcoin and the Lightning Network ○ Nostr Protocol ● Anti-Spam Measures ● Defined Event Types…</p>]]></description>
		<content:encoded><![CDATA[<p class="wp-block-paragraph"><strong><em>● Abstract</em></strong></p>
<p class="wp-block-paragraph"><strong><em>● Introduction</em></strong></p>
<p class="wp-block-paragraph"><strong><em>● Background</em></strong></p>
<p class="wp-block-paragraph"><strong><em>○ Bitcoin and the Lightning Network</em></strong></p>
<p class="wp-block-paragraph"><strong><em>○ Nostr Protocol</em></strong></p>
<p class="wp-block-paragraph"><strong><em>● Anti-Spam Measures</em></strong></p>
<p class="wp-block-paragraph"><strong><em>● Defined Event Types</em></strong></p>
<p class="wp-block-paragraph"><strong><em>● Comprehensive Transaction Workflow</em></strong></p>
<p class="wp-block-paragraph"><strong><em>● Escrow Mechanism in DOMP</em></strong></p>
<p class="wp-block-paragraph"><strong><em>○ Overview</em></strong></p>
<p class="wp-block-paragraph"><strong><em>○ Detailed Process with Code Examples</em></strong></p>
<p class="wp-block-paragraph"><strong><em>● Reputation System</em></strong></p>
<p class="wp-block-paragraph"><strong><em>○ Storage and Reference</em></strong></p>
<p class="wp-block-paragraph"><strong><em>○ Reputation Calculation</em></strong></p>
<p class="wp-block-paragraph"><strong><em>● Arbitration</em></strong></p>
<p class="wp-block-paragraph"><strong><em>● Scenarios Demonstrating Potential Exchanges</em></strong></p>
<p class="wp-block-paragraph"><strong><em>○ Scenario 1: Successful Transaction</em></strong></p>
<p class="wp-block-paragraph"><strong><em>○ Scenario 2: Buyer Does Not Confirm Receipt</em></strong></p>
<p class="wp-block-paragraph"><strong><em>○ Scenario 3: Seller Fails to Ship the Item</em></strong></p>
<p class="wp-block-paragraph"><strong><em>○ Scenario 4: Arbitration for Dispute Resolution</em></strong></p>
<p class="wp-block-paragraph"><strong><em>● Potential Attack Vectors</em></strong></p>
<p class="wp-block-paragraph"><strong><em>● Conclusion</em></strong></p>
<h2 class="wp-block-heading">Abstract</h2>
<p class="wp-block-paragraph">The Decentralized Online Marketplace Protocol (DOMP) introduces a framework for secure, trustless, and transparent transactions within decentralized online marketplaces. Leveraging Bitcoin’s robustness, the Lightning Network’s efficiency, and the Nostr protocol’s flexibility, DOMP eliminates intermediaries and enhances user trust through innovative mechanisms such as a dual-collateral system, a reputation framework, and an optional arbitration process. By defining specific event types to structure interactions, DOMP ensures secure fund management and mitigates fraud risks inherent in decentralized commerce.</p>
<p class="wp-block-paragraph">Unlike existing protocols, DOMP uniquely addresses challenges of trust and security without relying on third-party escrow services. It employs a combination of cryptographic proofs and mutual agreements to establish an escrow mechanism at the protocol level. Additionally, DOMP implements market-driven anti-spam measures, allowing relays to set their own policies based on network conditions, thereby enhancing resilience and adaptability.</p>
<p class="wp-block-paragraph">By detailing transaction workflows, escrow mechanisms, reputation systems, and mitigation strategies against potential attack vectors, DOMP aims to provide a comprehensive solution for peer-to-peer commerce. It advances the vision of a decentralized marketplace where participants can transact with some amount of confidence and free from censorship.</p>
<p class="wp-block-paragraph"><strong>Background</strong></p>
<p class="wp-block-paragraph"><strong>Bitcoin and the Lightning Network</strong></p>
<p class="wp-block-paragraph">Bitcoin, introduced in 2009, is a decentralized digital currency that enables peer-to-peer transactions without the need for a central authority or intermediary. Its blockchain technology ensures transparency, security, and immutability of transactions. However, Bitcoin’s scalability limitations and transaction fees present challenges for high-frequency or microtransaction-based applications, such as online marketplaces.</p>
<p class="wp-block-paragraph">The Lightning Network (LN) addresses these challenges by introducing an off-chain payment protocol that allows for near-instantaneous and low-fee transactions. By establishing bi-directional payment channels between users, LN enables multiple transactions to occur off the main blockchain, reducing congestion and fees. This scalability solution makes LN particularly well-suited for handling the microtransactions allowing for more flexible client integrations in the future like the possibility of streaming data, CPU cycles, and more.</p>
<p class="wp-block-paragraph"><strong>The Nostr Protocol</strong></p>
<p class="wp-block-paragraph">Nostr (Notes and Other Stuff Transmitted by Relays) is a decentralized, open-source protocol designed for creating and propagating events across a distributed network of relays. Unlike traditional centralized platforms, Nostr operates without central servers, relying instead on a network of relays that store and forward messages. Users publish and subscribe to events using public and private key cryptography, ensuring data integrity and user privacy.</p>
<p class="wp-block-paragraph">Nostr’s resilience against censorship and its flexible, event-driven architecture make it an ideal choice for DOMP’s communication layer. By utilizing Nostr, DOMP facilitates direct interactions between marketplace participants without reliance on centralized infrastructure. As of 2024, Nostr has gained significant traction within the decentralized application community, with growing adoption due to its simplicity and effectiveness in enabling decentralized social networks and communication platforms. Its compatibility with DOMP ensures that the protocol can leverage existing Nostr infrastructure while contributing to its ecosystem.</p>
<p class="wp-block-paragraph"><strong>Anti-Spam Measures</strong></p>
<p class="wp-block-paragraph">In decentralized networks, spam and malicious activities can degrade user experience and network performance. To maintain network integrity and prevent abuse, DOMP incorporates a combination of anti-spam measures. </p>
<ol class="wp-block-list">
<li><strong>Lightning Network (LN) Payments:<br/></strong>DOMP Clients (or individual Nostr Relays) may require small LN payments to incentivize relays for handling and retaining specific events. This economic disincentive increases the cost of spamming, making it financially unattractive for attackers. Users can also rate relays (see section: reputation system) based on reliability, creating a market-driven ecosystem where high-quality relays are rewarded accordingly.</li>
<li><strong>Proof of Work (PoW) via NIP13:<br/></strong>DOMP Clienst (or individual Nostr Relays) may utilize PoW as an alternative, or in addition to, to LN payments, allowing users to perform computational challenges as a resource-based proof. This method is akin to mechanisms used in systems like Hashcash to prevent spam and denial-of-service attacks. Using the Nostr NIP13 standard, DOMP ensures compatibility with existing Nostr implementations. This approach provides users without access to the Bitcoin or Lightning Networks a way to participate, enhancing inclusivity.</li>
<li><strong>Hashing and Event Referencing:<br/></strong>To prevent abuse of the reputation system, DOMP requires certain events—primarily reputation events—to include hashes of valid previous events signed by the user. This ensures that only participants involved in legitimate transactions can influence reputation scores. This method mitigates the risk of Sybil attacks, where an attacker might create multiple fake identities to manipulate the system, a common issue in decentralized protocols.</li>
<li><strong>Relay-Determined Anti-Spam Policies:<br/></strong>Instead of enforcing a one-size-fits-all solution, DOMP allows individual relays to set their own anti-spam requirements, including PoW difficulty or LN payment amounts. This market-driven approach is similar to how email servers implement their own spam filters and policies. It enables relays to adjust their policies based on network conditions, demand, and their capacity, promoting flexibility and resilience. Users can select relays that balance strictness and accessibility according to their preferences.</li>
</ol>
<p class="wp-block-paragraph"><strong>Comparison with Existing Protocols:</strong></p>
<p class="wp-block-paragraph">DOMP’s hybrid approach combines economic incentives and computational proofs.  DOMP’s strategy enhances security and accessibility by reducing barriers to entry while effectively discouraging spam and malicious behavior. By allowing relays to set their own policies, the protocol adapts to varying network conditions and user needs.</p>
<p class="wp-block-paragraph"><strong>Defined Event Types</strong></p>
<p class="wp-block-paragraph">DOMP defines specific event types to structure interactions within the marketplace. Each event includes mandatory fields such as id, pubkey, created_at, sig, and references to previous events where applicable.</p>
<p class="wp-block-paragraph"><strong>Listing and Bidding</strong></p>
<ul class="wp-block-list">
<li><strong>kind-300: Product Listing</strong>: Sellers list products for sale, including details and anti-spam proof.</li>
<li><strong>kind-301: Bid Submission</strong>: Buyers place bids referencing the kind-300 listing.</li>
<li><strong>kind-302: Counter Bid</strong>: Used by either party to propose revised terms during negotiations. This event references a previous bid or counter bid and includes LN invoice and collateral information.</li>
<li><strong>kind-303: Bid Acceptance</strong>: Indicates unconditional acceptance of the bid with the original terms.</li>
</ul>
<p class="wp-block-paragraph"><strong>Note on Merging </strong><strong>kind-302</strong><strong> and </strong><strong>kind-303</strong>: While combining these event types was considered, and could simplify the protocol, we’ve chosen to keep them separate to enhance clarity and user confidence. Having distinct event types allows users to immediately recognize whether terms have changed (kind-302) or if a bid is accepted as-is (kind-303), reducing the risk of misunderstandings.</p>
<p class="wp-block-paragraph"><strong>Payments, Escrow, and Completion</strong></p>
<ul class="wp-block-list">
<li><strong>kind-310: Collateral Deposit</strong>: Logs when a seller deposits collateral.</li>
<li><strong>kind-311: Payment Confirmation</strong>: Buyers confirm payment, activating escrow. This event references collateral deposits from both parties for verification.</li>
<li><strong>kind-312: Escrow Dispute</strong>: Initiated by either party seeking release of funds.</li>
<li><strong>kind-313: Receipt Confirmation</strong>: Buyers confirm item receipt, releasing escrowed funds.</li>
<li><strong>kind-314: Refund Initiation</strong>: Sellers initiate a refund if required.</li>
<li><strong>kind-315: Mutual Agreement</strong>: Logs mutual consent to release funds or cancel the transaction.</li>
<li><strong>kind-316: Arbitration Offer</strong>: A third-party user offers to arbitrate the dispute.</li>
</ul>
<p class="wp-block-paragraph"><strong>Communication and Feedback</strong></p>
<ul class="wp-block-list">
<li><strong>kind-320: Communication Message</strong>: General communication between parties, such as messages, notifications, or updates. Requires PoW, LN payment, or cryptographic link.</li>
<li><strong>kind-321: User Reputation Feedback</strong>: Post-transaction ratings, enhancing transparency. Must reference specific prior events to validate the feedback.</li>
<li><strong>kind-322: Arbitrator Reputation Feedback</strong>: Ratings for arbitrators after dispute resolution.</li>
<li><strong>kind-323: Relay Reputation Feedback</strong>: Ratings for relays based on service quality.</li>
</ul>
<p class="wp-block-paragraph"><strong>Comprehensive Transaction Workflow</strong></p>
<p class="wp-block-paragraph">DOMP’s workflow is designed to streamline interactions between buyers and sellers, using well-defined steps and events. Below, we include code samples for each event kind and discuss the reasoning behind certain design choices.</p>
<p class="wp-block-paragraph">Step 1: Product Listing by Seller (kind-300)</p>
<ul class="wp-block-list">
<li><strong>Upload Product Details</strong>: Sellers provide descriptions and images using HTML links or IPFS Content Identifiers (CIDs).</li>
<li><strong>Relay Selection and Compensation</strong>: Sellers choose multiple Nostr relays to publish their product listings, compensating them according to each relay’s anti-spam requirements.</li>
<li><strong>Event Broadcasting</strong>: Sellers broadcast the kind-300 event containing product details and anti-spam proofs.</li>
</ul>
<p class="wp-block-paragraph">{</p>
<p class="wp-block-paragraph">  “kind”: 300,</p>
<p class="wp-block-paragraph">  “pubkey”: “seller_pubkey”,</p>
<p class="wp-block-paragraph">  “created_at”: 1620000000,</p>
<p class="wp-block-paragraph">  “tags”: [</p>
<p class="wp-block-paragraph">    [“anti_spam_proof”, “LN_payment_hash_or_PoW_proof”]</p>
<p class="wp-block-paragraph">  ],</p>
<p class="wp-block-paragraph">  “content”: “{\”product_name\”: \”Digital Camera\”, \”description\”: \”A high-quality DSLR camera.\”, \”price_satoshis\”: 80000000, \”storage_link\”: \”ipfs://CID\”}”,</p>
<p class="wp-block-paragraph">  “id”: “event_id_300”,</p>
<p class="wp-block-paragraph">  “sig”: “signature_seller_300”</p>
<p class="wp-block-paragraph">}</p>
<p class="wp-block-paragraph">Step 2: Seller Posts Collateral (kind-310)</p>
<ul class="wp-block-list">
<li><strong>Seller Posts Collateral First</strong>: To build buyer confidence and demonstrate commitment, the seller deposits their collateral before the buyer proceeds. This reduces the risk of the seller trolling and encourages serious participation.  Since the seller can refund all funds (including their own collateral) if the buyer stops participating, this poses no additional risk to the seller.</li>
<li><strong>Sequence</strong>: This event would likely be done in conjunction with a kind-300 listing.  It is not necessarily required by the protocol, but may be required by application clients.  As a buyer it would be wise to make sure a seller has posted their collateral to before committing any funds to escrow to make sure the seller has “skin in the game” and cannot just freeze buyers’ funds in escrow as a way to troll online.</li>
<li><strong>Collateral Amounts</strong>:  We imagine seller collateral would generally be a lot less than for buyers since the seller’s collateral is primarily just a spam and trolling control mechanism.  In my thought experiments we usually considered 10% of the purchase price sufficient, although for very large sale prices less would probably suffice, and vice versa for very small sale prices.</li>
</ul>
<p class="wp-block-paragraph">{</p>
<p class="wp-block-paragraph">  “kind”: 310,</p>
<p class="wp-block-paragraph">  “pubkey”: “seller_pubkey”,</p>
<p class="wp-block-paragraph">  “created_at”: 1620000050,</p>
<p class="wp-block-paragraph">  “tags”: [</p>
<p class="wp-block-paragraph">    [“anti_spam_proof”, “ln_payment_hash_seller_collateral”]</p>
<p class="wp-block-paragraph">  ],</p>
<p class="wp-block-paragraph">  “content”: “{\”product_ref\”: \”event_id_300\”, \”collateral_amount_satoshis\”: 8000000}”,</p>
<p class="wp-block-paragraph">  “id”: “event_id_310_seller”,</p>
<p class="wp-block-paragraph">  “sig”: “signature_seller_310”</p>
<p class="wp-block-paragraph">}</p>
<p class="wp-block-paragraph">Step 3: Buyer Submits a Bid (kind-301)</p>
<ul class="wp-block-list">
<li><strong>Bid Discovery</strong>: Buyers find products via subscribing to kind-300 events.  Realistically this would be done through clients who specialize in these kinds of interactions, but could theoretically be done manually by a user.</li>
<li><strong>Bid Submission</strong>: Buyers submit a kind-301 event referencing the product and including their proposed terms and collateral amount.</li>
<li><strong>Collateral Amounts</strong>:  Typically, buyer collateral will likely be higher than than that of sellers, as it is meant to incentivizethe buyer to confirm receipt of the item and release purchas funds to the seller.</li>
<li><strong>Relay Verification</strong>: Relays process the bid according to their anti-spam policies.</li>
</ul>
<p class="wp-block-paragraph">{</p>
<p class="wp-block-paragraph">  “kind”: 301,</p>
<p class="wp-block-paragraph">  “pubkey”: “buyer_pubkey”,</p>
<p class="wp-block-paragraph">  “created_at”: 1620000100,</p>
<p class="wp-block-paragraph">  “tags”: [</p>
<p class="wp-block-paragraph">    [“anti_spam_proof”, “LN_payment_hash_or_PoW_proof”]</p>
<p class="wp-block-paragraph">  ],</p>
<p class="wp-block-paragraph">  “content”: “{\”product_ref\”: \”event_id_300\”, \”bid_amount_satoshis\”: 80000000, \”buyer_contact\”: \”buyer_pubkey\”, \”collateral_amount_satoshis\”: 80000000}”,</p>
<p class="wp-block-paragraph">  “id”: “event_id_301”,</p>
<p class="wp-block-paragraph">  “sig”: “signature_buyer_301”</p>
<p class="wp-block-paragraph">}</p>
<p class="wp-block-paragraph">Step 4: Seller Responds to the Bid</p>
<p class="wp-block-paragraph"><strong>Option 1: Accept the Bid (</strong><strong>kind-303</strong><strong>)</strong></p>
<ul class="wp-block-list">
<li><strong>Bid Acceptance</strong>: The seller accepts the bid without changing any terms.</li>
<li><strong>Establishing Escrow</strong>: The LN invoice included in the kind-303 event is used by the buyer to make the payment. This payment, along with the buyer’s collateral, is held in escrow until the transaction is completed. The escrow is established through the protocol’s agreement between the buyer and seller, referencing the payment and collateral events.</li>
</ul>
<p class="wp-block-paragraph">{</p>
<p class="wp-block-paragraph">  “kind”: 303,</p>
<p class="wp-block-paragraph">  “pubkey”: “seller_pubkey”,</p>
<p class="wp-block-paragraph">  “created_at”: 1620000200,</p>
<p class="wp-block-paragraph">  “tags”: [</p>
<p class="wp-block-paragraph">    [“anti_spam_proof”, “lnbc1invoice_seller”]</p>
<p class="wp-block-paragraph">  ],</p>
<p class="wp-block-paragraph">  “content”: “{\”bid_ref\”: \”event_id_301\”, \”ln_invoice\”: \”lnbc1invoice_seller\”, \”seller_collateral_ref\”: \”event_id_310_seller\”}”,</p>
<p class="wp-block-paragraph">  “id”: “event_id_303”,</p>
<p class="wp-block-paragraph">  “sig”: “signature_seller_303”</p>
<p class="wp-block-paragraph">}</p>
<p class="wp-block-paragraph"><strong>Option 2: Propose a Counter Bid (</strong><strong>kind-302</strong><strong>)</strong></p>
<ul class="wp-block-list">
<li><strong>Counter Bid</strong>: The seller proposes new terms, possibly adjusting the price or collateral requirements.</li>
</ul>
<p class="wp-block-paragraph">{</p>
<p class="wp-block-paragraph">  “kind”: 302,</p>
<p class="wp-block-paragraph">  “pubkey”: “seller_pubkey”,</p>
<p class="wp-block-paragraph">  “created_at”: 1620000200,</p>
<p class="wp-block-paragraph">  “tags”: [</p>
<p class="wp-block-paragraph">    [“anti_spam_proof”, “lnbc1invoice_seller”]</p>
<p class="wp-block-paragraph">  ],</p>
<p class="wp-block-paragraph">  “content”: “{\”bid_ref\”: \”event_id_301\”, \”counter_offer_satoshis\”: 85000000, \”ln_invoice\”: \”lnbc1invoice_seller\”, \”seller_collateral_ref\”: \”event_id_310_seller\”}”,</p>
<p class="wp-block-paragraph">  “id”: “event_id_302”,</p>
<p class="wp-block-paragraph">  “sig”: “signature_seller_302”</p>
<p class="wp-block-paragraph">}</p>
<p class="wp-block-paragraph">Step 5: Buyer’s Response to Seller</p>
<p class="wp-block-paragraph"><strong>Option 1: Accepting the Bid (</strong><strong>kind-311</strong><strong>)</strong></p>
<ul class="wp-block-list">
<li><strong>Accepting: </strong>If the seller accepted the bid (kind-303), the buyer proceeds to deposit their collateral and confirm payment with a kind-311 event.  This would include the buyers agreed upon collateral as well as the agreed upon sale price.</li>
<li><strong>Collateral Verification</strong>: Before proceeding, both parties verify that the collateral amounts match the agreed terms by referencing the kind-310 events in the kind-311 event.</li>
<li><strong>Escrow Activation</strong>: The buyer’s payment and both parties’ collateral are now held in escrow. Either a LN HTLC or on-chain 2-of-2 multi-sig transaction can be used for escrow depending on the circumstance.</li>
</ul>
<p class="wp-block-paragraph"><strong>Buyer’s Payment Confirmation (</strong><strong>kind-311</strong><strong>)</strong></p>
<p class="wp-block-paragraph">{</p>
<p class="wp-block-paragraph">  “kind”: 311,</p>
<p class="wp-block-paragraph">  “pubkey”: “buyer_pubkey”,</p>
<p class="wp-block-paragraph">  “created_at”: 1620000300,</p>
<p class="wp-block-paragraph">  “tags”: [</p>
<p class="wp-block-paragraph">    [“anti_spam_proof”, “ln_payment_hash_buyer_payment”]</p>
<p class="wp-block-paragraph">  ],</p>
<p class="wp-block-paragraph">  “content”: “{\”bid_ref\”: \”event_id_303_or_302\”, \”payment_method\”: \”htlc\”, \”payment_proof\”: \”ln_payment_hash_buyer_payment\”, \”collateral_amount_satoshis\”: 80000000, \”collateral_payment_proof\”: \”ln_payment_hash_buyer_collateral\”, \”seller_collateral_ref\”: \”event_id_310_seller\”}”,</p>
<p class="wp-block-paragraph">  “id”: “event_id_311”,</p>
<p class="wp-block-paragraph">  “sig”: “signature_buyer_311”</p>
<p class="wp-block-paragraph">}</p>
<p class="wp-block-paragraph"><strong>Option 2: Responding to a Counter Bid (</strong><strong>kind-302</strong><strong>)</strong></p>
<ul class="wp-block-list">
<li><strong>Responding to a Counter Bid</strong>: Alternatively, the buyer can propose another counter bid (kind-302).  Repeats step 4.</li>
</ul>
<p class="wp-block-paragraph">Step 6: Transaction Completion and Escrow Handling</p>
<ul class="wp-block-list">
<li><strong>Seller Ships the Item</strong>: The seller fulfills their obligation by shipping the item.</li>
</ul>
<p class="wp-block-paragraph"><strong>Seller Notifies Buyer of Shipment (</strong><strong>kind-320</strong><strong>)</strong></p>
<ul class="wp-block-list">
<li><strong>Communication</strong>: The seller uses a kind-320 event to inform the buyer that the item has been shipped, providing tracking information if available.</li>
</ul>
<p class="wp-block-paragraph">{</p>
<p class="wp-block-paragraph">  “kind”: 320,</p>
<p class="wp-block-paragraph">  “pubkey”: “seller_pubkey”,</p>
<p class="wp-block-paragraph">  “created_at”: 1620000400,</p>
<p class="wp-block-paragraph">  “tags”: [</p>
<p class="wp-block-paragraph">    [“anti_spam_proof”, “ln_payment_hash_or_PoW_proof”]</p>
<p class="wp-block-paragraph">  ],</p>
<p class="wp-block-paragraph">  “content”: “{\”message\”: \”Item has been shipped. Tracking number: XYZ123\”, \”ref\”: \”event_id_311\”}”,</p>
<p class="wp-block-paragraph">  “id”: “event_id_320_seller”,</p>
<p class="wp-block-paragraph">  “sig”: “signature_seller_320”</p>
<p class="wp-block-paragraph">}</p>
<p class="wp-block-paragraph"><strong>Step 7: Receipt Confirmation (</strong><strong>kind-313</strong><strong>)</strong></p>
<ul class="wp-block-list">
<li><strong>Buyer Confirms Receipt</strong>: Upon receiving the item, the buyer confirms receipt, triggering the release of all funds.  Collateral payments are refunded to both originators, and sale funds are released to the seller.</li>
<li><strong>Automatic Release</strong>: Upon receipt confirmation, the escrowed payment and collateral are released to the seller and buyer, respectively.</li>
<li><strong>No Third-Party Involvement</strong>: The release is managed by the protocol rules and enforced by the clients’ software.  This is because there is no reliable way to prove receipt of a physical object at the protocol level.  Any attempt to do this would inevitably lead to potential for buyers or sellers to defraud the other party.  There is the potential for disputes by third parties, but those are largely relegated to off protocol.</li>
</ul>
<p class="wp-block-paragraph">{</p>
<p class="wp-block-paragraph">  “kind”: 313,</p>
<p class="wp-block-paragraph">  “pubkey”: “buyer_pubkey”,</p>
<p class="wp-block-paragraph">  “created_at”: 1620000800,</p>
<p class="wp-block-paragraph">  “tags”: [</p>
<p class="wp-block-paragraph">    [“anti_spam_proof”, “ln_payment_hash_buyer_payment”]</p>
<p class="wp-block-paragraph">  ],</p>
<p class="wp-block-paragraph">  “content”: “{\”payment_ref\”: \”event_id_311\”, \”status\”: \”received\”}”,</p>
<p class="wp-block-paragraph">  “id”: “event_id_313”,</p>
<p class="wp-block-paragraph">  “sig”: “signature_buyer_313”</p>
<p class="wp-block-paragraph">}</p>
<p class="wp-block-paragraph">Step 8: Reputation Feedback (kind-321)</p>
<ul class="wp-block-list">
<li><strong>Feedback Submission</strong>: Both parties submit feedback, contributing to each other’s reputation scores.</li>
<li><strong>Mandatory Reference to Previous Events</strong>: To prevent abuse, the kind-321 event must reference a specific previous event, and each transaction can only be referenced once in reputation events.</li>
</ul>
<p class="wp-block-paragraph"><strong>Requirements for kind-321:</strong></p>
<ul class="wp-block-list">
<li><strong>Rating a Seller</strong>: The buyer must include a reference to a valid kind-313 (Receipt Confirmation), kind-314 (Refund Initiation), or kind-315 (Mutual Agreement) event to prove they were involved in the transaction.</li>
<li><strong>Rating a Buyer</strong>: The seller must include a reference to a valid kind-313 (Receipt Confirmation), kind-314 (Refund Initiation), or kind-315 (Mutual Agreement) event.</li>
<li><strong>One Feedback per Transaction</strong>: Each referenced event can only be used once for a valid kind-321 rating to prevent multiple ratings from the same transaction.</li>
</ul>
<p class="wp-block-paragraph"><strong>Explanation:</strong></p>
<ul class="wp-block-list">
<li><strong>user_pubkey</strong>: The public key of the user being rated.</li>
<li><strong>transaction_ref</strong>: The ID of the referenced event (e.g., kind-313).</li>
<li><strong>transaction_kind</strong>: The kind of the referenced event.</li>
<li><strong>Validation</strong>: Clients must verify that the transaction_ref corresponds to a valid event of the specified kind and that it has not been used in another kind-321 event by the same rater.</li>
</ul>
<p class="wp-block-paragraph"><strong>Code Sample for Rating a Seller:</strong></p>
<p class="wp-block-paragraph">{</p>
<p class="wp-block-paragraph">  “kind”: 321,</p>
<p class="wp-block-paragraph">  “pubkey”: “buyer_pubkey”,</p>
<p class="wp-block-paragraph">  “created_at”: 1620000900,</p>
<p class="wp-block-paragraph">  “tags”: [</p>
<p class="wp-block-paragraph">    [“anti_spam_proof”, “ln_payment_hash_or_PoW_proof”]</p>
<p class="wp-block-paragraph">  ],</p>
<p class="wp-block-paragraph">  “content”: “{\”user_pubkey\”: \”seller_pubkey\”, \”rating\”: 5, \”comment\”: \”Excellent transaction. Highly recommended.\”, \”transaction_ref\”: \”event_id_313\”, \”transaction_kind\”: 313}”,</p>
<p class="wp-block-paragraph">  “id”: “event_id_321_buyer”,</p>
<p class="wp-block-paragraph">  “sig”: “signature_buyer_321”</p>
<p class="wp-block-paragraph">}</p>
<p class="wp-block-paragraph"><strong>Code Sample for Rating a Buyer:</strong></p>
<p class="wp-block-paragraph">{</p>
<p class="wp-block-paragraph">  “kind”: 321,</p>
<p class="wp-block-paragraph">  “pubkey”: “seller_pubkey”,</p>
<p class="wp-block-paragraph">  “created_at”: 1620000950,</p>
<p class="wp-block-paragraph">  “tags”: [</p>
<p class="wp-block-paragraph">    [“anti_spam_proof”, “ln_payment_hash_or_PoW_proof”]</p>
<p class="wp-block-paragraph">  ],</p>
<p class="wp-block-paragraph">  “content”: “{\”user_pubkey\”: \”buyer_pubkey\”, \”rating\”: 5, \”comment\”: \”Prompt payment and good communication.\”, \”transaction_ref\”: \”event_id_313\”, \”transaction_kind\”: 313}”,</p>
<p class="wp-block-paragraph">  “id”: “event_id_321_seller”,</p>
<p class="wp-block-paragraph">  “sig”: “signature_seller_321”</p>
<p class="wp-block-paragraph">}</p>
<p class="wp-block-paragraph"><strong>Escrow Mechanism in DOMP</strong></p>
<p class="wp-block-paragraph"><strong>Overview</strong></p>
<p class="wp-block-paragraph">The escrow mechanism in DOMP is a critical component that ensures secure and trustless transactions between buyers and sellers without requiring a third-party escrow agent or relying on built-in escrow functionality within the Lightning Network (LN). Instead, DOMP implements escrow at the protocol level using cryptographic proofs, mutual agreements, and strict adherence to protocol rules enforced by client software.</p>
<p class="wp-block-paragraph"><strong>Key Characteristics of the DOMP Escrow Mechanism:</strong></p>
<ul class="wp-block-list">
<li><strong>Protocol-Level Implementation:</strong> Escrow is managed through DOMP’s defined event types and workflow.</li>
<li><strong>No Third-Party Custody:</strong> Funds are not held by a third party but are controlled by the protocol rules and cryptographic agreements between buyer and seller.</li>
<li><strong>Mutual Assurance through Collateral:</strong> Both parties post collateral, incentivizing honest behavior and commitment to the transaction.</li>
<li><strong>Event-Driven Control:</strong> Specific events trigger changes in the state of the escrow, such as releasing funds upon buyer confirmation.</li>
<li><strong>Client Enforcement:</strong> Client software enforces the protocol rules, ensuring compliance and preventing unauthorized actions.</li>
</ul>
<p class="wp-block-paragraph"><strong>Detailed Process with Code Examples</strong></p>
<p class="wp-block-paragraph">Below is a step-by-step explanation of how the escrow mechanism works within DOMP, including code examples to illustrate each stage.</p>
<p class="wp-block-paragraph"><strong>Step 1: Seller Lists the Product (</strong><strong>kind-300</strong><strong>)</strong></p>
<p class="wp-block-paragraph"><strong>Step 2: Seller Posts Collateral (</strong><strong>kind-310</strong><strong>)</strong></p>
<p class="wp-block-paragraph"><strong>Step 3: Buyer Submits a Bid (</strong><strong>kind-301</strong><strong>)</strong></p>
<p class="wp-block-paragraph"><strong>Step 4: Seller Accepts the Bid (</strong><strong>kind-303</strong><strong>)</strong></p>
<p class="wp-block-paragraph"><strong>Step 5: Buyer Deposits Collateral and Makes Payment</strong></p>
<p class="wp-block-paragraph"><strong>Buyer’s Collateral Deposit and Payment Confirmation (</strong><strong>kind-311</strong><strong>)</strong></p>
<p class="wp-block-paragraph"><strong>Explanation:</strong></p>
<ul class="wp-block-list">
<li>The buyer confirms that the payment has been made by providing the payment_proof (the hash of the LN payment).</li>
<li>The buyer_collateral_ref and seller_collateral_ref fields reference the collateral deposits made by both parties.</li>
<li>This event effectively locks the funds (payment and both collaterals) into the protocol’s escrow mechanism.</li>
</ul>
<p class="wp-block-paragraph"><strong>How the Escrow Is Established:</strong></p>
<ol class="wp-block-list">
<li><strong>Mutual Agreement and Protocol Enforcement:</strong>
<ul class="wp-block-list">
<li>By referencing the same bid_ref and collateral events, both parties agree to the terms of the transaction.</li>
<li>The protocol rules dictate that funds are now considered in escrow and cannot be unilaterally accessed by either party.</li>
</ul>
</li>
<li><strong>Client Software Role:</strong></li>
</ol>
<ol class="wp-block-list">
<li>Clients enforce the protocol by preventing users from accessing funds in escrow until the appropriate conditions are met.</li>
<li>They monitor the Nostr network for relevant events and update the transaction state accordingly.</li>
<li><strong>Use of Cryptographic Proofs:</strong></li>
</ol>
<ol class="wp-block-list">
<li>Payment proofs and digital signatures ensure the authenticity of transactions.</li>
<li>The use of event IDs and references creates an immutable chain of events that can be verified by both parties.</li>
</ol>
<p class="wp-block-paragraph"><strong>Step 6: Escrow Activation</strong></p>
<ul class="wp-block-list">
<li><strong>Funds Held Securely:</strong> The buyer’s payment and both parties’ collateral are now held in escrow as per the protocol rules.</li>
</ul>
<p class="wp-block-paragraph"><strong>Step 7: Seller Ships the Item</strong></p>
<ul class="wp-block-list">
<li>The seller, assured that the funds are secured in escrow, proceeds to ship the item.</li>
</ul>
<p class="wp-block-paragraph"><strong>Step 8: Seller Notifies Buyer of Shipment (</strong><strong>kind-320</strong><strong>)</strong></p>
<p class="wp-block-paragraph"><strong>Step 9: Buyer Confirms Receipt (</strong><strong>kind-313</strong><strong>)</strong></p>
<p class="wp-block-paragraph"><strong>Step 10: Funds and Collateral Release</strong></p>
<ul class="wp-block-list">
<li><strong>Triggered by </strong><strong>kind-313</strong><strong>:</strong> The buyer’s receipt confirmation signals that the conditions for releasing funds are met.</li>
<li><strong>Client Enforcement:</strong> Clients update the transaction state, allowing the seller to access the payment and both parties to retrieve their collateral.</li>
<li><strong>No Third-Party Intervention Required:</strong> The protocol and client software handle the release based on the events recorded.</li>
</ul>
<p class="wp-block-paragraph">Example Code Flow for Escrow Handling</p>
<p class="wp-block-paragraph"><strong>1. Escrow Initialization:</strong></p>
<ul class="wp-block-list">
<li><strong>Buyer and Seller Collateral Deposits (</strong><strong>kind-310 and kind-311</strong><strong>):</strong>
<ul class="wp-block-list">
<li>Both parties’ collaterals are associated with the transaction through their respective kind-310 (for seller) and kind-311 (for buyer) events.</li>
<li>The payment_proof in these events verifies that the collateral has been paid via LN.</li>
</ul>
</li>
<li><strong>Payment Confirmation (</strong><strong>kind-311</strong><strong>):</strong>
<ul class="wp-block-list">
<li>The buyer’s payment for the item is confirmed.</li>
<li>References to both collateral events are included, linking all funds to the transaction.</li>
</ul>
</li>
</ul>
<p class="wp-block-paragraph"><strong>2. Escrow Locking Mechanism:</strong></p>
<ul class="wp-block-list">
<li><strong>Protocol Rules:</strong>
<ul class="wp-block-list">
<li>Funds are considered locked once the kind-311 event is published.</li>
<li>Clients enforce that these funds cannot be accessed until a kind-313 (Receipt Confirmation), Kind-314 (Refund  Initiation), or kind-315 (Mutual Agreement) event occurs.</li>
</ul>
</li>
<li><strong>Event Chain Verification:</strong>
<ul class="wp-block-list">
<li>Each event includes references to previous events, creating a verifiable chain.</li>
<li>This ensures that all parties have fulfilled their obligations up to this point.</li>
</ul>
</li>
</ul>
<p class="wp-block-paragraph"><strong>3. Escrow Release Conditions:</strong></p>
<ul class="wp-block-list">
<li><strong>Receipt Confirmation (</strong><strong>kind-313</strong><strong>):</strong>
<ul class="wp-block-list">
<li>Upon the buyer’s confirmation, clients recognize that the transaction is complete.</li>
<li>Funds are released according to the protocol: the seller receives the payment, and both parties retrieve their collateral.</li>
</ul>
</li>
<li><strong>Alternative Release through Mutual Agreement (</strong><strong>kind-315</strong><strong>):</strong>
<ul class="wp-block-list">
<li>If both parties agree to cancel the transaction, they can release funds back to their original owners.</li>
</ul>
</li>
</ul>
<p class="wp-block-paragraph"><strong>4. Example Client-Side Enforcement Logic:</strong></p>
<p class="wp-block-paragraph">def handle_event(event):</p>
<p class="wp-block-paragraph">    if event.kind == 311:  # Payment Confirmation</p>
<p class="wp-block-paragraph">        escrow = create_escrow(event)</p>
<p class="wp-block-paragraph">    elif event.kind == 313:  # Receipt Confirmation</p>
<p class="wp-block-paragraph">        escrow = get_escrow(event[‘content’][‘payment_ref’])</p>
<p class="wp-block-paragraph">        if escrow and escrow.is_active:</p>
<p class="wp-block-paragraph">            release_funds(escrow)</p>
<p class="wp-block-paragraph">    elif event.kind == 315:  # Mutual Agreement</p>
<p class="wp-block-paragraph">        escrow = get_escrow(event[‘content’][‘payment_ref’])</p>
<p class="wp-block-paragraph">        if escrow and escrow.is_active and mutual_agreement(event):</p>
<p class="wp-block-paragraph">            refund_funds(escrow)</p>
<p class="wp-block-paragraph">def create_escrow(event):</p>
<p class="wp-block-paragraph">    # Verify payment and collateral proofs</p>
<p class="wp-block-paragraph">    # Lock funds in escrow</p>
<p class="wp-block-paragraph">    return EscrowObject(…)</p>
<p class="wp-block-paragraph">def release_funds(escrow):</p>
<p class="wp-block-paragraph">    # Transfer payment to seller</p>
<p class="wp-block-paragraph">    # Return collaterals to both parties</p>
<p class="wp-block-paragraph">    escrow.is_active = False</p>
<p class="wp-block-paragraph">def refund_funds(escrow):</p>
<p class="wp-block-paragraph">    # Return payment and collaterals to original parties</p>
<p class="wp-block-paragraph">    escrow.is_active = False</p>
<p class="wp-block-paragraph">def mutual_agreement(event):</p>
<p class="wp-block-paragraph">    # Check that both parties have agreed to the terms</p>
<p class="wp-block-paragraph">    return True  # Simplified for illustration</p>
<p class="wp-block-paragraph"><strong>5. Security and Integrity:</strong></p>
<ul class="wp-block-list">
<li><strong>Cryptographic Verification:</strong>
<ul class="wp-block-list">
<li>All events are signed by the respective parties, ensuring authenticity.</li>
<li>Payment proofs and references prevent fraudulent claims.</li>
</ul>
</li>
<li><strong>No Central Authority Needed:</strong>
<ul class="wp-block-list">
<li>The protocol and client software handle all aspects of the escrow, maintaining decentralization.</li>
</ul>
</li>
</ul>
<p class="wp-block-paragraph"><strong>Example Playthrough Summary:</strong></p>
<ul class="wp-block-list">
<li><strong>Initiation:</strong>
<ul class="wp-block-list">
<li>Seller lists item and posts collateral.</li>
<li>Buyer submits bid.</li>
</ul>
</li>
<li><strong>Agreement:</strong>
<ul class="wp-block-list">
<li>Seller accepts bid.</li>
<li>Buyer deposits collateral and confirms payment.</li>
</ul>
</li>
<li><strong>Escrow Activation:</strong>
<ul class="wp-block-list">
<li>Funds (payment and collaterals) are locked in escrow by the protocol rules.</li>
</ul>
</li>
<li><strong>Transaction Completion:</strong>
<ul class="wp-block-list">
<li>Seller ships item.</li>
<li>Buyer confirms receipt.</li>
<li>Funds are automatically released by client software per protocol rules.</li>
</ul>
</li>
</ul>
<p class="wp-block-paragraph"><strong>What Happens If Disputes Arise?</strong></p>
<ul class="wp-block-list">
<li><strong>Buyer Does Not Confirm Receipt:</strong>
<ul class="wp-block-list">
<li>Seller can initiate a dispute (kind-312).</li>
<li>Parties can communicate via kind-320 events.</li>
<li>They may reach a mutual agreement (kind-315) or opt for arbitration (kind-316).</li>
</ul>
</li>
<li><strong>Protocol Enforcement:</strong>
<ul class="wp-block-list">
<li>Funds remain in escrow until a resolution is achieved.</li>
<li>Collateral incentivizes both parties to resolve disputes although this can never be guaranteed in a decentralized system and some amount of trust and collaboration required between buyers and sellers will always be a limiting factor.  Buyers and sellers are allowed to establish their own risk profiles through negotiating collateral requirements within any single bid taking into account the sale item itself along with the other party’s repuation. </li>
</ul>
</li>
</ul>
<p class="wp-block-paragraph">Reputation System</p>
<p class="wp-block-paragraph">A functioning reputation system which is very difficult to manipulate is vital to DOMP’s functioning.  It is the main way buyers and sellers can establish acceptable collateral levels for individual purchases.</p>
<p class="wp-block-paragraph"><strong>Storage and Reference</strong></p>
<ul class="wp-block-list">
<li><strong>Decentralized Storage</strong>: Reputation feedback events are stored on Nostr relays.</li>
<li><strong>Reference by Identifier</strong>: Each reputation event references the entity being rated using appropriate identifiers (e.g., pubkey for users and arbitrators, URL for relays).</li>
</ul>
<p class="wp-block-paragraph"><strong>Event Types for Reputation Feedback</strong></p>
<ul class="wp-block-list">
<li><strong>kind-321: User Reputation Feedback</strong>
<ul class="wp-block-list">
<li>Used for rating buyers and sellers.</li>
<li>Must reference specific prior transaction events to validate the feedback.</li>
</ul>
</li>
<li><strong>kind-322: Arbitrator Reputation Feedback</strong>
<ul class="wp-block-list">
<li>Used for rating arbitrators.</li>
<li>Must reference specific arbitration events (kind-316, kind-312, kind-315) to validate the feedback.</li>
<li>Only participants involved in the arbitration can rate the arbitrator.</li>
</ul>
</li>
<li><strong>kind-323: Relay Reputation Feedback</strong>
<ul class="wp-block-list">
<li>Used for rating relays.</li>
<li>Must include proof of interaction with the relay, such as a payment proof or service usage evidence.</li>
<li>Relay is identified by its URL or domain name.</li>
</ul>
</li>
</ul>
<p class="wp-block-paragraph">Reputation Details &amp; Calculations</p>
<p class="wp-block-paragraph">Kind 321 – User Reputation Feedback</p>
<ul class="wp-block-list">
<li><strong>Client Responsibilities</strong>:
<ul class="wp-block-list">
<li><strong>Fetching Events</strong>: Clients fetch kind-321 events related to a user.</li>
<li><strong>Validating Feedback</strong>: Clients verify that each kind-321 event includes a valid reference to a prior event and that it has not been used before.</li>
<li><strong>Calculating Scores</strong>: Clients compute reputation scores based on valid, non-duplicated feedback.</li>
</ul>
</li>
<li><strong>Prevention of Abuse</strong>:
<ul class="wp-block-list">
<li><strong>Event Validation</strong>: By requiring references to specific events, only users who participated in a transaction can provide feedback.</li>
<li><strong>Single Use of References</strong>: Each transaction event can only be referenced once in reputation events to prevent multiple ratings from a single transaction.</li>
</ul>
</li>
</ul>
<p class="wp-block-paragraph"><strong>Example User Reputation Algorithm:</strong></p>
<p class="wp-block-paragraph">def calculate_reputation(user_pubkey):</p>
<p class="wp-block-paragraph">    feedback_events = get_feedback_events(user_pubkey)</p>
<p class="wp-block-paragraph">    valid_feedback = []</p>
<p class="wp-block-paragraph">    used_transaction_refs = set()</p>
<p class="wp-block-paragraph">    for event in feedback_events:</p>
<p class="wp-block-paragraph">        transaction_ref = event[‘content’][‘transaction_ref’]</p>
<p class="wp-block-paragraph">        transaction_kind = event[‘content’][‘transaction_kind’]</p>
<p class="wp-block-paragraph">        # Check if the transaction_ref has already been used</p>
<p class="wp-block-paragraph">        if transaction_ref in used_transaction_refs:</p>
<p class="wp-block-paragraph">            continue  # Skip duplicate feedback</p>
<p class="wp-block-paragraph">        # Validate the referenced event</p>
<p class="wp-block-paragraph">        if not validate_transaction_event(transaction_ref, transaction_kind, event[‘pubkey’], user_pubkey):</p>
<p class="wp-block-paragraph">            continue  # Skip invalid references</p>
<p class="wp-block-paragraph">        used_transaction_refs.add(transaction_ref)</p>
<p class="wp-block-paragraph">        valid_feedback.append(event)</p>
<p class="wp-block-paragraph">    # Calculate reputation score based on valid_feedback</p>
<p class="wp-block-paragraph">    total_score = 0</p>
<p class="wp-block-paragraph">    total_weight = 0</p>
<p class="wp-block-paragraph">    for event in valid_feedback:</p>
<p class="wp-block-paragraph">        rating = event[‘content’][‘rating’]</p>
<p class="wp-block-paragraph">        transaction_value = get_transaction_value(event[‘content’][‘transaction_ref’])</p>
<p class="wp-block-paragraph">        weight = transaction_value</p>
<p class="wp-block-paragraph">        total_score += rating * weight</p>
<p class="wp-block-paragraph">        total_weight += weight</p>
<p class="wp-block-paragraph">    reputation_score = total_score / total_weight if total_weight &gt; 0 else 0</p>
<p class="wp-block-paragraph">    return reputation_score</p>
<p class="wp-block-paragraph">def validate_transaction_event(transaction_ref, transaction_kind, rater_pubkey, rated_pubkey):</p>
<p class="wp-block-paragraph">    transaction_event = get_event_by_id(transaction_ref)</p>
<p class="wp-block-paragraph">    if not transaction_event:</p>
<p class="wp-block-paragraph">        return False</p>
<p class="wp-block-paragraph">    # Check if the transaction_kind matches the event’s kind</p>
<p class="wp-block-paragraph">    if transaction_event[‘kind’] != transaction_kind:</p>
<p class="wp-block-paragraph">        return False</p>
<p class="wp-block-paragraph">    # Verify that the rater and rated users were involved in the transaction</p>
<p class="wp-block-paragraph">    involved_pubkeys = {transaction_event[‘pubkey’], transaction_event.get(‘counterparty_pubkey’)}</p>
<p class="wp-block-paragraph">    if rater_pubkey not in involved_pubkeys or rated_pubkey not in involved_pubkeys:</p>
<p class="wp-block-paragraph">        return False</p>
<p class="wp-block-paragraph">    return True</p>
<p class="wp-block-paragraph">kind-322: Arbitrator Reputation Feedback</p>
<p class="wp-block-paragraph"><strong>Requirements for kind-322:</strong></p>
<ul class="wp-block-list">
<li><strong>Rating an Arbitrator</strong>: The user must include a reference to a valid arbitration event, such as:
<ul class="wp-block-list">
<li>kind-316 (Arbitration Offer)</li>
<li>kind-312 (Escrow Dispute)</li>
<li>kind-315 (Mutual Agreement involving arbitration)</li>
</ul>
</li>
<li><strong>One Feedback per Arbitration</strong>: Each arbitration event can only be referenced once for a valid kind-322 rating.</li>
</ul>
<p class="wp-block-paragraph"><strong>Code Sample for Rating an Arbitrator:</strong></p>
<p class="wp-block-paragraph">{</p>
<p class="wp-block-paragraph">  “kind”: 322,</p>
<p class="wp-block-paragraph">  “pubkey”: “user_pubkey”,</p>
<p class="wp-block-paragraph">  “created_at”: 1620001000,</p>
<p class="wp-block-paragraph">  “tags”: [</p>
<p class="wp-block-paragraph">    [“anti_spam_proof”, “ln_payment_hash_or_PoW_proof”]</p>
<p class="wp-block-paragraph">  ],</p>
<p class="wp-block-paragraph">  “content”: “{\”arbitrator_pubkey\”: \”arbitrator_pubkey\”, \”rating\”: 4, \”comment\”: \”Fair and timely resolution.\”, \”arbitration_ref\”: \”event_id_316\”, \”arbitration_kind\”: 316}”,</p>
<p class="wp-block-paragraph">  “id”: “event_id_322_user”,</p>
<p class="wp-block-paragraph">  “sig”: “signature_user_322”</p>
<p class="wp-block-paragraph">}</p>
<p class="wp-block-paragraph">kind-323: Relay Reputation Feedback</p>
<ul class="wp-block-list">
<li><strong>Purpose</strong>: Enables users to rate relays based on their service quality.</li>
<li><strong>Validation</strong>: Requires proof of interaction with the relay.</li>
</ul>
<p class="wp-block-paragraph"><strong>Requirements for kind-323:</strong></p>
<ul class="wp-block-list">
<li><strong>Identification of Relay</strong>: Relays are identified by their URL or domain name (relay_url).</li>
<li><strong>Proof of Interaction</strong>: Users must provide evidence of interaction, such as:
<ul class="wp-block-list">
<li>Payment proof to the relay (e.g., for anti-spam measures)</li>
<li>Event IDs of events successfully propagated by the relay</li>
</ul>
</li>
<li><strong>One Feedback per Interaction</strong>: Each interaction can be referenced once for feedback.</li>
</ul>
<p class="wp-block-paragraph"><strong>Code Sample for Rating a Relay:</strong></p>
<p class="wp-block-paragraph">{</p>
<p class="wp-block-paragraph">  “kind”: 323,</p>
<p class="wp-block-paragraph">  “pubkey”: “user_pubkey”,</p>
<p class="wp-block-paragraph">  “created_at”: 1620001050,</p>
<p class="wp-block-paragraph">  “tags”: [</p>
<p class="wp-block-paragraph">    [“anti_spam_proof”, “ln_payment_hash_or_PoW_proof”]</p>
<p class="wp-block-paragraph">  ],</p>
<p class="wp-block-paragraph">  “content”: “{\”relay_url\”: \”relay1.example.com\”, \”rating\”: 5, \”comment\”: \”Reliable and fast service.\”, \”interaction_proof\”: {\”payment_proof\”: \”ln_payment_hash_relay_fee\”, \”event_id\”: \”event_id_300\”}}”,</p>
<p class="wp-block-paragraph">  “id”: “event_id_323_user”,</p>
<p class="wp-block-paragraph">  “sig”: “signature_user_323”</p>
<p class="wp-block-paragraph">}</p>
<p class="wp-block-paragraph"><strong>Example Arbitrator and Relay Reputation Algorithm:</strong></p>
<p class="wp-block-paragraph"><strong>Note For Arbitrators:</strong></p>
<ul class="wp-block-list">
<li><strong>Validation</strong>: Clients must verify that the arbitration_ref corresponds to a valid arbitration event involving both the rater and the arbitrator.</li>
<li><strong>Single Use of References</strong>: Each arbitration event can only be referenced once per rater in reputation events.</li>
</ul>
<p class="wp-block-paragraph"><strong>Note For Relays:</strong></p>
<ul class="wp-block-list">
<li><strong>Validation</strong>: Clients verify the interaction_proof to ensure the user interacted with the relay.</li>
<li><strong>Relay Identification</strong>: Since relays do not have pubkey, they are identified by relay_url.</li>
</ul>
<p class="wp-block-paragraph">def calculate_arbitrator_reputation(arbitrator_pubkey):</p>
<p class="wp-block-paragraph">    feedback_events = get_arbitrator_feedback_events(arbitrator_pubkey)</p>
<p class="wp-block-paragraph">    valid_feedback = []</p>
<p class="wp-block-paragraph">    used_arbitration_refs = set()</p>
<p class="wp-block-paragraph">    for event in feedback_events:</p>
<p class="wp-block-paragraph">        arbitration_ref = event[‘content’][‘arbitration_ref’]</p>
<p class="wp-block-paragraph">        arbitration_kind = event[‘content’][‘arbitration_kind’]</p>
<p class="wp-block-paragraph">        if arbitration_ref in used_arbitration_refs:</p>
<p class="wp-block-paragraph">            continue  # Skip duplicate feedback</p>
<p class="wp-block-paragraph">        if not validate_arbitration_event(arbitration_ref, arbitration_kind, event[‘pubkey’], arbitrator_pubkey):</p>
<p class="wp-block-paragraph">            continue  # Skip invalid references</p>
<p class="wp-block-paragraph">        used_arbitration_refs.add(arbitration_ref)</p>
<p class="wp-block-paragraph">        valid_feedback.append(event)</p>
<p class="wp-block-paragraph">    # Calculate reputation score based on valid_feedback (similar to user reputation)</p>
<p class="wp-block-paragraph">    # …</p>
<p class="wp-block-paragraph">def calculate_relay_reputation(relay_url):</p>
<p class="wp-block-paragraph">    feedback_events = get_relay_feedback_events(relay_url)</p>
<p class="wp-block-paragraph">    valid_feedback = []</p>
<p class="wp-block-paragraph">    used_interaction_proofs = set()</p>
<p class="wp-block-paragraph">    for event in feedback_events:</p>
<p class="wp-block-paragraph">        interaction_proof = event[‘content’][‘interaction_proof’]</p>
<p class="wp-block-paragraph">        proof_id = hash(interaction_proof)  # Create a unique identifier for the proof</p>
<p class="wp-block-paragraph">        if proof_id in used_interaction_proofs:</p>
<p class="wp-block-paragraph">            continue  # Skip duplicate feedback</p>
<p class="wp-block-paragraph">        if not validate_interaction_proof(interaction_proof, event[‘pubkey’], relay_url):</p>
<p class="wp-block-paragraph">            continue  # Skip invalid proofs</p>
<p class="wp-block-paragraph">        used_interaction_proofs.add(proof_id)</p>
<p class="wp-block-paragraph">        valid_feedback.append(event)</p>
<p class="wp-block-paragraph">    # Calculate reputation score based on valid_feedback (e.g., average rating)</p>
<p class="wp-block-paragraph"><strong>Arbitration</strong></p>
<p class="wp-block-paragraph"><strong>Step 1: Dispute Arises</strong></p>
<p class="wp-block-paragraph">A dispute may occur due to issues such as:</p>
<ul class="wp-block-list">
<li><strong>Non-receipt of Goods:</strong> The buyer claims the item was not delivered.</li>
<li><strong>Goods Not as Described:</strong> The buyer asserts that the received item differs significantly from the description.</li>
<li><strong>Payment Issues:</strong> The seller alleges that payment was not received or was incorrect.</li>
</ul>
<p class="wp-block-paragraph">Either party can initiate the arbitration process to seek a fair resolution.</p>
<p class="wp-block-paragraph"><strong>Step 2: Initiation of Dispute (kind-312)</strong></p>
<p class="wp-block-paragraph">The party initiating the dispute publishes a kind-312 event to signal the existence of a dispute.</p>
<p class="wp-block-paragraph">{</p>
<p class="wp-block-paragraph">  “kind”: 312,</p>
<p class="wp-block-paragraph">  “pubkey”: “buyer_pubkey”,</p>
<p class="wp-block-paragraph">  “created_at”: 1620000850,</p>
<p class="wp-block-paragraph">  “tags”: [</p>
<p class="wp-block-paragraph">    [“anti_spam_proof”, “ln_payment_hash_or_PoW_proof”]</p>
<p class="wp-block-paragraph">  ],</p>
<p class="wp-block-paragraph">  “content”: “{\”payment_ref\”: \”event_id_311\”, \”reason\”: \”Item not received\”, \”details\”: \”Expected delivery date has passed without receipt.\”}”,</p>
<p class="wp-block-paragraph">  “id”: “event_id_312”,</p>
<p class="wp-block-paragraph">  “sig”: “signature_buyer_312”</p>
<p class="wp-block-paragraph">}</p>
<p class="wp-block-paragraph"><strong>Step 3: Selection of Arbitrator</strong></p>
<p class="wp-block-paragraph">Option 1: Arbitrator Offers Services (kind-316)</p>
<p class="wp-block-paragraph">Arbitrators monitor the network for dispute events and can offer their services by publishing kind-316 events.</p>
<p class="wp-block-paragraph">{</p>
<p class="wp-block-paragraph">  “kind”: 316,</p>
<p class="wp-block-paragraph">  “pubkey”: “arbitrator_pubkey”,</p>
<p class="wp-block-paragraph">  “created_at”: 1620000900,</p>
<p class="wp-block-paragraph">  “tags”: [</p>
<p class="wp-block-paragraph">    [“anti_spam_proof”, “ln_payment_hash_or_PoW_proof”]</p>
<p class="wp-block-paragraph">  ],</p>
<p class="wp-block-paragraph">  “content”: “{\”dispute_ref\”: \”event_id_312\”, \”arbitrator_pubkey\”: \”arbitrator_pubkey\”, \”terms\”: \”Arbitration fee of 2% of transaction value, payable upon resolution.\”, \”fee_satoshis\”: 1600000, \”contact_info\”: \”arbitrator@example.com\”}”,</p>
<p class="wp-block-paragraph">  “id”: “event_id_316”,</p>
<p class="wp-block-paragraph">  “sig”: “signature_arbitrator_316”</p>
<p class="wp-block-paragraph">}</p>
<ul class="wp-block-list">
<li><strong>Arbitrator Fee:</strong> The arbitrator specifies their fee in satoshis or as a percentage of the transaction value.</li>
<li><strong>Terms and Conditions:</strong> The arbitrator outlines their terms, including how the fee is to be paid and any additional conditions.</li>
</ul>
<p class="wp-block-paragraph">Option 2: Parties Select Arbitrator Directly</p>
<p class="wp-block-paragraph">Alternatively, the disputing parties may choose an arbitrator they trust, perhaps based on prior interactions or reputation scores.</p>
<p class="wp-block-paragraph"><strong>Step 4: Agreement to Arbitrate and Release of Funds (kind-315)</strong></p>
<p class="wp-block-paragraph">Both parties must agree to arbitration by publishing kind-315 events. Upon mutual agreement, the protocol releases the disputed funds and both parties’ collateral to the arbitrator.</p>
<p class="wp-block-paragraph"><strong>Buyer Agrees to Arbitration:</strong></p>
<p class="wp-block-paragraph">{</p>
<p class="wp-block-paragraph">  “kind”: 315,</p>
<p class="wp-block-paragraph">  “pubkey”: “buyer_pubkey”,</p>
<p class="wp-block-paragraph">  “created_at”: 1620000950,</p>
<p class="wp-block-paragraph">  “tags”: [</p>
<p class="wp-block-paragraph">    [“anti_spam_proof”, “ln_payment_hash_or_PoW_proof”]</p>
<p class="wp-block-paragraph">  ],</p>
<p class="wp-block-paragraph">  “content”: “{\”payment_ref\”: \”event_id_311\”, \”agreement\”: \”Agree to arbitration by arbitrator_pubkey\”, \”arbitrator_ref\”: \”event_id_316\”, \”release_funds_to_arbitrator\”: true}”,</p>
<p class="wp-block-paragraph">  “id”: “event_id_315_buyer”,</p>
<p class="wp-block-paragraph">  “sig”: “signature_buyer_315”</p>
<p class="wp-block-paragraph">}</p>
<p class="wp-block-paragraph"><strong>Seller Agrees to Arbitration:</strong></p>
<p class="wp-block-paragraph">{</p>
<p class="wp-block-paragraph">  “kind”: 315,</p>
<p class="wp-block-paragraph">  “pubkey”: “seller_pubkey”,</p>
<p class="wp-block-paragraph">  “created_at”: 1620000960,</p>
<p class="wp-block-paragraph">  “tags”: [</p>
<p class="wp-block-paragraph">    [“anti_spam_proof”, “ln_payment_hash_or_PoW_proof”]</p>
<p class="wp-block-paragraph">  ],</p>
<p class="wp-block-paragraph">  “content”: “{\”payment_ref\”: \”event_id_311\”, \”agreement\”: \”Agree to arbitration by arbitrator_pubkey\”, \”arbitrator_ref\”: \”event_id_316\”, \”release_funds_to_arbitrator\”: true}”,</p>
<p class="wp-block-paragraph">  “id”: “event_id_315_seller”,</p>
<p class="wp-block-paragraph">  “sig”: “signature_seller_315”</p>
<p class="wp-block-paragraph">}</p>
<ul class="wp-block-list">
<li><strong>Release of Funds:</strong> The release_funds_to_arbitrator flag indicates that both parties consent to transfer the funds to the arbitrator.</li>
</ul>
<p class="wp-block-paragraph"><strong>Step 5: Transfer of Funds to Arbitrator</strong></p>
<p class="wp-block-paragraph">Upon mutual agreement:</p>
<ul class="wp-block-list">
<li><strong>Protocol Action:</strong> The protocol, via client software compliance, facilitates the transfer of the disputed funds and collateral to the arbitrator’s control.</li>
<li><strong>Fund Transfer Mechanism:</strong>
<ul class="wp-block-list">
<li><strong>For Multisig Escrow:</strong> The arbitrator is part of a 3-of-3 multisig wallet, and with both party’s cooperation, can access the funds.</li>
<li><strong>For Lightning Network Payments:</strong> The clients initiate a payment to the arbitrator’s LN node equivalent to the disputed amount plus any fees.</li>
</ul>
</li>
</ul>
<p class="wp-block-paragraph"><strong>Step 6: Off-Protocol Arbitration Proceedings</strong></p>
<p class="wp-block-paragraph">The arbitrator communicates with both parties outside the protocol to:</p>
<ul class="wp-block-list">
<li><strong>Gather Information:</strong> Collect evidence, statements, and any necessary documents.</li>
<li><strong>Deliberate:</strong> Analyze the information to make a fair decision.</li>
<li><strong>Confidentiality:</strong> Ensure privacy and confidentiality of sensitive data.</li>
</ul>
<p class="wp-block-paragraph"><strong>Step 7: Arbitrator Disburses Funds Off-Protocol</strong></p>
<p class="wp-block-paragraph">Based on the arbitration outcome:</p>
<ul class="wp-block-list">
<li><strong>Fund Distribution:</strong> The arbitrator disburses the funds and collateral to the appropriate parties using off-protocol transactions.
<ul class="wp-block-list">
<li><strong>Payment to Seller or Refund to Buyer:</strong> The arbitrator sends the funds directly to the entitled party’s Bitcoin or LN address.</li>
</ul>
</li>
<li><strong>Deduction of Arbitration Fee:</strong> The arbitrator deducts their fee from the funds before disbursal, as per the agreed terms.</li>
</ul>
<p class="wp-block-paragraph">Arbitration events happen off protocol because of the inherent complexity of disputes.  It would be impractical to try to account for every possible dispute solution.</p>
<p class="wp-block-paragraph"><strong>Step 8: Closing the Dispute on Protocol</strong></p>
<p class="wp-block-paragraph">While the actual fund transfer happens off-protocol, the arbitrator publishes a kind-317 event to record the resolution.</p>
<p class="wp-block-paragraph"><strong>Arbitrator’s Resolution Event (kind-317):</strong></p>
<p class="wp-block-paragraph">{</p>
<p class="wp-block-paragraph">  “kind”: 317,</p>
<p class="wp-block-paragraph">  “content”: {</p>
<p class="wp-block-paragraph">    “dispute_ref”: “event_id_312”,</p>
<p class="wp-block-paragraph">    “resolution”: “Funds refunded to buyer as item was not delivered.”,</p>
<p class="wp-block-paragraph">    “arbitration_fee_satoshis”: 1600000,</p>
<p class="wp-block-paragraph">    “fee_deducted_from”: “seller_collateral”</p>
<p class="wp-block-paragraph">  },</p>
<p class="wp-block-paragraph">  “pubkey”: “arbitrator_pubkey”,</p>
<p class="wp-block-paragraph">  “sig”: “signature_arbitrator_317”,</p>
<p class="wp-block-paragraph">  “relays”: [“relay1.example.com”],</p>
<p class="wp-block-paragraph">  “id”: “event_id_317”,</p>
<p class="wp-block-paragraph">  “created_at”: 1620001100</p>
<p class="wp-block-paragraph">}</p>
<ul class="wp-block-list">
<li><strong>Purpose:</strong> This event provides a public record of the dispute’s resolution.</li>
</ul>
<p class="wp-block-paragraph"><strong>Step 9: Rating the Arbitrator (kind-322)</strong></p>
<p class="wp-block-paragraph">Both parties can provide feedback on the arbitrator’s performance.</p>
<p class="wp-block-paragraph"><strong>Scenarios Demonstrating Potential Exchanges</strong></p>
<p class="wp-block-paragraph"><strong>Scenario 1: Successful Transaction</strong></p>
<p class="wp-block-paragraph"><strong>Process Summary</strong>:</p>
<ol class="wp-block-list">
<li><strong>Seller Lists Product</strong> (kind-300).</li>
<li><strong>Seller Deposits Collateral</strong> (kind-310).</li>
<li><strong>Buyer Submits Bid</strong> (kind-301).</li>
<li><strong>Seller Accepts Bid</strong> (kind-303).</li>
<li><strong>Buyer Deposits Collateral &amp; Confirms Payment</strong> (kind-311).</li>
<li><strong>Escrow Activated</strong>.</li>
<li><strong>Seller Ships Item</strong> and <strong>Notifies Buyer</strong> (kind-320).</li>
<li><strong>Buyer Confirms Receipt</strong> (kind-313).</li>
<li><strong>Funds and Collateral Released</strong>.</li>
<li><strong>Feedback Submitted</strong> (kind-321).</li>
</ol>
<p class="wp-block-paragraph"><strong>Scenario 2: Buyer Does Not Confirm Receipt</strong></p>
<ol class="wp-block-list">
<li><strong>Seller Lists Product</strong> (kind-300).</li>
<li><strong>Seller Deposits Collateral</strong> (kind-310).</li>
<li><strong>Buyer Submits Bid</strong> (kind-301).</li>
<li><strong>Seller Accepts Bid</strong> (kind-303).</li>
<li><strong>Buyer Deposits Collateral &amp; Confirms Payment</strong> (kind-311).</li>
<li><strong>Escrow Activated</strong>.</li>
<li><strong>Seller Ships Item</strong> and <strong>Notifies Buyer</strong> (kind-320).</li>
<li><strong>Buyer Fails to Confirm Receipt</strong>.  All funds including the buyers collateral remain locked in escrow.</li>
<li><strong>Seller messages the buyer</strong> requesting confirmation of receipt (kind-320)
<ol class="wp-block-list">
<li><strong>Buyer confirms</strong> receipt to recover their collateral (kind-313)</li>
<li><strong>Buyer disputes</strong> the receipt of item
<ul class="wp-block-list">
<li><strong>Seller or buyer Initiates a Dispute</strong> (kind-312)
<ul class="wp-block-list">
<li><strong>Arbitration is offered </strong>(kind-316)
<ul class="wp-block-list">
<li><strong>Mutual Agreement</strong> is made (kind 315) by both parties to have 3rd party resolve the issue off protocol</li>
<li><strong>Mutual Agreement</strong> fails and all parties’ fund remain locked</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ol>
</li>
</ol>
<p class="wp-block-paragraph"><strong>Scenario 3: Seller Fails to Ship the Item</strong></p>
<p class="wp-block-paragraph"><strong>Additional Steps</strong>:</p>
<ul class="wp-block-list">
<li><strong>Buyer Initiates Communication</strong> (kind-320).</li>
<li><strong>Mutual Agreement to Cancel</strong> (kind-315).</li>
<li><strong>Funds and Collateral Returned</strong>.</li>
</ul>
<p class="wp-block-paragraph"><strong>Potential Attack Vectors and Mitigation Strategies</strong></p>
<p class="wp-block-paragraph"><strong>1. Client Software Manipulation</strong></p>
<p class="wp-block-paragraph"><strong>Threat:</strong> Users may modify client software to bypass protocol rules, potentially releasing escrowed funds without proper authorization.</p>
<p class="wp-block-paragraph"><strong>Mitigation Strategies:</strong></p>
<ul class="wp-block-list">
<li><strong>Cryptographic Enforcement:</strong>
<ul class="wp-block-list">
<li>All events must be signed using the user’s private key.</li>
<li>Events include references to previous events, creating an immutable chain.</li>
<li>Clients and relays verify signatures and event integrity before processing.</li>
</ul>
</li>
<li><strong>Protocol Compliance Checks:</strong>
<ul class="wp-block-list">
<li>Clients enforce protocol rules by validating event structures and sequences.</li>
<li>Non-compliant events are rejected, preventing unauthorized actions.</li>
</ul>
</li>
<li><strong>Community Standards:</strong>
<ul class="wp-block-list">
<li>Promote the use of open-source, audited client software.</li>
<li>Encourage users to verify the authenticity of their client software.</li>
</ul>
</li>
</ul>
<p class="wp-block-paragraph"><strong>2. Sybil Attacks</strong></p>
<p class="wp-block-paragraph"><strong>Threat:</strong> An attacker creates multiple fake identities to manipulate reputation scores or flood the network with spam.</p>
<p class="wp-block-paragraph"><strong>Mitigation Strategies:</strong></p>
<ul class="wp-block-list">
<li>Require Proof of Work (PoW) or small LN payments for certain actions, increasing the cost of creating unlimited events to manipulate the system.</li>
<li>Relays set their own anti-spam policies, filtering out spam.</li>
<li>Possibility to assign more weight to feedback from users with established reputations.</li>
<li>Limiting ratings to actual sale events</li>
</ul>
<p class="wp-block-paragraph"><strong>3. Denial of Service (DoS) Attacks</strong></p>
<p class="wp-block-paragraph"><strong>Threat:</strong> Attackers flood relays with bogus events, causing service degradation.</p>
<p class="wp-block-paragraph"><strong>Mitigation Strategies:</strong></p>
<ul class="wp-block-list">
<li>Relays or clients may implement rate limits to control the flow of events.</li>
<li>Relays or clients may Increase PoW difficulty during high traffic periods.</li>
<li>Clients and users can switch to alternative relays if one becomes unresponsive.</li>
</ul>
<p class="wp-block-paragraph"><strong>4. Man-in-the-Middle (MitM) Attacks</strong></p>
<p class="wp-block-paragraph"><strong>Threat:</strong> Attackers intercept and alter communication between parties.</p>
<p class="wp-block-paragraph"><strong>Mitigation Strategies:</strong></p>
<ul class="wp-block-list">
<li><strong>End-to-End Encryption:</strong>
<ul class="wp-block-list">
<li>Sensitive messages can be encrypted using the recipient’s public key.</li>
<li>Only the intended recipient can decrypt and read the message.</li>
</ul>
</li>
<li><strong>Digital Signatures:</strong>
<ul class="wp-block-list">
<li>All events are digitally signed by the sender.</li>
<li>Recipients verify signatures to ensure authenticity and integrity.</li>
</ul>
</li>
<li><strong>Secure Communication Channels:</strong>
<ul class="wp-block-list">
<li>Use secure transport protocols (e.g., TLS) where applicable.</li>
</ul>
</li>
</ul>
<p class="wp-block-paragraph"><strong>5. Replay Attacks</strong></p>
<p class="wp-block-paragraph"><strong>Threat:</strong> Attackers resend valid events to manipulate the protocol’s state.</p>
<p class="wp-block-paragraph"><strong>Mitigation Strategies:</strong></p>
<ul class="wp-block-list">
<li><strong>Event Identifiers and Timestamps:</strong>
<ul class="wp-block-list">
<li>Each event includes a unique ID and timestamp.</li>
<li>Clients track processed events to prevent duplicate processing.</li>
</ul>
</li>
<li><strong>Nonces and Sequence Numbers:</strong>
<ul class="wp-block-list">
<li>Incorporate nonces or sequence numbers in events.</li>
<li>Events with unexpected sequence numbers are rejected.</li>
</ul>
</li>
</ul>
<p class="wp-block-paragraph"><strong>6. Collusion Between Parties</strong></p>
<p class="wp-block-paragraph"><strong>Threat:</strong> Parties collude to defraud others, such as a buyer and arbitrator working together against a seller.</p>
<p class="wp-block-paragraph"><strong>Mitigation Strategies:</strong></p>
<ul class="wp-block-list">
<li>Negative feedback from affected parties impacts the reputation of colluding users.</li>
<li>Future participants can avoid interacting with low-reputation users.</li>
<li>All events, including arbitration agreements and outcomes, are publicly recorded.</li>
<li>Suspicious patterns can be detected by the community.</li>
<li>Funds cannot be released without mutual agreement, reducing the impact of collusion.</li>
<li>Make it so arbitrators can be chosen at random based on reputation scores.</li>
</ul>
<p class="wp-block-paragraph"><strong>7. Privacy Attacks</strong></p>
<p class="wp-block-paragraph"><strong>Threat:</strong> Observers analyze public events to link transactions and identify users.</p>
<p class="wp-block-paragraph"><strong>Mitigation Strategies:</strong></p>
<ul class="wp-block-list">
<li>Encrypt messages containing sensitive information.</li>
<li>Avoid including personal data in public event fields.</li>
<li>Only essential information is included in events.</li>
<li>Sensitive details can be shared off-protocol or within encrypted messages.</li>
</ul>
<p class="wp-block-paragraph"><strong>Conclusion</strong></p>
<p class="wp-block-paragraph">DOMP’s decentralized approach addresses key challenges in security, fraud prevention, and trust-building within online marketplaces. By fostering collaboration among developers and users, DOMP has the potential to contribute significantly to the future of peer-to-peer commerce.</p>
<ul class="wp-block-list">
<li><strong>Enhanced Buyer Confidence</strong>: Requiring the seller to post collateral first reduces the risk of trolling and demonstrates commitment.</li>
<li><strong>Explicit Escrow Establishment</strong>: The escrow mechanism is clearly defined, using LN invoices and protocol agreements without requiring third-party escrow agents.</li>
<li><strong>Combined Payment and Collateral Confirmation</strong>: By integrating the buyer’s collateral deposit and payment confirmation into a single event (kind-311), the protocol ensures that buyers cannot bypass collateral requirements, enhancing security.</li>
<li><strong>Effective Communication</strong>: Incorporating kind-320 events allows for seamless communication between parties, such as shipping notifications.</li>
<li><strong>Robust Reputation System with Abuse Prevention</strong>: Requiring kind-321 events to reference specific previous events ensures that only parties involved in a transaction can rate each other, preventing abuse of the rating system.</li>
<li><strong>Exclusive Buyer Control Over Funds Release</strong>: Buyers alone can release funds from escrow unless mutual agreement or arbitration is initiated.</li>
<li><strong>No Unilateral Seller Access to Escrowed Funds</strong>: Sellers must fulfill their obligations to access payments.</li>
<li><strong>Optional Arbitration and Third Parties</strong>: The protocol allows for third-party involvement only when both parties agree.</li>
<li><strong>Market-Driven Anti-Spam Measures</strong>: Relays set their own anti-spam policies, promoting a dynamic and adaptable network.</li>
<li><strong>Event Integrity and Security</strong>: Strict event structures and cryptographic references ensure transaction integrity without centralized oversight.</li>
</ul>
<p class="wp-block-paragraph"><strong>Trade-offs and Reasonings</strong>:</p>
<ul class="wp-block-list">
<li><strong>Combined Payment and Collateral Confirmation</strong>: Enhances security by ensuring that the buyer cannot confirm payment without simultaneously depositing their collateral.</li>
<li><strong>Mandatory Event References in Reputation Feedback</strong>: Prevents abuse by ensuring that only participants in a transaction can submit feedback, and each transaction can only be rated once.</li>
<li><strong>Separate Event Types for Bid Acceptance and Counter Bids</strong>: Enhances clarity and reduces the risk of misunderstandings.</li>
<li><strong>Seller Posts Collateral First</strong>: Increases buyer confidence without adding risk to the seller, as they can refund funds if the buyer disengages.</li>
<li><strong>Optional Third-Party Involvement</strong>: Maintains decentralization and user autonomy, allowing flexibility when disputes arise.</li>
<li><strong>Reputation System Universality</strong>: By storing reputation events on Nostr relays, reputation scores are universally accessible and consistent across clients, while calculations are performed by clients following standardized methods.</li>
</ul>
<p class="wp-block-paragraph">Realizing the vision of DOMP’s decentralized approach requires collaborative efforts from the community. Interested parties are encouraged to contribute to the development and implementation of this protocol. If you are interested in being involved contact me on nostr @Fromperdomp</p>
<p class="wp-block-paragraph">npub19n4ecg8l4l3fxe0muam78zth0hudt3l64fgezz20hyahcwq42sss587dtv</p>
<p class="wp-block-paragraph"></p>
]]></content:encoded>
	</item>
	<item>
		<title>On The Limitations of Bitcoin Privacy</title>
		<link>https://bitcoin-takeover.com/bitcoin-privacy-limitations/</link>
		<dc:creator><![CDATA[Vlad Costea]]></dc:creator>
		<pubDate>Mon, 23 Sep 2024 00:45:56 +0000</pubDate>
		<category><![CDATA[Articles]]></category>
		<category><![CDATA[Bitcoin]]></category>
		<category><![CDATA[Magazine]]></category>
		<category><![CDATA[Privacy Magazine]]></category>
		<guid isPermaLink="false">https://bitcoin-takeover.com/?p=13960</guid>
		<description><![CDATA[<p>Bitcoin is a permanent open ledger whose privacy features have mostly been defeated by blockchain analysis. Every transaction, after being confirmed into…</p>]]></description>
		<content:encoded><![CDATA[<p class="wp-block-paragraph">Bitcoin is a permanent open ledger whose privacy features have mostly been defeated by blockchain analysis. Every transaction, after being confirmed into a block, is considered final (though some will argue that waiting for six confirmations is the more conservative way to guarantee permanence). And once this transaction has been added to the ledger, anyone can analyze it for as long as the network stays online — and this scrutiny can continue offline if someone stores a complete copy of the blockchain. In other words, Bitcoin is a pseudonymous panopticon which derives its privacy from the idea of deniability: the more users participate in the system and accept to be paid directly for BTC, the harder it becomes to certainly associate addresses and transactions with identities of real people.</p>
<p class="wp-block-paragraph">But in the era of blockchain analysis, when most on-ramps and off-ramps are subjected to KYC/AML procedures, breaking the deniability is easier than ever. And privacy, while it appears to be decent at the moment when the transaction occurs, can only degrade over time as the sender and the receiver may accidentally or willingly divulge more information later on. Satoshi himself wrote this in the whitepaper: ”some linking is still unavoidable with multi-input transactions, which necessarily reveal that their inputs were owned by the same owner. The risk is that if the owner of a key is revealed, linking would reveal other transactions that belonged to the same owner” [1].</p>
<p class="wp-block-paragraph">While some self-described ”toxic maximalists” will argue that Bitcoin is inherently fungible at the protocol level and discrimination is only an issue at the social layer, it’s nearly impossible to not distinguish between monetary units while the origins are clear. In June 2024, PayPal co-founder Peter Thiel has made one of the most candid observations on the topic: ”when people in the FBI tell me that they’d much rather have criminals use Bitcoin than $100 bills, it suggests that maybe it’s not quite working the way it was supposed to” [2].</p>
<p class="wp-block-paragraph">Regardless of this depressing status-quo, there are three types of arguments to be made in favor of Bitcoin’s aspirations to become a private digital currency: the first one concerns the history and origins of the project, the second one is about sound money and the requirement to obtain fungibility, and the third is about some efforts that developers have made over the years.   </p>
<h3 class="wp-block-heading"><strong>1. Bitcoin’s History and Cypherpunk Origins</strong></h3>
<p class="wp-block-paragraph">In an e-mail that he sent to b-money inventor Wei Dai in August 2008, Satoshi Nakamoto attached a document called ”ecash.pdf” [3] — an early draft of the Bitcoin whitepaper whose working title implies the creation of a decentralized approach to David Chaum’s privacy-friendly electronic cash system. At chapter 10, just like in the final draft of the Bitcoin whitepaper which was revealed to the world on October 31st, readers can find a rather naive but useful description of how bitcoiners can transact with a degree of privacy: every time a user receives bitcoins, he should generate a new ”public key” whose purpose and identity are known only by the sender.</p>
<p class="wp-block-paragraph">This method was also demonstrated by Satoshi Nakamoto while he mined blocks: currently, the ”1 million BTC” theory is a mere assumption that Sergio Demian Lerner has made during his Patoshi research in 2013 [4]. We cannot know for certain which blocks were discovered by Satoshi, as every coinbase reward of 50 BTC was sent to a different address.</p>
<p class="wp-block-paragraph">According to professional software engineers who analyzed version 0.1 of the Bitcoin software, Satoshi Nakamoto was not a seasoned C++ developer. He created a system that was pieced together from open source libraries, included a broken game of poker and a peer to peer marketplace, and made it available only on Windows. It took the efforts of other developers such as Hal Finney, Gavin Andresen, Jeff Garzik, Mike Hearn, Wladimir van Der Laan, Gregory Maxwell, and Laszlo Hanyecz to refine the code, break it down into manageable chunks, and port it to Linux, MacOS, and mobile platforms. Satoshi Nakamoto’s amateurish and “hacky” coding style was attested by early contributor Jeff Garzik [5] and Libbitcoin maintainer Eric Voskuil [6]. </p>
<p class="wp-block-paragraph">Based on these observations, as well as some e-mail exchanges in which Satoshi appeared to be insecure about his project and seemed to look up to Hal Finney, we know that the Bitcoin creator wasn’t some time-traveling alien AI who invented digital alchemy (as Saylorists seem to believe) and he wasn’t a CIA/NSA professional either. Satoshi didn’t invent or write from scratch the building blocks of Bitcoin: elliptic curve digital signatures, Merkle trees, SHA256, Proof of Work, public key cryptography, peer to peer networks, electronic cash and blockchains were all available as separate iterations that served distinct purposes. But he did want Bitcoin to be a decentralized version of Chaumian ecash — a true holy grail among the cypherpunk community.</p>
<p class="wp-block-paragraph">The above paragraph, though it may seem unnecessary in the context of a discussion on privacy, is useful in providing context for what kind of software developer Satoshi was and what his intentions were. We do know that he wanted his system to have privacy, but at the same time he wasn’t the best coder or cryptographer around. He merely used the open source libraries that were available to him at the time. And most of the privacy technology that emerged later (ring signatures, zero knowledge proofs, MimbleWimble, confidential transactions, ZK rollups) marks an attempt to improve on a rough software stack and bring it closer to fulfilling its mission.</p>
<p class="wp-block-paragraph">We know with certainty that Satoshi Nakamoto cared about improving Bitcoin’s privacy because, during his short tenure as lead developer and educator in chief he provided feedback to some early improvement proposals. This intellectual contribution is frequently pointed out by Monero fans, who claim that their network of choice closely follows the writings of Satoshi. </p>
<p class="wp-block-paragraph">On August 11th 2010, as part of Bitcoin Talk’s 770th thread (titled ”Not a suggestion”), Satoshi Nakamoto replied to users Red and Insti who proposed using Zero Knowledge Proofs to minimize the amount of transaction data being stored by full nodes. Initially, the Bitcoin creator made a pretty interesting suggestion: ”if a solution was found, a much better, easier, more convenient implementation of Bitcoin would be possible.” [7]</p>
<p class="wp-block-paragraph">Two days later, under the same forum topic, Satoshi described three elements that lay at the foundation of today’s Monero and ZCash:  </p>
<p class="wp-block-paragraph">”Can public nodes see the values of transactions?” — a condition which later inspired the creation of Confidential Transactions.</p>
<p class="wp-block-paragraph">”When paying to a bitcoin address, you would generate a new blinded key for each use” — a vague description of stealth/shielded addresses and Silent Payments, as well as one-time public keys.</p>
<p class="wp-block-paragraph">”I think that’s where group signatures comes in. With group signatures, it is possible for something to be signed but not know who signed it.” — a description of what would later become ring signatures in Monero and mixing pools in ZCash (as well as CoinJoins in Bitcoin).</p>
<p class="wp-block-paragraph">Satoshi Nakamoto didn’t only answer to the comments posted by the users, he also proved that he’s been researching the topics and presented the limitations of his discovery: ”Crypto may offer a way to do ‘key binding’. I did some research and it was obscure, but there may be something there. ‘Group signatures’ may be related.”</p>
<p class="wp-block-paragraph">As always, the Bitcoin creator presented a practical example to spark the imagination of the contributors: “say some unpopular military attack has to be ordered, but nobody wants to go down in history as the one who ordered it. If 10 leaders have private keys, one of them could sign the order and you wouldn’t know who did it.”</p>
<p class="wp-block-paragraph">Satoshi also encouraged others to find a solution to a problem he couldn’t solve during his short tenure as lead developer: “The challenge is, how do you prove that no other spends exist?  It seems a node must know about all transactions to be able to verify that. If it only knows the hash of the in/outpoints, it can’t check the signatures to see if an outpoint has been spent before.  Do you have any ideas on this?”</p>
<p class="wp-block-paragraph">Hal Finney, legendary PGP coder and the first notable cypherpunk to give Bitcoin a chance, is responsible for putting out the famous “Running bitcoin” tweet — published on January 11th 2009. But only 10 days later, he wrote about a lesser known but equally significant effort: “Looking at ways to add more anonymity to bitcoin” [8]</p>
<p class="wp-block-paragraph">This post was sent out to the world two years before Silk Road was launched, and it would take five years for the intelligence company Chainalysis to get founded. Without fueling any “Hal Finney was Satoshi” theories, it’s worth noting that his early concerns were valid and haven’t been dismissed yet. Bitcoin never received more anonymity — just a little bit more deniability via transaction obfuscation. </p>
<h3 class="wp-block-heading"><strong>2. Sound Money Requires Fungibility</strong></h3>
<p class="wp-block-paragraph">Now let’s talk about the properties of sound money — a status which Bitcoin unquestionably aspires to attain. Even in the event that it scales down its purpose to remain a store of value, a certain degree of fungibility is still required. Currently, discrimination of transactions is possible at the validator and block producer level: nodes can choose to filter out transactions of arbitrary types or coming from a certain source, while miners can ignore transactions that they don’t like (most famously, Ocean Pool filters ordinal inscriptions and MARA Pool rejects addresses on the OFAC list).</p>
<p class="wp-block-paragraph">The reason why Bitcoin still works as designed is the incentive system: it’s relatively easy for the sender to spin up a node which saves his transaction in the mempool and keeps on broadcasting it — any contemporary computer can run Bitcoin Core or Libbitcoin. Likewise, for every censorship-friendly mining cartel, there can always be another independent block producer who will not mind collecting the transaction fee.</p>
<p class="wp-block-paragraph">However, in a world in which KYC/AML practices become prevalent and blockchain analysis is an industry standard, there is a lot more information about Bitcoin users, addresses, and miners. So resourceful governments can pressure participants into following a strict blacklisting procedure, with very draconian punishments for miners who break the rule. Naturally, geopolitical game theory fixes part of the problem because we live in a multi-polar world with a plurality of superpowers that don’t always collaborate.</p>
<p class="wp-block-paragraph">But a project like Bitcoin should not rely on goodwill or flaws in the structure of human politics — instead, it should become censorship resistant by design. The only way to achieve this feat is to make it impossible for miners to act in ways which differ from the system’s incentives: therefore, collect the highest fees to confirm transactions without caring about the origins. If Bitcoin adds a degree of confidentiality, which enables senders to remain private and also hide the amounts that they’re sending, then the system would finally support sound money.</p>
<p class="wp-block-paragraph">As any monetary theorist will tell you, fungibility is a very important quality for good money. An ounce of gold is equal in value with another one of the same purity, regardless of its origins. A $100 bill will buy you the same amount of goods and services, even if it was previously held by Brad Pitt, the President of the USA, a construction worker, a convicted criminal, or all of them at different times.</p>
<p class="wp-block-paragraph">In the case of Bitcoin, you still encounter “freshly mined coins”, “Silk Road coins”, “dark market coins”, “Mt. Gox coins”, “Coinbase coins”, “Kraken coins”, “CoinJoined coins”, “ordinals”, and all sorts of ways to differentiate according to origin. On the free market, freshly mined coins are usually deemed more valuable — for the simple reason that they have no past.</p>
<p class="wp-block-paragraph">Interestingly, Bitcoin does have a built-in fungibility mechanism: once a transaction fee gets paid, the corresponding coins get mined again as part of the block reward. So even the most “tainted” coins can become squeaky clean once a miner collects them as fees and reissues them. However, this is not enough: and to expect all “tainted” bitcoins to get sent as transaction fees is extremely unrealistic. What Bitcoin needs is a system that makes it impossible to discriminate according to previous ownership — and if users (and outside observers) cannot know, then they will have no means to censor.</p>
<h3 class="wp-block-heading"><strong>3. The Proposals to Make Bitcoin Private</strong></h3>
<p class="wp-block-paragraph">Almost sixteen years into Bitcoin’s existence, we have a remarkable series of discoveries and inventions that can improve its privacy. Some of them are already part of the Core software stack (such as BIP32, whose hierarchical deterministic wallets help create more deniability) or exist as additional features in various wallets (such as CoinJoin in Wasabi, JoinMarket &amp; Samourai, or Silent Payments in Cake Wallet). But these solutions alone aren’t good enough. They generate a degree of deniability, but can’t hide the amounts being transacted and are generally worse for the sender.</p>
<p class="wp-block-paragraph">This is why we must look into the plethora of more or less experimental proposals which offer privacy with various tradeoffs. Most commonly, there are three types of criticism regarding anything which concerns Bitcoin privacy:</p>
<ol class="wp-block-list">
<li>That the extra obfuscation occupies more blockchain space and therefore won’t scale, as is the case of Confidential Transactions and Ring Signatures (both available on Monero);</li>
<li>That hiding transaction amounts may lead to unwanted monetary inflation in the event of bug exploits, as the money supply is no longer easy to audit;</li>
<li>That privacy of any kind might get Bitcoin delisted from exchanges, banned from certain jurisdictions, or even scare away institutional investors who put billions of dollars into building their BTC portfolios while assuming that the software is complete, stagnant, and easy to audit by regulators;</li>
</ol>
<p class="wp-block-paragraph">The first two issues can be avoided via elegant cryptography, cautious development, and rigorous testing. Privacy enthusiasts can launch the new features on other networks, incentivize scrutiny and adversarial interactions, and then propose their refined discoveries to the Bitcoin community. However, even the ideal solution becomes useless if there is no social support for its implementation in particular or for anything that aims to fix Bitcoin privacy in general. If the culture gets eroded by complacency and “number go up” hopium, then the desire for fiat money gains will stall any cypherpunk aspiration — it won’t be until fungibility really becomes an issue which blatantly erodes the financial well-being of a majority of users that the conversation about adding privacy becomes serious.</p>
<p class="wp-block-paragraph">Politics aside, it’s useful to pay attention to breakthroughs in the world of privacy, understand how they work, and think of ways to apply similar protocols or principles to Bitcoin (preferably, without requiring major changes to the consensus code). It’s how ideas get refined and distilled into their most efficient form. It’s also how clever workarounds get discovered, as means to circumvent the conservative nature of the Bitcoin protocol.</p>
<h3 class="wp-block-heading"><strong>The 4 types of Bitcoin Privacy</strong></h3>
<p class="wp-block-paragraph">Before proceeding with the analysis, it’s important to distinguish between the four types of Bitcoin privacy: sender, receiver, amounts, and network-level. For a more thorough breakdown on the topic, I recommend you to listen to Paul Puey on S15 E48 of the Bitcoin Takeover podcast [7].</p>
<p class="wp-block-paragraph">When used as Satoshi suggested in the whitepaper (new address for every incoming transaction), Bitcoin protects the identity of the receivers — that is, until further multi-input transactions are made to break the deniability. If the user makes use of the Tor network or a powerful mixnet such as Nym, then other peers cannot figure out where the node or light wallet is located based on IP address. So Bitcoin can also have pretty good network-level privacy.</p>
<p class="wp-block-paragraph">However, there is little to no privacy for the sender: as the receiver can see the amount being sent and how much change was returned after the transaction. And speaking of amounts, there is no way to have any confidentiality for the number of coins being transferred — at least not on the base layer.</p>
<p class="wp-block-paragraph">A good way to get deniability when sending Bitcoin is to transfer the entire amount from the UTXO to avoid change. This can be interpreted as a self-transfer to a new wallet, but can also be a payment. Nobody really knows initially, unless the veil gets lifted later when a KYC/AML off-ramp gets involved or someone makes a mistake.</p>
<p class="wp-block-paragraph">There are several significant proposals to address these shortcomings, and they will be presented according to the issue they address. </p>
<h4 class="wp-block-heading"><strong>Dandelion++ for Network-Level privacy</strong></h4>
<p class="wp-block-paragraph">For example, Dandelion was created to significantly boost network-level privacy by inserting a random delay that breaks the link between IP addresses and individual transactions. It was proposed for Bitcoin in 2017, received a significant improvement (Dandelion++) the next year, but it never made into the Bitcoin project.</p>
<p class="wp-block-paragraph">Though there was some interest from developers, the users never really pushed for the adoption of this particular privacy enhancement — and if you ask the average bitcoiner today, they won’t know what Dandelion is and probably assume you’re speaking about a “shitcoin”. The protocol was however added to Monero, Firo, and a bunch of other privacy projects. It would have been great to have it in Bitcoin, since it doesn’t require any kind of fork or consensus and none of the concerns listed above would apply.</p>
<h4 class="wp-block-heading"><strong>MWEB for Sender Privacy &amp; Hiding Amounts</strong></h4>
<p class="wp-block-paragraph">The MimbleWimble Extension Block protocol was also proposed for Bitcoin, but ended up getting developed for Litecoin. Back in 2016, Blockstream head of research Andrew Poelstra presented the idea to put MimbleWimble (a novel and groundbreaking privacy and scalability protocol) on an extension block [8]. This integration would require a soft fork and enables bitcoiners to peg their coins into a larger anonymization pool where the amounts being sent are hidden and you can’t lurk into someone else’s address. </p>
<p class="wp-block-paragraph">All you can observe in MWEB is how many coins join the pool, where the peg-ins come from, and where the peg-outs go. Though the latter two points might sound like an issue, they can be mitigated with CoinJoins to create enough deniability to make analysis difficult. </p>
<p class="wp-block-paragraph">MimbleWimble comes packaged with confidential transactions — a technology that was built for Bitcoin, was picked up by Monero, but scales much better in the updated design of Tom Elvis Jedusor. It has been available on Litecoin since May 2022 and still works flawlessly, with mobile integrations and light wallets being developed in recent months to increase portability. </p>
<p class="wp-block-paragraph">Historically, Litecoin is the network that tests upgrades which are considered to be too risky or avant-garde for Bitcoin — it happened in the case of SegWit, then it continued with main net Lightning Network experiments that were later moved to BTC. However, this time around there seems to be no interest in adding MWEB: there is no BIP to promote it, there are almost no debates about it, and critics usually point out to MimbleWimble and say it’s not ”good enough” for privacy (as if other proposals are seriously being considered or else there is something that Bitcoin already has). </p>
<p class="wp-block-paragraph">Can MWEB scale? Absolutely! Thanks to the embedded data compression, it prunes older transactions and remains compact in size. Block size increases can be applied to it without really requiring more storage from nodes.</p>
<p class="wp-block-paragraph">It’s also designed in a way which makes the supply easier to audit — anyone can see how much liquidity exists in the anonymity pool, and then nodes can reject amounts that exceed the peg-ins. But will it lead to exchange delistings?</p>
<p class="wp-block-paragraph">As Litecoin demonstrated, not really. Only a couple of Korean exchanges did that due to regulatory uncertainty. The big players never dropped support. MWEB is an opt-in layer for transactions — and businesses can still operate on the main chain if they want to have full transparency. </p>
<p class="wp-block-paragraph">It’s definitely a useful and interesting proposal which does contribute towards fixing Bitcoin’s privacy and scalability issues. However, as revealed in S15 E17 of the Bitcoin Takeover podcast, not even Andrew Poelstra (the man who first thought of putting MimbleWimble on a Bitcoin Extension Block) is passionate about the idea anymore… not even after it’s been implemented on a Bitcoin-compatible network [9]. But if you want to hear a technical and somewhat optimistic discussion on the topic of MWEB, listen to S15 E59 with David Burkett — the man who made it all happen [10]. </p>
<h4 class="wp-block-heading"><strong>Statechains, CoinJoins &amp; PayJoins for Pragmatic Sender Privacy</strong></h4>
<p class="wp-block-paragraph">Statechains, CoinJoins, and PayJoins (payments coming directly from CoinJoins) at scale can also mitigate some of Bitcoin’s privacy issues. The sender’s privacy definitely gets a boost, but amounts being moved on the main chain remain visible. With Statechains, currently developed by CommerceBlock for the MercuryLayer, users can seamlessly swap UTXOs of equal sizes without leaving any permanent record on the base layer. It’s a pretty cool concept, as the transfer of ownership happens without the blockchain. To learn more about it, listen to my interview with developers Nicholas Gregory and Tom Trevethan [10]. </p>
<p class="wp-block-paragraph">However, the incentive to perform this swap only exists when you don’t want your further transactions to carry your identity. And if UTXO swapping is exclusive to those who need it, then the coins being exchanged aren’t necessarily ”the cleanest” that everyone wants. This is why CoinJoins should be used in conjunction with Statechain CoinSwaps — so that all the bitcoins involved are equally clean and equally dirty at the same time. Paying out of CoinJoins is also necessary in order to preserve the privacy benefits.</p>
<p class="wp-block-paragraph">However, the user experience for following this process is still cumbersome and the cost might be a little too high for most people (especially in a high fee environment, which Bitcoin expects to have). But even if Bitcoin does scale and the interfaces do get optimized to serve non-technical users, there still needs to be enough demand for this type of privacy. The reason why privacy is still niche is that very few bitcoiners actually use it.</p>
<h4 class="wp-block-heading"><strong>Drivechains for Pretty Much Everything</strong> </h4>
<p class="wp-block-paragraph">One of the most interesting, yet controversial proposals to improve Bitcoin is Drivechains: Layer Two Labs CEO Paul Sztorc has come up with the idea of miner-enforced sidechains that copy the features of every altcoin. This way, the scaling solution also acquires the benefits of  adding functionality and utility. Basically, Drivechains fulfill the dream of Bitcoin maximalism — that of having every use case and every transaction on Bitcoin, within the economy provided by the 21 million supply cap. The concept is explained by BIP 300 and BIP301.</p>
<p class="wp-block-paragraph">In terms of privacy, Drivechains come packaged with a Zcash sidechain that provides the most advanced privacy that’s available today (as it’s a direct fork of the latest version of Zcash). It’s called Zside and can be downloaded from the LayerTwo Labs website for testing purposes on the Bitcoin signet.</p>
<p class="wp-block-paragraph">To use it, bitcoiners must transfer their coins into the sidechain and lock them for approximately 13000 blocks (the time frame between the deposit and the withdrawal was architected like this to ensure system stability). On the base layer, the coins get frozen in a time lock contract. On the Zside chain, the same amount of BTC gets minted and becomes usable for as long as the user keeps the funds pegged.</p>
<p class="wp-block-paragraph">This means that the supply is always clear, the amount of coins locked in the Zcash sidechain can be verified, so there is no risk of hidden inflation. By virtue of being a sidechain that can choose to prune transaction history after a certain point, it’s also very scalable. And in terms of regulators banning it or exchanges delisting BTC, they’d have to enable support for this particular layer first. Bitcoin remains unaffected.</p>
<p class="wp-block-paragraph">Of course, some Bitcoin Core developers such as Matt Corallo and Peter Todd have expressed concerns about mining centralization and MEV (Maximal Extracted Value) [11]. But Paul Sztorc is currently working on the CUSF (Core Untouched Soft Fork) activation method, which involves bypassing the opinions of Bitcoin Core by directly dealing with the miners [12]. Since the block reward is diminishing and the amount of transaction fees collected by the miners is disappointingly low, there’s an incentive for block producers to enable merged mining. Drivechains also come bundled with blind merged mining, which is really useful in this multi-chain context.</p>
<p class="wp-block-paragraph">If implemented, Drivechains open up the technical possibility for Bitcoin to onboard the entire planet and provide all the smart contracts or privacy features that one might desire. But at this point in time, it seems like the community would rather discuss covenant soft forks and OP code restoration than think bigger in terms of what the Bitcoin network can be. It seems unlikely that Core developers will agree on activating BIP 300, but the miners might just coordinate to maximize their revenue — because to them, the next few years are going to be all about the fees.</p>
<h4 class="wp-block-heading"><strong>Covenants for ZK Rollups &amp; Trust Minimized Sidechains</strong></h4>
<p class="wp-block-paragraph">While they don’t provide any privacy benefits by themselves, covenant soft forks such as OP_CTV, OP_CAT, and OP_ANYPREVOUT are tools which allow developers to build trust-minimized sidechains and ZK rollups. With covenants, layers such as Liquid and Rootstock (which today rely on trusted setups or federations) can significantly improve their decentralization. </p>
<p class="wp-block-paragraph">Also, as suggested by Bitcoin developer Super Testnet, Drivechains could get built using OP_CAT and BitVM — but there are some tradeoffs in terms of user benefits and protections that make the Drivechains soft fork activation preferable. </p>
<p class="wp-block-paragraph">ZK rollups are also an interesting import from Ethereum, which allows users to transact with pretty good privacy on scalable layer twos. Projects like Citrea and Alpen Labs already exist and work towards building proper rollups for Bitcoin, but their ability is still limited by the lack of specific features unlocked by covenant soft forks.</p>
<p class="wp-block-paragraph">Covenants can also support the creation of CoinJoin implementations that don’t have a coordinator in the middle. Something like Wasabi Wallet can get built in an automated manner, without central servers. The research of 1440000000 bytes (also known as ”Floppy”) is definitely interesting and can lead to a future in which CoinJoins are uncensorable and much easier to use.</p>
<p class="wp-block-paragraph">It’s also worth noting that StarkWare, a protocol which brings Zcash-level privacy using Zero Knowledge STARKs (Scalable Transparent Arguments of Knowledge), can come to Bitcoin. Eli Ben-Sasson, the mastermind behind the system, has previously worked with ZK SNARKs (used in Zcash) and has been speaking about bringing privacy and instant blockchain synchronization to Bitcoin since at least 2014. He also co-authored the Zerocash research paper and has been on a journey to refine Zero Knowledge proofs for BTC for almost a decade.</p>
<p class="wp-block-paragraph">ZK STARKs are already available on Ethereum. But if Bitcoin activates OP_CAT (or else the StarkWare researchers figure out how to build it without the extended function), then we can see this avantgarde cryptographic magic coming via ZK rollups. Not quite the ideal way, which would involve making standard base layer transactions private, but in tune with the philosophy to scale in layers with various benefits and tradeoffs.</p>
<p class="wp-block-paragraph">The future is promising for these concepts, though some community members express concerns about the ability to build anything using concatenations (OP_CAT). Regardless, the privacy provided does not directly impact normal 1 input-2 outputs transactions on the base layer and it’s not as good as adding opt-in Zcash transactions. But this appears to be the path that gets most ”consensus” among bitcoiners, as many of them seem to agree that a covenant soft fork is useful.</p>
<p class="wp-block-paragraph">It’s also worth noting the existence of projects such as Bitcoin OS which claim they can emulate the features of a covenant without any soft fork, and therefore allow Bitcoin to ossify and become ”permaware”. It’s an interesting approach, but it comes with limitations and tradeoffs that get fixed by an actual network upgrade. In 2024, I’ve recorded interviews with pretty much all the big players in the covenant and ZK rollups space — from Robin Linus and Orkun Kilic to Liam Eagen, Alexei Zamyatin, Eden Yago and Super Testnet. You’ll find many of these conversations if you scroll through season 15 of the show!</p>
<h4 class="wp-block-heading"><strong>Privacy Hard Forks</strong></h4>
<p class="wp-block-paragraph">Now we’re stepping into the field of high fantasy, as the goal is to dream about Monero or Zcash-like features on Bitcoin. However, a more radical change to the protocol, which implies a hard fork, does not necessarily lead towards better privacy. In the end, privacy is achieved when there are lots of participants who use the same protocol for the purpose of becoming indistinguishable from each other.</p>
<p class="wp-block-paragraph">So it doesn’t make much sense to fantasize about Confidential Transactions (available today on Liquid) or Ring Signatures. Also, Zcash’s ZK SNARKs or Halo2 cryptography probably won’t come to Bitcoin any time soon. The reasons don’t only concern political/regulatory concerns, but also the scalability argument — anything that generates larger transaction sizes within the small block framework is less desirable.</p>
<p class="wp-block-paragraph">But we can also look at projects like Decred, which managed to make every on-chain transaction a Wabisabi-like CoinJoin (CoinShuffle++, in which the amounts are visible, but there’s a lot of deniability for the sender) and also make the Lightning network more stable. I’ve interviewed Decred’s Jake Yokom-Piatt and Phoenix Green in S15 E55 of the Bitcoin Takeover Podcast and I think it’s a really interesting conversation from which we can learn [14].</p>
<p class="wp-block-paragraph">Ultimately, I believe that Bitcoin will integrate a more mature version of Zcash’s protocol. It will come in a time of crisis, when institutional adoption proves to be a fad and the users find themselves desiring for ways to hide from oppressive governments. Since day one, the Zcash protocol has been thought as a way to improve Bitcoin — and Zcash’s similarities in design (21 million coins, initial Proof of Work mining) are no coincidence.</p>
<p class="wp-block-paragraph">Hard forking to add privacy is the final boss — a moment that culminates a long series of social-political experiences and technical experiments. Bitcoin will undoubtedly choose to become sound money by employing the most mature, well-tested, and efficient protocol available. This is why the users, instead of being complacent, should be engaged in testing features on altcoins in order to identify the implementations that show potential and get ready for the moment when Bitcoin must get something similar. </p>
<p class="wp-block-paragraph">As mentioned in the first part of this article, it’s important to demolish any suspicion of hidden inflation. It’s also important for the privacy protocol to be scalable to the point that private transactions don’t come in larger data sizes (which is why it appears that ZK proofs might take us there). </p>
<p class="wp-block-paragraph">Last but not least, privacy should be the default and universal setting — users must never have to deal with a perishing fungibility that gets ruined by one bad actor who holds the coins, and they shouldn’t know a world where privacy is stigmatized either. Nobody questions you today when you hand a dollar bill to somebody else in a public place. Nobody will question you in the future for sending a peer to peer digital money transaction to a stranger, using a public, inclusive, and socially-mundane payments network. It’s just how evolution works.</p>
<p class="wp-block-paragraph">Bitcoin will one day be 100% fungible — and we need to prepare for that day, both technologically and socially.</p>
<h2 class="wp-block-heading"><strong>Bitcoin Is Still a Panopticon</strong></h2>
<p class="wp-block-paragraph">Given the volume of information presented, we can safely affirm that allowing Bitcoin to have very poor privacy today was a choice. It might be the result of negligence or cowardice on behalf of the users and developers. It may be a consequence of the ”number go up no matter the cost” mentality, combined with the fear of getting delisted from exchanges.</p>
<p class="wp-block-paragraph">It’s possible that the efforts to please regulators, portray Bitcoin as the nice chain that criminals avoid, and eventually embed in into the traditional financial system via ETFs might have be part of the reason. But regardless of the cause, the situation is not great: not for the users, not for the network, and definitely not for the fungibility of the currency.</p>
<p class="wp-block-paragraph">Sure, CoinJoins are fine — but they still reveal the amounts being transacted and some of the participants might later KYC to diminish the others’ deniability. CoinSwaps via Statechains (as designed by Mercury Wallet) are also useful, but you never know when you get a much more ”tainted” UTXO than the one you sent out. The CoinJoin outputs may be considered ”tainted” and therefore unacceptable by some economic actors. Until the moment Bitcoin gets privacy for the amounts being sent, these issues will continue to affect users.</p>
<p class="wp-block-paragraph">Since Hal Finney’s ”Looking for ways to add more anonymity to bitcoin”, which he published 18 days after the Bitcoin network launched, internet money nerds have aspired to reach this goal without any technical roadblocks or social/political issues. Almost 16 years later, we have much better research and development in the field of privacy. A decade from now, we will have perfected these tools. What matters the most is to not capitulate to dinosaur institutions offering us Sim City cheat code money, and also to try to not feel jaded about the apparent lack of progress. Technology will get us there — but are we ready for it? </p>
<p class="wp-block-paragraph"><strong>Sources:</strong></p>
<ol class="wp-block-list">
<li>The Bitcoin Whitepaper, Satoshi Nakamoto, 2008, Available at: <a href="https://bitcoin.org/bitcoin.pdf">https://bitcoin.org/bitcoin.pdf</a> </li>
<li>Peter Thiel on Aspen Ideas Festival 2024, Available at: <a href="https://youtu.be/B3ZXrTzskw0" rel="noreferrer noopener" target="_blank">https://youtu.be/B3ZXrTzskw0</a> </li>
<li>Nakamoto Studies Institute, Electronic Cash Without A Trusted Third Party, Available at: <a href="https://www.nakamotostudies.org/literature/ecash.html">https://www.nakamotostudies.org/literature/ecash.html</a> </li>
<li>Sergio Demian Lerner, ”The Well-Deserved Fortune of Satoshi Nakamoto, Bitcoin Creator, Visionary and Genius”, April 2013, Available at: <a href="https://bitslog.com/2020/06/22/a-new-mystery-in-patoshi-timestamps/">https://bitslog.com/2020/06/22/a-new-mystery-in-patoshi-timestamps/</a> </li>
<li>Jeff Garzik, ”Hemi Presents Satoshi Stories — The Secret Behind Satoshi’s Real Identity”, Available <a href="https://youtu.be/Zi92Y0WpEg4?si=yYwU5TiQKZfmVwal">at</a>: <a href="https://youtu.be/Zi92Y0WpEg4?si=yYwU5TiQKZfmVwal" rel="noreferrer noopener" target="_blank">https://youtu.be/Zi92Y0WpEg4?si=yYwU5TiQKZfmVwal</a></li>
<li>Erik Voskuil on the Bitcoin Takeover Podcast, S5 E8, Around 00:20:51, May 2020, Available at: <a href="https://bitcoin-takeover.com/s5-e8-eric-voskuil-on-libbitcoin-development-cryptoeconomics-book-austrian-economics/" rel="noreferrer noopener" target="_blank">https://bitcoin-takeover.com/audio/index.php?name=2020-05-13_s5_e8_eric_voskuil_on_misean_economics__cryptoeconomics.mp3</a></li>
<li>Satoshi Nakamoto on the Bitcoin Talk Forum, Replying to Topic #770, In response to Red, August 11th 2010, Available at: <a href="https://bitcointalk.org/index.php?topic=770.msg8637%23msg8637">https://bitcointalk.org/index.php?topic=770.msg8637#msg8637</a> </li>
<li>Andrew Poelstra at SF Bitcoin Developers, November 21st 2016, Available at: <a href="http://youtube.com/watch?v=aHTRlbCaUyM">youtube.com/watch?v=aHTRlbCaUyM</a> </li>
<li>Andrew Poelstra on the Bitcoin Takeover Podcast, S15 E17, February 8th 2024, Available at: <a href="https://bitcoin-takeover.com/andrew-poelstra-bitcoin-covenants-op_cat-vs-op_ctv/">https://bitcoin-takeover.com/andrew-poelstra-bitcoin-covenants-op_cat-vs-op_ctv/</a> </li>
<li>David Burkett on the Bitcoin Takeover Podcast, S15 E59, October 14th 2024, Available at: <a href="https://bitcoin-takeover.com/episodes/s15-e59-david-burkett-on-mweb-privacy/">https://bitcoin-takeover.com/audio/index.php?name=2024-10-14_s15_e59__david_burkett_on_mweb_privacy.mp3</a> </li>
<li>Nicholas Gregory and Tom Trevethan on the Bitcoin Takeover Podcast, S15 E25, March 24h 2024, Available at: <a href="https://bitcoin-takeover.com/s15-e25-nicholas-gregory-tom-trevethan-on-mercurylayer-blinded-statechains-lightning/">https://bitcoin-takeover.com/audio/?name=2024-03-24_nicholas_gregory_tom_trevethan_on_mercury_layer.mp3</a></li>
<li>Peter Todd, ”Drivechains: A Detailed Analysis”, October 13th 2023, Available at: <a href="https://petertodd.org/2023/drivechains">https://petertodd.org/2023/drivechains</a> </li>
<li>Paul Sztorc, ”CUSF — Core Untouched Soft Fork”, v0.4.1 published on June 23rd 2024, Available at: <a href="https://bip300cusf.com/cusf.pdf">https://bip300cusf.com/cusf.pdf</a> </li>
<li>Jake Yokom-Piatt and Phoenix Green on the Bitcoin Takeover Podcast, S15 E55, September 21st 2024, Available at: <a href="https://bitcoin-takeover.com/episodes/s15-e55-jake-yokom-piatt-phoenix-green-on-bitcoin-decred-privacy/">https://bitcoin-takeover.com/audio/index.php?name=2024-09-21_s15_e55_jake_yocom-piatt_phoenix_green_on_bitcoin_decred_privacy.mp3</a></li>
<li>Hal Finney, Personal Twitter Profile, Available at: <a href="https://x.com/halfin/status/1136749815">https://x.com/halfin/status/1136749815</a> </li>
</ol>
]]></content:encoded>
	</item>
</channel>
</rss>
