mirror of
https://github.com/basicswap/basicswap.git
synced 2025-11-05 18:38:09 +01:00
doc, ui: Add sequence diagrams
This commit is contained in:
59
doc/protocols/sequence_diagrams/bidder.alt.xu
Normal file
59
doc/protocols/sequence_diagrams/bidder.alt.xu
Normal file
@@ -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"];
|
||||
};
|
||||
}
|
||||
|
||||
69
doc/protocols/sequence_diagrams/offerer.alt.xu
Normal file
69
doc/protocols/sequence_diagrams/offerer.alt.xu
Normal file
@@ -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"];
|
||||
};
|
||||
|
||||
}
|
||||
73
doc/protocols/sequence_diagrams/xmr.offerer.alt.xu
Normal file
73
doc/protocols/sequence_diagrams/xmr.offerer.alt.xu
Normal file
@@ -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"];
|
||||
};
|
||||
}
|
||||
55
doc/protocols/sequence_diagrams/xmr.offerer.simple.xu
Normal file
55
doc/protocols/sequence_diagrams/xmr.offerer.simple.xu
Normal file
@@ -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"];
|
||||
}
|
||||
Reference in New Issue
Block a user