Skip to content

Commit f3b7588

Browse files
committed
add new proposed partial refund bitcoin transactions to schema
1 parent 2c6a778 commit f3b7588

File tree

1 file changed

+61
-28
lines changed

1 file changed

+61
-28
lines changed

schemas/old_tranasction_schem.tex

Lines changed: 61 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818

1919
\tikzstyle{txSpendingLabel} = [rectangle, text width=5em, font=\scriptsize, text centered, rounded corners]
2020

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+
2124

2225
\newcommand\TxBox[5]{%
2326
\node[rectangle] at ({#1},{#2}) (center) {};
@@ -29,7 +32,7 @@
2932
\node[txSpendingLabel, below=1em of center] (spendingLabel) {#4};
3033

3134
%spending condition like a if condition
32-
\node[{#5}, right=2.45em of spendingLabel] (spendingCondition){};
35+
\node[{#5}, right=1.8em of spendingLabel] (spendingCondition){};
3336

3437
\node[rectangle, draw, minimum height=1.5em, minimum width=6.3em, below=1em of center] (labelBox) {};
3538

@@ -46,43 +49,70 @@
4649
\TxBox{#1}{#2}{#3}{#4}{IF}
4750
}
4851

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+
4963

5064
\begin{figure}[htb]
5165
\centering
5266
\begin{tikzpicture}
5367
[-latex,
54-
on grid=true
68+
on grid=true,
69+
scale=0.8,
70+
every node/.style={scale=0.8}
5571
]
5672

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}
6076

6177
\begin{scope}[name prefix = txredeem-]
6278
\TxBoxWithoutCondition{4}{0}{$\redeem$}{$\address{redeem}{A}$}
6379
\end{scope}
6480

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}
79103

80104
\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) {};
82110
\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.}
83113

84114
\begin{scope}[name prefix = txpunish-]
85-
\TxBoxWithoutCondition{8}{-4}{$\punish$}{$\address{punish}{A}$}
115+
\TxBoxWithoutCondition{8}{-4.5}{$\punish$}{$\address{punish}{A}$}
86116
\end{scope}
87117

88118
\draw [line] (txfund-spendingCondition.north) |- (txredeem-txBox.west)
@@ -92,29 +122,32 @@
92122
node [labelAbove_small, font=\scriptsize] {$\checkRelative{t_1}$}
93123
node [labelBelow_small, font=\scriptsize]{$\A, \B$};
94124

125+
\draw [line] (txcancel-spendingCondition.north) |- (txrefundfull-txBox.west)
126+
node [labelBelow_small, font=\scriptsize]{$\A, \B$};
127+
95128
\draw [line] (txcancel-spendingCondition.north) |- (txtake-txBox.west)
96-
node [labelBelow_small, font=\scriptsize]{$\A, \B$};
129+
node [labelBelow_small, font=\scriptsize]{$\A, \B$};
97130

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$};
100133

101134
\draw [line] (txcancel-spendingCondition.south) |- (txpunish-txBox.west)
102135
node [labelAbove_small, font=\scriptsize] {$\checkRelative{t_2}$}
103136
node [labelBelow_small, font=\scriptsize]{$\A, \B$};
104137

105-
\draw [-,dotted] (-1,-5) -- (9,-5);
138+
\draw [-,dotted] (-1,-6) -- (9,-6);
106139

107140

108141
\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}{}$}
110143
\end{scope}
111144

112145
\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}$}
114147
\end{scope}
115148

116149
\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}$}
118151
\end{scope}
119152

120153
\draw [dotted] (xmr-lock-spendingCondition.north) |- (xmr-redeem-txBox.west)

0 commit comments

Comments
 (0)