From d5e35b8168c9c6666eb00fb5cb0227d8b097036c Mon Sep 17 00:00:00 2001 From: tecnovert Date: Wed, 29 Jun 2022 01:45:06 +0200 Subject: [PATCH] doc, ui: Add sequence diagrams --- basicswap/basicswap.py | 6 +- basicswap/http_server.py | 13 ++++ .../sequence_diagrams/bidder.alt.xu.min.svg | 1 + .../sequence_diagrams/offerer.alt.xu.min.svg | 1 + .../xmr.bidder.alt.xu.min.svg | 1 + .../xmr.offerer.alt.xu.min.svg | 1 + basicswap/templates/bid.html | 20 +++++ basicswap/templates/bid_xmr.html | 19 +++++ doc/protocols/sequence_diagrams/bidder.alt.xu | 59 +++++++++++++++ .../sequence_diagrams/offerer.alt.xu | 69 ++++++++++++++++++ .../sequence_diagrams/xmr.offerer.alt.xu | 73 +++++++++++++++++++ .../sequence_diagrams/xmr.offerer.simple.xu | 55 ++++++++++++++ 12 files changed, 315 insertions(+), 3 deletions(-) create mode 100644 basicswap/static/sequence_diagrams/bidder.alt.xu.min.svg create mode 100644 basicswap/static/sequence_diagrams/offerer.alt.xu.min.svg create mode 100644 basicswap/static/sequence_diagrams/xmr.bidder.alt.xu.min.svg create mode 100644 basicswap/static/sequence_diagrams/xmr.offerer.alt.xu.min.svg create mode 100644 doc/protocols/sequence_diagrams/bidder.alt.xu create mode 100644 doc/protocols/sequence_diagrams/offerer.alt.xu create mode 100644 doc/protocols/sequence_diagrams/xmr.offerer.alt.xu create mode 100644 doc/protocols/sequence_diagrams/xmr.offerer.simple.xu diff --git a/basicswap/basicswap.py b/basicswap/basicswap.py index c10eaf1..4329fd4 100644 --- a/basicswap/basicswap.py +++ b/basicswap/basicswap.py @@ -2865,14 +2865,14 @@ class BasicSwap(BaseApp): if TxTypes.XMR_SWAP_A_LOCK_REFUND_SPEND not in bid.txns: try: - txid = ci_from.publishTx(xmr_swap.a_lock_refund_spend_tx) + txid_str = ci_from.publishTx(xmr_swap.a_lock_refund_spend_tx) self.logBidEvent(bid.bid_id, EventLogTypes.LOCK_TX_A_REFUND_SPEND_TX_PUBLISHED, '', session) - self.log.info('Submitted coin a lock refund spend tx for bid {}, txid {}'.format(bid_id.hex(), txid.hex())) + self.log.info('Submitted coin a lock refund spend tx for bid {}, txid {}'.format(bid_id.hex(), txid_str)) bid.txns[TxTypes.XMR_SWAP_A_LOCK_REFUND_SPEND] = SwapTx( bid_id=bid_id, tx_type=TxTypes.XMR_SWAP_A_LOCK_REFUND_SPEND, - txid=bytes.fromhex(txid), + txid=bytes.fromhex(txid_str), ) self.saveBidInSession(bid_id, bid, session, xmr_swap) session.commit() diff --git a/basicswap/http_server.py b/basicswap/http_server.py index b75e3db..c398ad7 100644 --- a/basicswap/http_server.py +++ b/basicswap/http_server.py @@ -639,6 +639,8 @@ class HttpHandler(BaseHTTPRequestHandler): messages = [] show_txns = False + show_offerer_seq_diagram = False + show_bidder_seq_diagram = False show_lock_transfers = False edit_bid = False view_tx_ind = None @@ -658,6 +660,10 @@ class HttpHandler(BaseHTTPRequestHandler): messages.append('Accept failed ' + str(ex)) elif b'show_txns' in form_data: show_txns = True + elif b'show_offerer_seq_diagram' in form_data: + show_offerer_seq_diagram = True + elif b'show_bidder_seq_diagram' in form_data: + show_bidder_seq_diagram = True elif b'edit_bid' in form_data: edit_bid = True elif b'edit_bid_submit' in form_data: @@ -686,6 +692,9 @@ class HttpHandler(BaseHTTPRequestHandler): if bid.debug_ind is not None and bid.debug_ind > 0: messages.append('Debug flag set: {}, {}'.format(bid.debug_ind, DebugTypes(bid.debug_ind).name)) + data['show_bidder_seq_diagram'] = show_bidder_seq_diagram + data['show_offerer_seq_diagram'] = show_offerer_seq_diagram + old_states = [] num_states = len(bid.states) // 12 for i in range(num_states): @@ -988,6 +997,10 @@ class HttpHandler(BaseHTTPRequestHandler): self.putHeaders(status_code, 'text/css') with open(os.path.join(static_path, 'style.css'), 'rb') as fp: return fp.read() + elif len(url_split) > 3 and url_split[2] == 'sequence_diagrams': + self.putHeaders(status_code, 'image/svg+xml') + with open(os.path.join(static_path, 'sequence_diagrams', url_split[3]), 'rb') as fp: + return fp.read() else: self.putHeaders(status_code, 'text/html') return self.page_404(url_split) diff --git a/basicswap/static/sequence_diagrams/bidder.alt.xu.min.svg b/basicswap/static/sequence_diagrams/bidder.alt.xu.min.svg new file mode 100644 index 0000000..2828531 --- /dev/null +++ b/basicswap/static/sequence_diagrams/bidder.alt.xu.min.svg @@ -0,0 +1 @@ + NetworkOffererBidder Sends OfferDetects OfferSends BidSends Initiate TxSends BidAcceptDetects Initiate TxWait for ITX to confirmWait for ITX to confirmSends Participate TxDetects Participate TxWait for PTX to confirmWait for PTX to confirmSends Participate Redeem TxDetects Participate Redeem TxSends Initiate Redeem TxWait for ITX Redeem to confirmfail pathWait for PTX locktime to expirePTX Refund TxWait for PTX Refund to confirmBid SentUser accepts bidOfferer generates secret_value and sends Hash(secret_value) tothe BidderITX can be spent by knowledge of thesecret_value and the bidder_redeem_key or after a timeoutby the offerer_refund_keyBid AcceptedITX SentITX ConfirmedPTX can be spent by knowledge of thesecret_value and the offerer_redeem_key or after a timeoutby the bidder_refund_keyPTX SentPTX ConfirmedBid ParticipatingReveals secret_valuealt: success pathPTX RedeemedITX RedeemedBid CompletedPTX Refunded \ No newline at end of file diff --git a/basicswap/static/sequence_diagrams/offerer.alt.xu.min.svg b/basicswap/static/sequence_diagrams/offerer.alt.xu.min.svg new file mode 100644 index 0000000..d23c657 --- /dev/null +++ b/basicswap/static/sequence_diagrams/offerer.alt.xu.min.svg @@ -0,0 +1 @@ + NetworkOffererBidder Sends OfferDetects OfferSends BidSends Initiate TxSends BidAcceptDetects Initiate TxWait for ITX to confirmWait for ITX to confirmSends Participate TxDetects Participate TxWait for PTX to confirmSends Participate Redeem TxDetects Participate Redeem TxSends Initiate Redeem TxWait for ITX Redeem to confirmfail path, offerer refunds ITx, bidder losesWait for ITX locktime to expireITX Refund TxWait for ITX Refund to confirmfail pathWait for ITX locktime to expireITX Refund TxWait for ITX Refund to confirmBid ReceivedUser accepts bidOfferer generates secret_value and sends Hash(secret_value) tothe BidderITX can be spent by knowledge of thesecret_value and the bidder_redeem_key or after a timeoutby the offerer_refund_keyBid AcceptedITX SentBid InitiatedITX Confirmedalt: success pathPTX can be spent by knowledge of thesecret_value and the offerer_redeem_key or after atimeout by the bidder_refund_keyPTX SentPTX ConfirmedBid ParticipatingReveals secret_valuePTX Redeemedalt: success pathITX RedeemedBid CompletedITX RefundedBid CompletedITX RefundedBid Completed \ No newline at end of file diff --git a/basicswap/static/sequence_diagrams/xmr.bidder.alt.xu.min.svg b/basicswap/static/sequence_diagrams/xmr.bidder.alt.xu.min.svg new file mode 100644 index 0000000..c4b0e55 --- /dev/null +++ b/basicswap/static/sequence_diagrams/xmr.bidder.alt.xu.min.svg @@ -0,0 +1 @@ + NetworkOffererBidder Sends OfferDetects OfferSends BidSends BidAccept messageSends XmrBidLockTxSigsMessageSends XmrBidLockSpendTxMessageSends script-coin-lock-txWait forscript-coin-lock-tx toconfirmSends noscript-coin-lock-txWait fornoscript-coin-lock-tx toconfirmWait fornoscript-coin-lock-tx toconfirmSends script-coin-lock-txrelease messageSends script-coin-lock-spend-txfail pathWait forscript-coin-lock-tx lock toexpireSendsscript-coin-lock-pre-refund-txscript-coin-lock-pre-refund-txWait forpre-refund tx to confirmSendsscript-coin-lock-pre-refund-spend-txDetects script-coin-lock-pre-refund-spend-txSends scriptless-coin-lock-recover-txbidder swipes script coin lock txWait forpre-refund tx lock to expireSends script-coin-lock-pre-refund-swipe-txBid SentUser accepts bidThe BidAccept message contains the pubkeys the offerer will use anda DLEAG proof one key will work across both chains of the swappingcoinsBid Receiving acceptBid AcceptedThe XmrBidLockTxSigsMessage contains the bidder's signatures for thescript-coin-lock-refund and script-coin-lock-refund-spend txns.The XmrBidLockSpendTxMessage contains the script-coin-lock-tx andthe offerer's signature for it.Bid Script coin spend tx validBid Script coin lockedalt: success pathBid Scriptless coin lockedThe XmrBidLockReleaseMessage contains the offerer's OTVES for it. The bidder decodes the offerer's signaturefrom the OTVES. When the offerer has theplaintext signature, they can decode the bidder's noscript-coin-lock-txsignature.Script coin lock releasedScript tx redeemedBid Completedtx can be sent by either party.Bid Script pre-refund tx inchainalt: offerer refunds script coin lock txRefunds the script lock tx, with the offerer's cleartext signaturethe bidder can refund the noscript lock tx. Once the lock expires the pre-refund tx can be spent by the bidder.Bid Failed, refundedBidder recovers the offerer's scriptless chain key-shard.Bid Scriptless tx recoveredBid Failed, refundedBid Failed, swiped \ No newline at end of file diff --git a/basicswap/static/sequence_diagrams/xmr.offerer.alt.xu.min.svg b/basicswap/static/sequence_diagrams/xmr.offerer.alt.xu.min.svg new file mode 100644 index 0000000..2b53bc2 --- /dev/null +++ b/basicswap/static/sequence_diagrams/xmr.offerer.alt.xu.min.svg @@ -0,0 +1 @@ + NetworkOffererBidder Sends OfferDetects OfferSends BidSends BidAccept messageSends XmrBidLockTxSigsMessageSends XmrBidLockSpendTxMessageSends script-coin-lock-txWait forscript-coin-lock-tx toconfirmWait forscript-coin-lock-tx toconfirmSends noscript-coin-lock-txWait fornoscript-coin-lock-tx toconfirmSends script-coin-lock-txrelease messageSends script-coin-lock-spend-txDetects script-coin-lock-spend-txSends noscript-coin-lock-spend-txWait fornoscript-coin-lock-spend-txto confirmfail pathWait forscript-coin-lock-txlocktime to expireSendsscript-coin-lock-pre-refund-txscript-coin-lock-pre-refund-txWait forpre-refund tx to confirmSendsscript-coin-lock-pre-refund-spend-txBid ReceivingBid ReceivedUser accepts bidThe BidAccept message contains the pubkeys the offerer will use and aDLEAG proof one key will work across both chains of the swapping coinsBid AcceptedThe XmrBidLockTxSigsMessage contains the bidder's signatures for thescript-coin-lock-refund and script-coin-lock-refund-spend txns.The XmrBidLockSpendTxMessage contains the script-coin-lock-tx and theofferer's signature for it.Bid Script coin spend tx validBid Script coin lockedalt: success pathBid Scriptless coin lockedThe XmrBidLockReleaseMessage contains the offerer's OTVES for thescript-coin-lock-tx. The bidder decodes theofferer's signature from the OTVES. When theofferer has the plaintext signature, they can decode the bidder's keyfor the noscript-lock-tx.Bid Script coin lock releasedBid Script tx redeemedThe offerer extracts the bidder's plaintext signature and derives thebidder's noscript-lock-tx keyhalf.Bid Scriptless tx redeemedBid Completedtx can be sent by either party.Bid Script pre-refund tx inchainRefunds the script lock tx, with the offerer's cleartext signaturethe bidder can refund the noscript lock tx.Bid Failed, refunded \ No newline at end of file diff --git a/basicswap/templates/bid.html b/basicswap/templates/bid.html index 535fe4d..125e2e1 100644 --- a/basicswap/templates/bid.html +++ b/basicswap/templates/bid.html @@ -77,9 +77,29 @@ {% endif %} {% endif %} +
+{% if data.show_bidder_seq_diagram %} + +{% else %} + +{% endif %} +{% if data.show_offerer_seq_diagram %} + +{% else %} + +{% endif %} +{% if data.show_bidder_seq_diagram %} + +{% endif %} + +{% if data.show_offerer_seq_diagram %} + +{% endif %} + +

Old States

diff --git a/basicswap/templates/bid_xmr.html b/basicswap/templates/bid_xmr.html index b15f939..8f70a24 100644 --- a/basicswap/templates/bid_xmr.html +++ b/basicswap/templates/bid_xmr.html @@ -74,6 +74,17 @@ {% endif %} {% endif %} +
+{% if data.show_bidder_seq_diagram %} + +{% else %} + +{% endif %} +{% if data.show_offerer_seq_diagram %} + +{% else %} + +{% endif %} {% if data.show_txns %} @@ -119,6 +130,14 @@ {% endif %} +{% if data.show_bidder_seq_diagram %} + +{% endif %} + +{% if data.show_offerer_seq_diagram %} + +{% endif %} + {% if data.chain_a_lock_tx_inputs %}
Chain A Lock TX Inputs:
diff --git a/doc/protocols/sequence_diagrams/bidder.alt.xu b/doc/protocols/sequence_diagrams/bidder.alt.xu new file mode 100644 index 0000000..4eb69f4 --- /dev/null +++ b/doc/protocols/sequence_diagrams/bidder.alt.xu @@ -0,0 +1,59 @@ +xu { + hscale = "1.2"; + + CB [label=" ", linecolor="transparent"], + N [label="Network", linecolor="#008800", textbgcolor="#CCFFCC", arclinecolor="#008800"], + O [label="Offerer", linecolor="#FF0000", textbgcolor="#FFCCCC", arclinecolor="#FF0000"], + B [label="Bidder", linecolor="#0000FF", textbgcolor="#CCCCFF", arclinecolor="#0000FF"], + C [label=" ", linecolor="transparent"], C2 [label=" ", linecolor="transparent"]; + O =>> N [label="Sends Offer"]; + N >> B [label="Detects Offer"]; + B =>> O [label="Sends Bid"]; + B abox B [label="Bid Sent"]; + O box O [label="User accepts bid"]; + O =>> N [label="Sends Initiate Tx"], + C note C2 + [label="Offerer generates secret_value and sends Hash(secret_value) to the Bidder", + textbgcolor="#FFFFCC"]; + O =>> B [label="Sends BidAccept"], + C note C2 + [label="ITX can be spent by + knowledge of the secret_value and the bidder_redeem_key or + after a timeout by the offerer_refund_key", + textbgcolor="#FFFFCC"]; + + B abox B [label="Bid Accepted"]; + N >> B [label="Detects Initiate Tx"]; + B abox B [label="ITX Sent", textbgcolor="#4bdbf1"]; + B => B [label="Wait for ITX to confirm"], O => O [label="Wait for ITX to confirm"]; + B abox B [label="ITX Confirmed", textbgcolor="#4bdbf1"]; + B =>> N [label="Sends Participate Tx"], + C note C2 + [label="PTX can be spent by + knowledge of the secret_value and the offerer_redeem_key or + after a timeout by the bidder_refund_key", + textbgcolor="#FFFFCC"]; + B abox B [label="PTX Sent", textbgcolor="#f1db4b"]; + N >> O [label="Detects Participate Tx"]; + B => B [label="Wait for PTX to confirm"], O => O [label="Wait for PTX to confirm"]; + B abox B [label="PTX Confirmed", textbgcolor="#f1db4b"]; + B abox B [label="Bid Participating"]; + O =>> N [label="Sends Participate Redeem Tx"], + C note C2 + [label="Reveals secret_value", + textbgcolor="#FFFFCC"]; + CB alt C [label="success path"] { + N >> B [label="Detects Participate Redeem Tx"]; + B abox B [label="PTX Redeemed", textbgcolor="#f1db4b"]; + B =>> N [label="Sends Initiate Redeem Tx"]; + B => B [label="Wait for ITX Redeem to confirm"]; + B abox B [label="ITX Redeemed", textbgcolor="#4bdbf1"]; + B abox B [label="Bid Completed"]; + --- [label="fail path"]; + B => B [label="Wait for PTX locktime to expire"]; + B =>> N [label="PTX Refund Tx"]; + B => B [label="Wait for PTX Refund to confirm"]; + B abox B [label="PTX Refunded", textbgcolor="#f1db4b"]; + }; +} + diff --git a/doc/protocols/sequence_diagrams/offerer.alt.xu b/doc/protocols/sequence_diagrams/offerer.alt.xu new file mode 100644 index 0000000..61755f4 --- /dev/null +++ b/doc/protocols/sequence_diagrams/offerer.alt.xu @@ -0,0 +1,69 @@ +xu { + hscale = "1.2"; + + CB [label=" ", linecolor="transparent"], + N [label="Network", linecolor="#008800", textbgcolor="#CCFFCC", arclinecolor="#008800"], + O [label="Offerer", linecolor="#FF0000", textbgcolor="#FFCCCC", arclinecolor="#FF0000"], + B [label="Bidder", linecolor="#0000FF", textbgcolor="#CCCCFF", arclinecolor="#0000FF"], + C [label=" ", linecolor="transparent"], C2 [label=" ", linecolor="transparent"]; + O =>> N [label="Sends Offer"]; + N >> B [label="Detects Offer"]; + B =>> O [label="Sends Bid"]; + O abox O [label="Bid Received"]; + O box O [label="User accepts bid"]; + O =>> N [label="Sends Initiate Tx"], + C note C2 + [label="Offerer generates secret_value and sends Hash(secret_value) to the Bidder", + textbgcolor="#FFFFCC"]; + O =>> B [label="Sends BidAccept"], + C note C2 + [label="ITX can be spent by + knowledge of the secret_value and the bidder_redeem_key or + after a timeout by the offerer_refund_key", + textbgcolor="#FFFFCC"]; + + O abox O [label="Bid Accepted"]; + O abox O [label="ITX Sent", textbgcolor="#4bdbf1"]; + N >> B [label="Detects Initiate Tx"]; + B => B [label="Wait for ITX to confirm"], O => O [label="Wait for ITX to confirm"]; + O abox O [label="Bid Initiated"]; + O abox O [label="ITX Confirmed"]; + CB alt C [label="success path"] { + B =>> N [label="Sends Participate Tx"], + C note C2 + [label="PTX can be spent by + knowledge of the secret_value and the offerer_redeem_key or + after a timeout by the bidder_refund_key", + textbgcolor="#FFFFCC"]; + N >> O [label="Detects Participate Tx"]; + O abox O [label="PTX Sent", textbgcolor="#f1db4b"]; + O => O [label="Wait for PTX to confirm"]; + O abox O [label="PTX Confirmed", textbgcolor="#f1db4b"]; + O abox O [label="Bid Participating"]; + O =>> N [label="Sends Participate Redeem Tx"], + C note C2 + [label="Reveals secret_value", + textbgcolor="#FFFFCC"]; + N >> B [label="Detects Participate Redeem Tx"]; + O abox O [label="PTX Redeemed", textbgcolor="#f1db4b"]; + CB alt C [label="success path"] { + B =>> N [label="Sends Initiate Redeem Tx"]; + O => O [label="Wait for ITX Redeem to confirm"]; + O abox O [label="ITX Redeemed", textbgcolor="#4bdbf1"]; + O abox O [label="Bid Completed"]; + --- [label="fail path, offerer refunds ITx, bidder loses"]; + O => O [label="Wait for ITX locktime to expire"]; + O =>> N [label="ITX Refund Tx"]; + O => O [label="Wait for ITX Refund to confirm"]; + O abox O [label="ITX Refunded", textbgcolor="#4bdbf1"]; + O abox O [label="Bid Completed"]; + }; + --- [label="fail path"]; + O => O [label="Wait for ITX locktime to expire"]; + O =>> N [label="ITX Refund Tx"]; + O => O [label="Wait for ITX Refund to confirm"]; + O abox O [label="ITX Refunded", textbgcolor="#4bdbf1"]; + O abox O [label="Bid Completed"]; + }; + +} diff --git a/doc/protocols/sequence_diagrams/xmr.offerer.alt.xu b/doc/protocols/sequence_diagrams/xmr.offerer.alt.xu new file mode 100644 index 0000000..7b789d7 --- /dev/null +++ b/doc/protocols/sequence_diagrams/xmr.offerer.alt.xu @@ -0,0 +1,73 @@ +xu { + hscale="1.3", wordwraparcs=on; + + CB [label=" ", linecolor="transparent"], + N [label="Network", linecolor="#008800", textbgcolor="#CCFFCC", arclinecolor="#008800"], + O [label="Offerer", linecolor="#FF0000", textbgcolor="#FFCCCC", arclinecolor="#FF0000"], + B [label="Bidder", linecolor="#0000FF", textbgcolor="#CCCCFF", arclinecolor="#0000FF"], + C [label=" ", linecolor="transparent"], C2 [label=" ", linecolor="transparent"]; + O =>> N [label="Sends Offer"]; + N >> B [label="Detects Offer"]; + B =>> O [label="Sends Bid"]; + O abox O [label="Bid Receiving"]; + O abox O [label="Bid Received"]; + O box O [label="User accepts bid"]; + O =>> B [label="Sends BidAccept message"], + C note C2 + [label="The BidAccept message contains the pubkeys the offerer will use and a DLEAG proof one key will work across both chains of the swapping coins", + textbgcolor="#FFFFCC"]; + O abox O [label="Bid Accepted"]; + B =>> O [label="Sends XmrBidLockTxSigsMessage"], + C note C2 + [label="The XmrBidLockTxSigsMessage contains the bidder's signatures for the script-coin-lock-refund and script-coin-lock-refund-spend txns.", + textbgcolor="#FFFFCC"]; + O =>> B [label="Sends XmrBidLockSpendTxMessage"], + C note C2 + [label="The XmrBidLockSpendTxMessage contains the script-coin-lock-tx and the offerer's signature for it.", + textbgcolor="#FFFFCC"]; + O =>> N [label="Sends script-coin-lock-tx"], + O abox O [label="Bid Script coin spend tx valid"]; + |||; + B => B [label="Wait for script-coin-lock-tx to confirm"], O => O [label="Wait for script-coin-lock-tx to confirm"]; + O abox O [label="Bid Script coin locked"]; + CB alt C [label="success path"] { + B =>> N [label="Sends noscript-coin-lock-tx"]; + |||; + O => O [label="Wait for noscript-coin-lock-tx to confirm"]; + O abox O [label="Bid Scriptless coin locked"]; + O => B [label="Sends script-coin-lock-tx release message"], + C note C2 + [label="The XmrBidLockReleaseMessage contains the offerer's OTVES for the script-coin-lock-tx. + The bidder decodes the offerer's signature from the OTVES. + When the offerer has the plaintext signature, they can decode the bidder's key for the noscript-lock-tx.", + textbgcolor="#FFFFCC"]; + O abox O [label="Bid Script coin lock released"]; + B =>> N [label="Sends script-coin-lock-spend-tx"]; + N >> O [label="Detects script-coin-lock-spend-tx"]; + O abox O [label="Bid Script tx redeemed"], + C note C2 + [label="The offerer extracts the bidder's plaintext signature and derives the bidder's noscript-lock-tx keyhalf.", + textbgcolor="#FFFFCC"]; + O =>> N [label="Sends noscript-coin-lock-spend-tx"]; + O abox O [label="Bid Scriptless tx redeemed"]; + |||; + O => O [label="Wait for noscript-coin-lock-spend-tx to confirm"]; + O abox O [label="Bid Completed"]; + --- [label="fail path"]; + |||; + O => O [label="Wait for script-coin-lock-tx locktime to expire"]; + O =>> N [label="Sends script-coin-lock-pre-refund-tx"], + C note C2 + [label="tx can be sent by either party.", + textbgcolor="#FFFFCC"]; + N >> O [label="script-coin-lock-pre-refund-tx"]; + O abox O [label="Bid Script pre-refund tx in chain"]; + |||; + O => O [label="Wait for pre-refund tx to confirm"]; + O =>> N [label="Sends script-coin-lock-pre-refund-spend-tx"], + C note C2 + [label="Refunds the script lock tx, with the offerer's cleartext signature the bidder can refund the noscript lock tx.", + textbgcolor="#FFFFCC"]; + O abox O [label="Bid Failed, refunded"]; + }; +} diff --git a/doc/protocols/sequence_diagrams/xmr.offerer.simple.xu b/doc/protocols/sequence_diagrams/xmr.offerer.simple.xu new file mode 100644 index 0000000..dcce045 --- /dev/null +++ b/doc/protocols/sequence_diagrams/xmr.offerer.simple.xu @@ -0,0 +1,55 @@ +xu { + hscale="1.3", wordwraparcs=on; + + CB [label=" ", linecolor="transparent"], + N [label="Network", linecolor="#008800", textbgcolor="#CCFFCC", arclinecolor="#008800"], + O [label="Offerer", linecolor="#FF0000", textbgcolor="#FFCCCC", arclinecolor="#FF0000"], + B [label="Bidder", linecolor="#0000FF", textbgcolor="#CCCCFF", arclinecolor="#0000FF"], + C [label=" ", linecolor="transparent"], C2 [label=" ", linecolor="transparent"]; + O =>> N [label="Sends Offer"]; + N >> B [label="Detects Offer"]; + B =>> O [label="Sends Bid"]; + O abox O [label="Bid Receiving"]; + O abox O [label="Bid Received"]; + O box O [label="Input: Accepts bid"]; + O =>> B [label="Sends BidAccept message"], + C note C2 + [label="The BidAccept message contains the pubkeys the offerer will use and a DLEAG proof one key will work across both chains of the swapping coins", + textbgcolor="#FFFFCC"]; + O abox O [label="Bid Accepted"]; + B =>> O [label="Sends XmrBidLockTxSigsMessage"], + C note C2 + [label="The XmrBidLockTxSigsMessage contains the bidder's signatures for the script-coin-lock-refund and script-coin-lock-refund-spend txns.", + textbgcolor="#FFFFCC"]; + O =>> B [label="Sends XmrBidLockSpendTxMessage"], + C note C2 + [label="The XmrBidLockSpendTxMessage contains the script-coin-lock-tx and the offerer's signature for it.", + textbgcolor="#FFFFCC"]; + O =>> N [label="Sends script-coin-lock-tx"], + O abox O [label="Bid Script coin spend tx valid"]; + |||; + B => B [label="Wait for script-coin-lock-tx to confirm"], O => O [label="Wait for script-coin-lock-tx to confirm"]; + O abox O [label="Bid Script coin locked"]; + B =>> N [label="Sends noscript-coin-lock-tx"]; + |||; + O => O [label="Wait for noscript-coin-lock-tx to confirm"]; + O abox O [label="Bid Scriptless coin locked"]; + O => B [label="Sends script-coin-lock-tx release message"], + C note C2 + [label="The XmrBidLockReleaseMessage contains the offerer's OTVES for the script-coin-lock-tx. + The bidder decodes the offerer's signature from the OTVES. + When the offerer has the plaintext signature, they can decode the bidder's key for the noscript-lock-tx.", + textbgcolor="#FFFFCC"]; + O abox O [label="Bid Script coin lock released"]; + B =>> N [label="Sends script-coin-lock-spend-tx"]; + N >> O [label="Detects script-coin-lock-spend-tx"]; + O abox O [label="Bid Script tx redeemed"], + C note C2 + [label="The offerer extracts the bidder's plaintext signature and derives the bidder's noscript-lock-tx keyhalf.", + textbgcolor="#FFFFCC"]; + O =>> N [label="Sends noscript-coin-lock-spend-tx"]; + O abox O [label="Bid Scriptless tx redeemed"]; + |||; + O => O [label="Wait for noscript-coin-lock-spend-tx to confirm"]; + O abox O [label="Bid Completed"]; +}