From c55f3e34030fe2bc8503e70922c60cf650ac2652 Mon Sep 17 00:00:00 2001 From: Franck Royer Date: Wed, 13 Jan 2021 11:47:02 +1100 Subject: [PATCH 1/4] Remove Req-Res and update for single market maker use case - Bob initiate swap with BTC Amount - Alice acks with approx. xmr amount - Rework terminology, make a difference between negotiations and execution setup - Remove request response channels in favor of one shots - Give exact amount to Bob once assets are locked --- docs/sequence.puml | 66 ++++++++++++++++++++++++---------------------- 1 file changed, 34 insertions(+), 32 deletions(-) diff --git a/docs/sequence.puml b/docs/sequence.puml index ec2b4bca..4ebc86d9 100644 --- a/docs/sequence.puml +++ b/docs/sequence.puml @@ -4,52 +4,53 @@ actor Bob Actor Alice database Monero -Bob --> Alice: Establish connection +group Negotiation -group Request Response Channel - Bob -> Alice: Request Amounts - note left: Btc Amount + Bob --> Alice: Establish connection - Alice --> Bob: Send Amounts - note right: Btc & Xmr Amounts + group Request Response Channel + Bob -> Alice: Swap request + note left: Btc Amount\naddress hints + note right: Alice stores peer id & address hints\nto contact Bob + + Alice --> Bob: Swap response + note right: ACK or NACK\n Approx. XMR amount + end end -group Request Response Channel - Bob -> Alice: bob::Message0 - note left: Pubkeys\ndleq proof s_b\nxmr viewkey v_b\nbtc refund addr +group Execution Setup + group Phase 0 [Messages can be exchanged in any order] + Bob -> Alice: bob::Message0 + note left: Pubkeys\ndleq proof s_b\nxmr viewkey v_b\nbtc refund addr - Alice --> Bob: alice::Message0 - note right: Pubkeys\ndleq proof s_a\nxmr view key v_a\nbtc redeem addr\nbtc punish addr + Alice -> Bob: alice::Message0 + note right: Pubkeys\ndleq proof s_a\nxmr view key v_a\nbtc redeem addr\nbtc punish addr + end + + group Phase 1 [Messages must be exchanged in the given order] + + Bob -> Alice: bob::Message1 + note left: unsigned btc lock tx + + Alice -> Bob: alice::Message1 + note right: btc cancel tx sig\nbtc refund tx enc sig S_b + + Bob -> Alice: bob::Message2 + note left: btc punish tx sig\nbtc cancel tx sig + + end end -group Request Response Channel - Bob -> Alice: bob::Message1 - note left: btc lock tx - - Alice --> Bob: alice::Message1 - note right: cancel tx sig\nrefund tx enc sig S_b -end - -group Request Response Channel - Bob -> Alice: bob::Message2 - note left: punish tx sig\ncancel tx sig - -== Negotiated == - +group Execution Bob ->> Bitcoin: Lock Alice ->> Monero: Lock - Alice --> Bob: alice::Message2 - note right: xmr lock tx transfer proof -end + Alice -> Bob: alice::Message2 + note right: Exact xmr amount\nzxmr lock tx transfer proof\nThis can be removed if Bob watches the blockchain. -group Request Response Channel Bob -> Alice: bob::Message3 note left: redeem tx enc sig S_a - Alice --> Bob: alice::Message3 - note right: Empty -end Alice ->> Bitcoin: Redeem @@ -58,5 +59,6 @@ end Bob -> Bob: Extract s_a Bob ->> Monero: Redeem +end @enduml From 6b4a02427a3ca699406fd6015708406f617f8092 Mon Sep 17 00:00:00 2001 From: Franck Royer Date: Thu, 14 Jan 2021 10:27:33 +1100 Subject: [PATCH 2/4] Use global counter to name messages --- docs/sequence.puml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/sequence.puml b/docs/sequence.puml index 4ebc86d9..53fbdaff 100644 --- a/docs/sequence.puml +++ b/docs/sequence.puml @@ -19,23 +19,23 @@ group Negotiation end group Execution Setup - group Phase 0 [Messages can be exchanged in any order] - Bob -> Alice: bob::Message0 + group Phase A [Messages can be exchanged in any order] + Bob -> Alice: Message0 note left: Pubkeys\ndleq proof s_b\nxmr viewkey v_b\nbtc refund addr - Alice -> Bob: alice::Message0 + Alice -> Bob: Message1 note right: Pubkeys\ndleq proof s_a\nxmr view key v_a\nbtc redeem addr\nbtc punish addr end - group Phase 1 [Messages must be exchanged in the given order] + group Phase B [Messages must be exchanged in the given order] - Bob -> Alice: bob::Message1 + Bob -> Alice: Message2 note left: unsigned btc lock tx - Alice -> Bob: alice::Message1 + Alice -> Bob: Message3 note right: btc cancel tx sig\nbtc refund tx enc sig S_b - Bob -> Alice: bob::Message2 + Bob -> Alice: Message4 note left: btc punish tx sig\nbtc cancel tx sig end @@ -46,10 +46,10 @@ group Execution Alice ->> Monero: Lock - Alice -> Bob: alice::Message2 + Alice -> Bob: Message5 note right: Exact xmr amount\nzxmr lock tx transfer proof\nThis can be removed if Bob watches the blockchain. - Bob -> Alice: bob::Message3 + Bob -> Alice: Message6 note left: redeem tx enc sig S_a Alice ->> Bitcoin: Redeem From 8ff33bd386482fc4faff3f5793f3d9c2b96dd69c Mon Sep 17 00:00:00 2001 From: Franck Royer Date: Thu, 14 Jan 2021 10:45:29 +1100 Subject: [PATCH 3/4] Use exact xmr amount --- docs/sequence.puml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/sequence.puml b/docs/sequence.puml index 53fbdaff..fe6ada79 100644 --- a/docs/sequence.puml +++ b/docs/sequence.puml @@ -14,7 +14,7 @@ group Negotiation note right: Alice stores peer id & address hints\nto contact Bob Alice --> Bob: Swap response - note right: ACK or NACK\n Approx. XMR amount + note right: ACK or NACK\n Exact XMR amount end end @@ -47,7 +47,7 @@ group Execution Alice ->> Monero: Lock Alice -> Bob: Message5 - note right: Exact xmr amount\nzxmr lock tx transfer proof\nThis can be removed if Bob watches the blockchain. + note right: xmr lock tx transfer proof\nThis can be removed if Bob watches the blockchain. Bob -> Alice: Message6 note left: redeem tx enc sig S_a From eecee30d99fbb38781aeb88ec293b76dd321181b Mon Sep 17 00:00:00 2001 From: Franck Royer Date: Thu, 14 Jan 2021 10:46:50 +1100 Subject: [PATCH 4/4] Use exact xmr amount, Remove ACK - Use exact XMR amount - Remove ACK, this can be added as a feature once needed. --- docs/sequence.puml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sequence.puml b/docs/sequence.puml index fe6ada79..cbfd4979 100644 --- a/docs/sequence.puml +++ b/docs/sequence.puml @@ -14,7 +14,7 @@ group Negotiation note right: Alice stores peer id & address hints\nto contact Bob Alice --> Bob: Swap response - note right: ACK or NACK\n Exact XMR amount + note right: Exact XMR amount end end