digraph paymentchannel {
size=6.66;
rankdir=LR;
//splines = false;
nodesep = 0.1;

edge [ fontname="Sans", minlen = 4 ];
node [ fontname="Sans", style = invis, shape = box ];
graph [ fontname="Sans" ]



subgraph cluster_alice {
    label = "Alice's Computer\n(Server)"
    rank = same;
    //atx2v1;
    atx2v1s;
    atx1v2 [ label = "Bond\n(2-of-2\nmultisig)", style = unfilled, bgcolor = grey ];

    //atx2v2;
    atx2v3 [ label = " \n \n "];
    atx2v4;
    atx2v5 [ label = "Refund v45\nBob: 66\n Alice: 44\n(No Lock)", style = unfilled, bgcolor = grey ];

}

subgraph cluster_bob {
    label = "Bob's Computer\n(Client)"
    rank = same;
    btx2v1 [ label = "Refund v1\nBob: 100\nAlice: 0\n(Locktime)", style = unfilled, bgcolor = grey ];
    //btx2v1s;
    btx1v2 [label = " \n \n \n "];

    btx2v2s;
    btx2v3;
    btx2v4 [ label = " \n \n \n "];
    btx2v5;
}

btx2v1 -> atx2v1s [ label = "B: Please sign refund version 1,\nwhich is a full refund of the bond\nthat can't be spent for 24 hours" ];
atx2v1s -> btx1v2 [ style = dashed, label = "A: Signed; please send me the bond to\nprove you funded the account" ];
btx1v2 -> atx1v2 [ label = "B: Here's the bond; please start working" ];
atx1v2 -> btx2v2s [ style = dashed, label = "A: Some work done; please sign refund v2\nreducing your refund by 1 mBTC" ];
btx2v2s -> atx2v3 [ label = "B: Signed; refund now pays Bob: 99; Alice: 1" ];
atx2v3 -> btx2v3 [ style = dashed, label = "A: More work done; please sign v3\nreducing your refund by another 1 mBTC" ];
btx2v3 -> atx2v4 [ label = "B: Signed; refund now pays Bob: 98; Alice: 2" ];
atx2v4 -> btx2v4 [ style = dashed, label = "A: [...]" ];
btx2v4 -> atx2v5 [ label = "B: [...]" ];

atx2v5 -> btx2v5 [ style = dashed, label = "A: I'm done for the day.  I'm\ngoing to broadcast refund v45" ];


label = " \n \nAlice broadcasts the bond to the Bitcoin network immediately.\nShe broadcasts the final version of the refund when she finishes work\nor before the locktime.  If she fails to broadcast before refund v1's time lock\nexpires, Bob can broadcast refund v1 to get a full refund.\n \nBitcoin Micropayment Channels (As Implemented In Bitcoinj)"
}
