You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After a taker accepted a public offer (valid bond submitted) both traders have to lock funds in a locking transaction that can only be spent again in collaboration. This locking transaction is a collaborative transaction containing inputs of both maker and taker. Both traders have to sign the locking transaction
44
49
which is then combined by the coordinator. The coordinator will allow the use of the same inputs as in the bond transaction. Once this locking transaction has sufficient confirmations the fiat exchange can begin.
The [taproot](https://github.com/bitcoin/bips/blob/master/bip-0341.mediawiki) escrow output can be unlocked in different ways depending on the trade outcome. In the
58
68
case of a successful trade the output can be spent using the [keypath](https://github.com/bitcoin/bips/blob/master/bip-0341.mediawiki#user-content-Taproot_key_path_spending_signature_validation) with an aggregated signature from two partial signatures of maker and taker, using the MuSig2 scheme. In the case of disputes different script paths can be used to enable unlocking by the coordinator in collaboration with one of the traders.
@@ -92,9 +102,9 @@ let escrow_output_descriptor = "tr(f00949d6dd1ce99a03f88a1a4f59117d553b0da51728b
92
102
```
93
103
94
104
#### <u>Payout transaction</u>
95
-
Once the exchange has been completed or a trader requested escrow the escrow output will be spent again to complete the trade.
105
+
Once the exchange has been completed, or a trader requested escrow, the escrow output will be spent again to complete the trade.
96
106
The transaction is assembled by the coordinator and shared with the clients for signing. Once the coordinator collected the
97
-
necessary information the transaction gets finalized and broadcasted.
107
+
necessary signatures the transaction gets finalized and broadcasted.
98
108
99
109
**Example transaction**, both traders satisfied, keypath spend using aggregated signature (2-of-2):
Example transaction [hex]: 01000000000101c544f644f6f31ca07dfa87a12aac0f103f3cf91483511f275ceeab316f6fa9c90200000000feffffff029808000000000000225120f610990da79b3bddd44a0820e31546319630c06221ea81bd3b798e4dfe9f5c6e388f0100000000002251201aa6d2c49082ae948e87ceb8551496cd6d951b093def3a3269d812db9e3808cf0140c0d07846e1b2b1deeca4a0cf35843417fefbe63086ff491ecc07638a099c0901138ac6e59a9e8b9a0878c098b206bee3427156dd0248d80de80fbdd8540ea00422180000
107
119
```
108
120
109
121
**Example transaction**, buyer sent fiat and won escrow, seller doesn't cooperate:
The protocol partly handled by a coordinator and partly by the client. The coordinator, running on the exchange side, handles trader matching, construction of transactions, monitoring of bonds and more tasks. The client could be bundled to a wasm library and included in the RoboSats frontend. Currently clients are only supposed to talk to the coordinator, not to each other.
*[sqlx](https://docs.rs/sqlx/latest/sqlx/): Storing trade state in a sqlite database
137
+
*[axum](https://docs.rs/axum/latest/axum/): HTTP API (communication client <-> coordinator)
138
+
139
+
140
+
## Project Status
141
+
The repository contains a working CLI demonstrator that is able to complete the trade flow using the MuSig keypath spend on regtest or testnet. This demonstrator can be used to validate and experiment with the concept but is not intended for production use.
0 commit comments