Skip to content

Instantly share code, notes, and snippets.

@matthewjablack
Created March 26, 2022 18:40
Show Gist options
  • Save matthewjablack/b0d57081a4cb96809e81d788b1d58793 to your computer and use it in GitHub Desktop.
Save matthewjablack/b0d57081a4cb96809e81d788b1d58793 to your computer and use it in GitHub Desktop.

DLC Transport

Contract Negotiation

Basic DLC Specs Protocol Contract Negotiation

The DLC Specification outlines contract negotiation in a simple 4 step process. This assumes both parties are already matched or familiar with each other and are both running nodes.

+-------+                    +-------+
|       |                    |       |
|       |---- (1) offer  --->|       |
|       |                    |       |
|       |<--- (2) accept ----|       |
|   A   |                    |   B   |
|       |---- (3) sign   --->|       |
|       |                    |       |
|       |                    |  (4) broadcast fund-tx
|       |                    |       |
+-------+                    +-------+

    - where node A is 'offerer' and node B is 'accepter'

DLC Market Contract Negotiation

Contract negotiation within the DLC Market is a 6 step process that assumes both parties have no knowledge of the other and one party is running a DLC Node.

Specifically, this DLC transport daemon is designed with the assumption that the market maker is running a node, while the taker is a client.

It uses an IRC channel for broadcasting Order Offers and IRC private message for receiving Order Accepts which allows both parties to agree to contract terms before revealing funding inputs and commencing signature generation.

+-------+                       +---------------+        +-------+
|       |                       |IRC Trading Pit|        |       |
|       |+---(1) order offer--->|               |+------>|       |
|       |                       +---------------+        |       |
|       |                                                |       |
|       |                       +---------------+        |       |
|       |<---(2) order accept--+|IRC Private Msg|<------+|       |
|       |                       +---------------+        |       |
|       |                                                |       |
|   A   |                       +---------------+        |   B   |
|       |+---(3) dlc offer----->| Bob Transport |+------>|       |
|       |                       |    Server     |        |       |
|       |<---(4) dlc accept----+|               |<------+|       |
|       |                       |               |        |       |
|       |+---(5) dlc sign------>|               |+------>|       |
|       |                       |               |        |       |
|       |<---(6) dlc finalize--+|               |<------+|  (6) broadcast fund-tx
+-------+                       +---------------+        +-------+

    - where client A is 'offerer' and node B is 'accepter'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment