xmr-btc-swap/docs/sequence.puml
2021-01-14 10:28:46 +11:00

65 lines
1.5 KiB
Plaintext

@startuml
database Bitcoin
actor Bob
Actor Alice
database Monero
group Negotiation
Bob --> Alice: Establish connection
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 Execution Setup
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: Message1
note right: Pubkeys\ndleq proof s_a\nxmr view key v_a\nbtc redeem addr\nbtc punish addr
end
group Phase B [Messages must be exchanged in the given order]
Bob -> Alice: Message2
note left: unsigned btc lock tx
Alice -> Bob: Message3
note right: btc cancel tx sig\nbtc refund tx enc sig S_b
Bob -> Alice: Message4
note left: btc punish tx sig\nbtc cancel tx sig
end
end
group Execution
Bob ->> Bitcoin: Lock
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.
Bob -> Alice: Message6
note left: redeem tx enc sig S_a
Alice ->> Bitcoin: Redeem
Bitcoin ->> Bob: Signature
Bob -> Bob: Extract s_a
Bob ->> Monero: Redeem
end
@enduml