Swimlanes.io is a free webapp for making sequence diagrams. You simply edit the text on the left and the diagram is updated in real time. You can download your sequence diagrams as images or distribute with a link.
Title: Paymail SPV notes: Given **person\@company.com** a paymail client runs service discovery steps: ...: group: **Service Discovery** group: Host discovery Client -> DNS: SRV _bsvalias._tcp.company.com Client <-- DNS: note: 10 10 443 lookup company.com. Client -> DNS: DNSSEC company.com Client <-- DNS: note: pubkey, delegated signer etc. Client -> DNS: A company.com Client <-- DNS: some host IP address 123.45.67.89 end group: Capability discovery Client -> Paymail Server: GET /.well-known/bsvalias Client <-- Paymail Server: 200 note DNS,Paymail Server:``` [escape-left-curley-bracket] bsvalias: "1.0", capabilities: [escape-left-curley-bracket] "2a40af698840": "https://company.com/api/dest/[escape-left-curley-bracket]alias}@[escape-left-curley-bracket]domain.tld}", "5c55a7fdb7bb": "https://company.com/api/beef" } }``` end end notes: Service Discovery is complete. Now we can ask the counterparty for outputs using the 2a40af698840 endpoint, and send a BEEF Tx which pays to those outputs to the 5c55a7fdb7bb endpoint. ...: group: Destinations 2a40af698840 Client -> Paymail Server: POST /api/dest/person@company.com note Client,DNS: ``` { satoshis: 1000 }``` Client <-- Paymail Server: 200 ok note DNS, Paymail Server: ``` { reference: "5vQ8YwiCAwqFNG", outputs: [ { script: "76a9140452933c70d21dbae26af40b0ceec4566fc2386f88ac", satoshis: 1000 } ] }``` end note all:Now the Client has the required information to create a transaction which pays out to the script in the response and the appropriate amount. A Tx is constructed by the Client, signed, and then it is sent to the 5c55a7fdb7bb endpoint for validation by the receiving party. ...: group: Receive BEEF Tx 5c55a7fdb7bb Client -> Paymail Server: POST /api/beef note Client,DNS: ``` [escape-left-curley-bracket] reference: "5vQ8YwiCAwqFNG", beef: "010000", metadata: [escape-left-curley-bracket] sender: "sender@paymail.co", pubkey: "03d75b6c308a12831e8a458d0f211e775abb1a121d627f2307083e807a1e734f43", signature: "<base64_encoded_compact_signature_over_txid>", note: "payment for something" } } ``` group: Transaction Validation note all: Paymail Server checks: 1. Script evaluation of each unlocking script results in TRUE. 2. The sum of the satoshis-in must be greater than the sum of the satoshis-out. 3. Each input must be associated with a Merkle path to a block. 4. nLocktime, and nSequence of each input are set to the expected values. Details: https://brc.dev/67 This implementation also checks things like transaction formatting and sender signature and that the reference id is associated with a previous request. If validation passes we broadcast the tx and respond to the client, usually within a matter of seconds. end ...: Client <-- Paymail Server: 200 note DNS,Paymail Server: ``` { txid: "e784135592ec07c2dc90662c559c5a98c04211e1eff86629a16b3560b8ab5a44", note: "thanks" }``` end