xmr-btc-swap/docs/sequence.puml

65 lines
1.5 KiB
Plaintext

@startuml
database Bitcoin
actor Bob as "Bob (User)"
Actor Alice as "Alice (Service Provider)"
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: Exact XMR amount
end
end
group Execution Setup
group Phase A [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
end
group Phase B [Messages must be exchanged in the given order]
Bob -> Alice: Message1
note left: unsigned btc lock tx
Alice -> Bob: Message2
note right: btc cancel tx sig\nbtc refund tx enc sig S_b
Bob -> Alice: Message3
note left: btc punish tx sig\nbtc cancel tx sig
end
end
group Execution
Bob ->> Bitcoin: Lock
Alice ->> Monero: Lock
Alice -> Bob: Message4
note right: xmr lock tx transfer proof\nThis can be removed if Bob watches the blockchain.
Bob -> Alice: Message5
note left: redeem tx enc sig S_a
Alice ->> Bitcoin: Redeem
Bitcoin ->> Bob: Signature
Bob -> Bob: Extract s_a
Bob ->> Monero: Redeem
end
@enduml