|
18 | 18 |
|
19 | 19 | \tikzstyle{txSpendingLabel} = [rectangle, text width=5em, font=\scriptsize, text centered, rounded corners] |
20 | 20 |
|
| 21 | +% Sticky note style |
| 22 | +\tikzstyle{stickynote} = [rectangle, font=\tiny, text centered, rounded corners=2pt, fill=yellow!80, draw=orange!50, inner sep=3pt, drop shadow={opacity=0.3, shadow xshift=1pt, shadow yshift=-1pt}] |
| 23 | + |
21 | 24 |
|
22 | 25 | \newcommand\TxBox[5]{% |
23 | 26 | \node[rectangle] at ({#1},{#2}) (center) {}; |
|
29 | 32 | \node[txSpendingLabel, below=1em of center] (spendingLabel) {#4}; |
30 | 33 |
|
31 | 34 | %spending condition like a if condition |
32 | | - \node[{#5}, right=2.45em of spendingLabel] (spendingCondition){}; |
| 35 | + \node[{#5}, right=1.8em of spendingLabel] (spendingCondition){}; |
33 | 36 |
|
34 | 37 | \node[rectangle, draw, minimum height=1.5em, minimum width=6.3em, below=1em of center] (labelBox) {}; |
35 | 38 |
|
|
46 | 49 | \TxBox{#1}{#2}{#3}{#4}{IF} |
47 | 50 | } |
48 | 51 |
|
| 52 | +% Generic sticky note command |
| 53 | +% Usage: \StickyNote[width]{targetNode}{position}{uniqueLabel}{text} |
| 54 | +% Example: \StickyNote{txBox}{below=3em}{note1}{Alice locks Bitcoin} |
| 55 | +% Example with width: \StickyNote[10em]{txBox}{below=3em}{note1}{Alice locks Bitcoin} |
| 56 | +% Position examples: below=3em, right=2em, above left=1em and 2em |
| 57 | +% Default width: 6em |
| 58 | +\newcommand\StickyNote[5][6em]{% |
| 59 | + \node[stickynote, text width=#1, #3 of #2] (#4) {#5}; |
| 60 | + \draw[->, orange!70, thick] (#4) -- (#2); |
| 61 | +} |
| 62 | + |
49 | 63 |
|
50 | 64 | \begin{figure}[htb] |
51 | 65 | \centering |
52 | 66 | \begin{tikzpicture} |
53 | 67 | [-latex, |
54 | | - on grid=true |
| 68 | + on grid=true, |
| 69 | + scale=0.8, |
| 70 | + every node/.style={scale=0.8} |
55 | 71 | ] |
56 | 72 |
|
57 | | - \begin{scope}[name prefix = txfund-] |
58 | | - \TxBoxWithCondition{0}{-1.5}{$\lock{btc}$}{$a \land b$} |
59 | | - \end{scope} |
| 73 | + \begin{scope}[name prefix = txfund-] |
| 74 | + \TxBoxWithCondition{0}{-1.5}{$\lock{btc}$}{$a \land b$} |
| 75 | + \end{scope} |
60 | 76 |
|
61 | 77 | \begin{scope}[name prefix = txredeem-] |
62 | 78 | \TxBoxWithoutCondition{4}{0}{$\redeem$}{$\address{redeem}{A}$} |
63 | 79 | \end{scope} |
64 | 80 |
|
65 | | - \begin{scope}[name prefix = txcancel-] |
66 | | - \TxBoxWithCondition{4}{-3}{$\cancel$}{$a \land b$} |
67 | | - \end{scope} |
68 | | - |
69 | | - \begin{scope}[name prefix = txtake-] |
70 | | - \node[rectangle] at (8,-1.8) (center) {}; |
71 | | - \node[txLabel, above=1em of center] (nodeLabel) {$tx_{\textsf{partial refund}}^{\textsf{btc}}$}; |
72 | | - \node[rectangle, draw, minimum height=1.5em, minimum width=8.5em, below=1em of center] (firstBox) {}; |
73 | | - \node[font=\scriptsize, text centered, below=1em of center] (firstOutput) {$\address{refund}{B}~(90\%)$}; |
74 | | - \node[rectangle, draw, minimum height=1.5em, minimum width=8.5em, below=1.8em of firstOutput] (secondBox) {}; |
75 | | - \node[font=\scriptsize, text centered, below=1.8em of firstOutput] (secondOutput) {$a \land b~(10\%)$}; |
76 | | - \node[IF, right=3.2em of secondOutput] (spendingCondition) {}; |
77 | | - \node[rectangle, draw, rounded corners, minimum width=9.5em, fit=(nodeLabel)(firstBox)(secondBox)(spendingCondition)] (txBox) {}; |
78 | | - \end{scope} |
| 81 | + \begin{scope}[name prefix = txcancel-] |
| 82 | + \TxBoxWithCondition{5}{-3}{$\cancel$}{$a \land b$} |
| 83 | + \end{scope} |
| 84 | + |
| 85 | +\begin{scope}[name prefix = txrefundfull-] |
| 86 | + \TxBoxWithoutCondition{8}{1}{$tx_{\textsf{full refund}}^{\textsf{btc}}$}{$\address{refund}{B}$} |
| 87 | +\end{scope} |
| 88 | + |
| 89 | +\StickyNote[10em]{txrefundfull-txBox}{right=7.5em}{noteFullRefund}{Alice can (choose) to sign her part of this transaction and transmit the PSBT to Bob off-chain during any point before $\mathsf{btc\_partial\_refund}$ is published. Bob can then sign his part of the transaction and publish it to the network to claim a full refund. In comparison to ``partial refund + amnesty'', this saves fees but requires interactivity.} |
| 90 | + |
| 91 | + |
| 92 | +\begin{scope}[name prefix = txtake-] |
| 93 | + \node[rectangle] at (8.5,-1.5) (center) {}; |
| 94 | + \node[txLabel, above=1em of center] (nodeLabel) {$tx_{\textsf{partial refund}}^{\textsf{btc}}$}; |
| 95 | + \node[rectangle, draw, minimum height=1.5em, minimum width=8.5em, below=0.5em of center] (firstBox) {}; |
| 96 | + \node[font=\scriptsize, text centered, below=0.5em of center] (firstOutput) {$\address{refund}{B}~(90\%)$}; |
| 97 | + \node[rectangle, draw, minimum height=1.5em, minimum width=8.5em, below=1.5em of firstOutput] (secondBox) {}; |
| 98 | + \node[font=\scriptsize, text centered, below=1.5em of firstOutput] (secondOutput) {$a \land b~(10\%)$}; |
| 99 | + \node[IF, right=2.4em of secondOutput] (spendingCondition) {}; |
| 100 | + \node[rectangle, inner sep=0, minimum height=0, below=1em of secondBox] (bottomPadding) {}; |
| 101 | + \node[rectangle, draw, rounded corners, minimum width=9.5em, fit=(nodeLabel)(firstBox)(secondBox)(spendingCondition)(bottomPadding)] (txBox) {}; |
| 102 | +\end{scope} |
79 | 103 |
|
80 | 104 | \begin{scope}[name prefix = txamnesty-] |
81 | | - \TxBoxWithoutCondition{11.5}{-2.7}{$tx_{\textsf{refund amnesty}}^{\textsf{btc}}$}{$\address{refund}{B}$} |
| 105 | + \node[rectangle] at (12,-3) (center) {}; |
| 106 | + \node[rectangle, text width=7em, text centered, rounded corners, minimum height=2em, minimum width=8em, above=1em of center] (nodeLabel) {$tx_{\textsf{refund amnesty}}^{\textsf{btc}}$}; |
| 107 | + \node[txSpendingLabel, below=1em of center] (spendingLabel) {$\address{refund}{B}$}; |
| 108 | + \node[rectangle, draw, minimum height=1.5em, minimum width=8em, below=1em of center] (labelBox) {}; |
| 109 | + \node[rectangle, draw, rounded corners, minimum height=5em, minimum width=8.5em, below=-0.em of center] (txBox) {}; |
82 | 110 | \end{scope} |
| 111 | + |
| 112 | + \StickyNote[10em]{txamnesty-txBox}{below=6em}{noteAmnesty}{If Bob has done a partial refund, Alice can (choose) to publish this transaction to allow him a full refund. Bob signs this part of the transaction during the negotiation phase. Alice can publish this non-interactively.} |
83 | 113 |
|
84 | 114 | \begin{scope}[name prefix = txpunish-] |
85 | | - \TxBoxWithoutCondition{8}{-4}{$\punish$}{$\address{punish}{A}$} |
| 115 | + \TxBoxWithoutCondition{8}{-4.5}{$\punish$}{$\address{punish}{A}$} |
86 | 116 | \end{scope} |
87 | 117 |
|
88 | 118 | \draw [line] (txfund-spendingCondition.north) |- (txredeem-txBox.west) |
|
92 | 122 | node [labelAbove_small, font=\scriptsize] {$\checkRelative{t_1}$} |
93 | 123 | node [labelBelow_small, font=\scriptsize]{$\A, \B$}; |
94 | 124 |
|
| 125 | + \draw [line] (txcancel-spendingCondition.north) |- (txrefundfull-txBox.west) |
| 126 | + node [labelBelow_small, font=\scriptsize]{$\A, \B$}; |
| 127 | + |
95 | 128 | \draw [line] (txcancel-spendingCondition.north) |- (txtake-txBox.west) |
96 | | - node [labelBelow_small, font=\scriptsize]{$\A, \B$}; |
| 129 | + node [labelBelow_small, font=\scriptsize]{$\A, \B$}; |
97 | 130 |
|
98 | | - \draw [line] (txtake-spendingCondition) -- (txamnesty-txBox.west) |
99 | | - node [labelBelow_small, font=\scriptsize]{$\A, \B$}; |
| 131 | + \draw [line] (txtake-spendingCondition) |- (txamnesty-txBox.west) |
| 132 | + node [labelBelow_small, font=\scriptsize]{$\A, \B$}; |
100 | 133 |
|
101 | 134 | \draw [line] (txcancel-spendingCondition.south) |- (txpunish-txBox.west) |
102 | 135 | node [labelAbove_small, font=\scriptsize] {$\checkRelative{t_2}$} |
103 | 136 | node [labelBelow_small, font=\scriptsize]{$\A, \B$}; |
104 | 137 |
|
105 | | - \draw [-,dotted] (-1,-5) -- (9,-5); |
| 138 | + \draw [-,dotted] (-1,-6) -- (9,-6); |
106 | 139 |
|
107 | 140 |
|
108 | 141 | \begin{scope}[name prefix = xmr-lock-] |
109 | | - \TxBoxWithCondition{0}{-6.5}{$\lock{xmr}$}{$\Spend{a}{} + \Spend{b}{}$} |
| 142 | + \TxBoxWithCondition{0}{-7.5}{$\lock{xmr}$}{$\Spend{a}{} + \Spend{b}{}$} |
110 | 143 | \end{scope} |
111 | 144 |
|
112 | 145 | \begin{scope}[name prefix = xmr-redeem-] |
113 | | - \TxBoxWithoutCondition{4}{-6.5}{$tx_{\textsf{redeem}}^{\textsf{xmr}}$}{$\textsf{Bob}$} |
| 146 | + \TxBoxWithoutCondition{4}{-7.5}{$tx_{\textsf{redeem}}^{\textsf{xmr}}$}{$\textsf{Bob}$} |
114 | 147 | \end{scope} |
115 | 148 |
|
116 | 149 | \begin{scope}[name prefix = xmr-cancel-] |
117 | | - \TxBoxWithoutCondition{4}{-8.5}{$tx_{\textsf{refund}}^{\textsf{xmr}}$}{$\textsf{Alice}$} |
| 150 | + \TxBoxWithoutCondition{4}{-9.5}{$tx_{\textsf{refund}}^{\textsf{xmr}}$}{$\textsf{Alice}$} |
118 | 151 | \end{scope} |
119 | 152 |
|
120 | 153 | \draw [dotted] (xmr-lock-spendingCondition.north) |- (xmr-redeem-txBox.west) |
|
0 commit comments