commit 805094f16d0b10ce03c6bbd225d269e7348f79eb
parent f8e660fa3915e3b7f4320dda808db582d20e6de6
Author: Antoine A <>
Date: Mon, 14 Feb 2022 17:16:29 +0100
presentation: progress
Diffstat:
4 files changed, 138 insertions(+), 160 deletions(-)
diff --git a/Cargo.lock b/Cargo.lock
@@ -341,9 +341,9 @@ checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7"
[[package]]
name = "crypto-common"
-version = "0.1.1"
+version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "683d6b536309245c849479fba3da410962a43ed8e51c26b729208ec0ac2798d0"
+checksum = "a4600d695eb3f6ce1cd44e6e291adceb2cc3ab12f20a33777ecd0bf6eba34e06"
dependencies = [
"generic-array",
]
@@ -440,13 +440,12 @@ dependencies = [
[[package]]
name = "digest"
-version = "0.10.1"
+version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b697d66081d42af4fba142d56918a3cb21dc8eb63372c6b85d14f44fb9c5979b"
+checksum = "8cb780dce4f9a8f5c087362b3a4595936b2019e7c8b30f2c3e9a7e94e6ae9837"
dependencies = [
"block-buffer",
"crypto-common",
- "generic-array",
"subtle",
]
@@ -772,9 +771,9 @@ checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421"
[[package]]
name = "hyper"
-version = "0.14.16"
+version = "0.14.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b7ec3e62bdc98a2f0393a5048e4c30ef659440ea6e0e572965103e72bd836f55"
+checksum = "043f0e083e9901b6cc658a77d1eb86f4fc650bbb977a4337dd63192826aa85dd"
dependencies = [
"bytes",
"futures-channel",
@@ -784,7 +783,7 @@ dependencies = [
"http-body",
"httparse",
"httpdate",
- "itoa 0.4.8",
+ "itoa 1.0.1",
"pin-project-lite",
"socket2",
"tokio",
@@ -975,9 +974,9 @@ dependencies = [
[[package]]
name = "ntapi"
-version = "0.3.6"
+version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3f6bb902e437b6d86e03cce10a7e2af662292c5dfef23b65899ea3ac9354ad44"
+checksum = "c28774a7fd2fbb4f0babd8237ce554b73af68021b5f695a3cebd6c59bac0980f"
dependencies = [
"winapi",
]
@@ -1247,14 +1246,13 @@ dependencies = [
[[package]]
name = "rand"
-version = "0.8.4"
+version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8"
+checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
dependencies = [
"libc",
"rand_chacha",
"rand_core",
- "rand_hc",
]
[[package]]
@@ -1277,15 +1275,6 @@ dependencies = [
]
[[package]]
-name = "rand_hc"
-version = "0.3.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d51e9f596de227fda2ea6c84607f5558e196eeaf43c986b724ba4fb8fdf497e7"
-dependencies = [
- "rand_core",
-]
-
-[[package]]
name = "rayon"
version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1451,9 +1440,9 @@ dependencies = [
[[package]]
name = "serde_json"
-version = "1.0.78"
+version = "1.0.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d23c1ba4cf0efd44be32017709280b32d1cea5c3f1275c3b6d9e8bc54f758085"
+checksum = "8e8d9fa5c3b304765ce1fd9c4c8a3de2c8db365a5b91be52f186efc675681d95"
dependencies = [
"itoa 1.0.1",
"ryu",
diff --git a/docs/media/fee.png b/docs/media/fee.png
Binary files differ.
diff --git a/docs/media/fee_var.png b/docs/media/fee_var.png
Binary files differ.
diff --git a/docs/presentation.tex b/docs/presentation.tex
@@ -85,13 +85,14 @@
\column{0.47\paperwidth}
\begin{block}{Settlement layer}
\begin{itemize}
- \item Blockchain?
+ \item This work, Blockchain!
\end{itemize}
\end{block}
\begin{block}{Taler payment system}
\begin{itemize}
+ \item Realtime transactions, 1 RTT
+ \item Scalable microtransactions
\item Blind signatures (privacy)
- \item Rotate keys every year, forget previous transactions (pruning)
\end{itemize}
\end{block}
@@ -101,7 +102,7 @@
\begin{frame}{Taler}{Blockchain settlement layer}
\begin{center}
\begin{tikzpicture}[
- rect/.style={rectangle, draw=black, minimum width=28mm},
+ rect/.style={rectangle, draw=black, minimum width=30mm},
sym/.style={stealth-stealth, shorten >= 2pt, shorten <= 2pt},
block/.style={rectangle,draw=black,fill=black!10,minimum size=7mm},
]
@@ -111,7 +112,7 @@
\node[rect,below=0cm of Tt](Tc){Exchange};
\node[rect,fit={(Tt) (Tc)}](T){};
- \node[rect,below=7mm of Tc](D) {Depolymerization};
+ \node[rect,below=7mm of Tc](D) {\textbf{Depolymerization}};
\node[rect,below=7mm of D](Bc){Node};
\node[below=0cm of Bc](Bt){Blockchain};
@@ -143,7 +144,7 @@
\node[above=-0.5mm of off] {\includegraphics[height=7mm]{media/taler.png}};
%% Depolymerization
- \node[right=12mm of D] {\small{Deposit}};
+ \node[right=11mm of D] {\small{Deposit}};
\node[right=50mm of D] {\small{Withdraw}};
\draw[dashed,-stealth] (1.north) |- (off.west);
\draw[dashed,-stealth] (off.east) -| (6.north);
@@ -156,20 +157,17 @@
\begin{itemize}
\item Metadata are required to link a wallet to its deposits and withdraws
\item Putting metadata in blockchain transactions can be tricky
- \item The whole on-chain transaction history can be retrieved from
- the blockchain. \textbf{Easily auditable}
\end{itemize}
\end{block}
\begin{block}{Blockchain based cryptocurrencies}
\begin{itemize}
- \item Reorganisation resilient
- \item Adaptive confirmation
- \item Resolve stuck transactions
+ \item Blockchain transactions lack finality (fork)
+ \item Transactions can be stuck for a long time (mempool)
\end{itemize}
\end{block}
\end{frame}
-\begin{frame}{Challenges}{Chain reorganisation}
+\begin{frame}{Blockchain challenges}{Chain reorganisation}
\begin{center}
\begin{tikzpicture}[
block/.style={rectangle,draw=black,fill=black!10,minimum size=7mm},
@@ -207,34 +205,36 @@
\end{center}
A fork is when concurrent blockchain states coexist. Nodes will follow
the longest chain, replacing recent blocks if necessary. That is a
- blockchain reorganisation. Taler expects deposit transactions to be
- consistent. If a deposit transaction disappears from the blockchain,
- depolymerizer is comprised.
+ blockchain reorganisation. If a deposit transaction disappears from the
+ blockchain, an irrevocable withdraw transactions would no longer be backed
+ by credit.
\end{frame}
-\begin{frame}{Challenges}{Stuck transactions}
- \begin{center}
- \begin{tikzpicture}[
- dot/.style={circle,fill,inner sep=1pt,}
- ]
-
- % TODO caption with source (Ychart)
-
- \node (I) {\includegraphics[width=\textwidth]{media/fee.png}};
- \only<2->{
+\begin{frame}{Blockchain challenges}{Stuck transactions}
+ We want confirmed debits within a limited time frame.
+ \begin{figure}
+ \centering
+ \only<1> {
+ \begin{tikzpicture}[
+ dot/.style={circle,fill,inner sep=1pt,}
+ ]
+ \node (I) {\includegraphics[width=\textwidth]{media/fee.png}};
\node [below left=-2.5mm and -1.5cm of I] (Tx) {\small Tx};
\node [dot,above=8.4mm of Tx](D) {};
\draw [dotted,thick] (Tx) -- (D);
\node [left=-4.5cm of Tx] (C) {\small conf};
\node [dot,above=8.4mm of C](D1) {};
\draw [dotted,thick] (C) -- (D1);
- };
- \end{tikzpicture}
- \end{center}
- \only<1>{We want confirmation of transactions within a limited time frame.
- However, transaction fees are variable, and we can only predict them.}
- \only<2>{When we send a transaction with a fee too small compared to other
- transactions, it can take an unlimited amount of time for it to be mined.}
+ \end{tikzpicture}
+ }
+ \only<2> {
+ \includegraphics[width=\textwidth]{media/fee_var.png}
+ \caption{Bitcoin average transaction fee over 6 months {\tiny (ychart)}}
+ }
+ \end{figure}
+ \only<1>{When we trigger a debit with a fee too small, it may no be
+ confirmed in timely fashion.}
+ \only<2>{However, transaction fees are unpredictable.}
\end{frame}
@@ -247,7 +247,7 @@
\node[rect](1) {Taler Exchange};
\node[rect,below=of 1](2) {Wire Gateway};
\node[rect,right=of 2](3) {PostgreSQL};
- \node[rect,right=of 3](4) {DLT Wire};
+ \node[rect,right=of 3](4) {DLT Adapter};
\node[rect,above=of 4](5) {DLT Full Node};
\draw[sym] (1) -- node [midway,right] {\tiny HTTP} (2);
@@ -266,77 +266,46 @@
\item Common database to store transactions state and communicate
with notifications
\item Wire Gateway for Taler API compatibility
- \item Specific wire for DLT compatibility
+ \item DLT specific adapter
\end{itemize}
\end{frame}
-\begin{frame}{Depolymerization}{Metadata}
- \begin{block}{Bitcoin - Withdraw}
+\begin{frame}{Storing metadata}{Bitcoin}
+ \begin{block}{Bitcoin - Credit}
\begin{itemize}
\item Transactions from code
\item Only 32B + URI
\item \textbf{OP\_RETURN}
\end{itemize}
\end{block}
- \begin{block}{Bitcoin - Deposit}
+ \begin{block}{Bitcoin - Debit}
\begin{itemize}
\item Transactions from common wallet software
\item Only 32B
\item \textbf{Fake Segwit Addresses}
\end{itemize}
\end{block}
- \begin{block}{Ethereum - Withdraw and Deposit}
+\end{frame}
+\begin{frame}{Storing metadata}{Ethereum}
+ \begin{block}{Smart contract ?}
\begin{itemize}
- \item Smart contract is the recommend way
- \item Expensive and error prone (bigger attack surface)
- \item \textbf{Custom contract input format}
+ \item Logs in smart contract is the recommend way {\tiny (ethereum.org)}
+ \item Expensive (additional storage and execution fees)
+ \item Avoidable attack surface (error prone)
\end{itemize}
\end{block}
+ \begin{block}{Custom input format}
+ Use input data in transactions usually to call smart contract to
+ store metadata.
+ \end{block}
\end{frame}
-\begin{frame}{Depolymerization}{Architecture}
- \begin{center}
- \begin{tikzpicture}[
- rect/.style={rectangle, draw=black, minimum height=6mm, minimum width=38mm},
- ]
-
- % Watcher loop
- \node(wat) {Watcher};
- \node[rect, below=1mm of wat](wa1) {Wait for new block};
- \node[rect, below=4mm of wa1](wa2) {Notify new block};
- \draw[-stealth] (wa1) -- (wa2);
- \draw[-stealth] (wa2) .. controls ([xshift=-0.3cm] wa2.west) and ([xshift=-0.3cm] wa1.west) .. (wa1);
-
- % Analysis loop
- \node[below=7mm of wa2] (at) {Analysis};
- \node[rect, below=1mm of at](a1) {Wait for notification};
- \node[rect, below=4mm of a1](a2) {Analyse};
- \draw[-stealth] (a1) -- (a2);
- \draw[-stealth] (a2) .. controls ([xshift=-0.3cm] a2.west) and ([xshift=-0.3cm] a1.west) .. (a1);
-
- % Worker loop
- \node[rect, right= 1cm of wa1](wo1) {Wait for notification};
- \node[rect, below=4mm of wo1](wo2) {Synchronize chain};
- \node[rect, below=4mm of wo2](wo3) {Withdraw};
- \node[rect, below=4mm of wo3](wo4) {Bump};
- \node[rect, below=4mm of wo4](wo5) {Bounce};
- \node[above=1mm of wo1]{Worker};
- \draw[-stealth] (wo1) -- (wo2);
- \draw[-stealth] (wo2) -- (wo3);
- \draw[-stealth] (wo3) -- (wo4);
- \draw[-stealth] (wo4) -- (wo5);
- \draw[-stealth] (wo5) .. controls ([xshift=-0.4cm] wo5.west) and ([xshift=-0.4cm] wo1.west) .. (wo1);
- \end{tikzpicture}
- \end{center}
- \centering
- Three concurrent loops
-\end{frame}
-
-\begin{frame}{Reorganisation resilient}
+\begin{frame}{Handling blockchain reorganisation}
\begin{center}
\begin{tikzpicture}[
block/.style={rectangle,draw=black,fill=black!10,minimum size=7mm},
conf/.style={draw=black!60!green,fill=black!60!green!10},
+ nconf/.style={dotted},
err/.style={draw=black!60!red,fill=black!60!red!10},
ar/.style={-stealth}
]
@@ -354,22 +323,22 @@
\only<2->{
\node [block,conf,right=5mm of 3](4){\only<3>{$D_3$}};
}
- \node[block,right=5mm of 4](5){};
- \node[block,right=5mm of 5](6){$D_1$};
+ \node[block,nconf,right=5mm of 4](5){};
+ \node[block,nconf,right=5mm of 5](6){$D_1$};
\draw[ar] (3) -- (4);
\draw[ar] (4) -- (5);
\draw[ar] (5) -- (6);
% Fork
\only<-2>{
- \node [block,above=7mm of 4](4p){};
+ \node [block,nconf,above=7mm of 4](4p){};
}
\only<3>{
- \node [block,err,above=7mm of 4](4p){$D_3'$};
+ \node [block,dashed,err,above=7mm of 4](4p){$D_3'$};
}
- \node[block,right=5mm of 4p](5p){$D_2$};
- \node[block,right=5mm of 5p](6p){};
- \node[block,right=5mm of 6p](7p){};
+ \node[block,nconf,right=5mm of 4p](5p){$D_2$};
+ \node[block,nconf,right=5mm of 5p](6p){};
+ \node[block,nconf,right=5mm of 6p](7p){};
\draw[ar] (3.east) -- (4p.west);
\draw[ar] (4p) -- (5p);
\draw[ar] (5p) -- (6p);
@@ -380,13 +349,14 @@
\node [right=17mm of 6]{\emph{active}};
\end{tikzpicture}
\end{center}
- \only<1>{As small reorganisations are common, we apply a confirmation delay
- to handle most disturbances and attacks.}
+ \only<1>{As small reorganisations are common, Satoshi already recommend to
+ apply a confirmation delay to handle most disturbances and attacks.}
\only<2>{If a reorganisation longer than the confirmation delay happens,
- but it does not remove deposits, btc-wire is safe.}
- \only<3>{If it removed a confirmed deposit a powerful attacker may have
- created a conflicting transaction. btc-wire suspends operation until
- lost deposits reappear.}
+ but it did not remove credits, depolymerizer is safe and automatically
+ resume.}
+ \only<3>{If a fork removed a confirmed debit an attacker may create a
+ conflicting transaction. Depolymerizer suspends operation until lost
+ credits reappear.}
\end{frame}
\begin{frame}{Adaptive confirmation}
@@ -394,6 +364,7 @@
\begin{tikzpicture}[
block/.style={rectangle,draw=black,fill=black!10,minimum size=7mm},
conf/.style={draw=black!60!green,fill=black!60!green!10},
+ nconf/.style={dotted},
conft/.style={text=black!60!green},
confl/.style={draw=black!60!green},
ar/.style={-stealth}
@@ -407,20 +378,20 @@
% Current
\node[block,conf,right=5mm of 2](3){};
- \node[block,right=5mm of 3](4){};
- \node[block,right=5mm of 4](5){};
- \node[block,right=5mm of 5](6){};
+ \node[block,nconf,right=5mm of 3](4){};
+ \node[block,nconf,right=5mm of 4](5){};
+ \node[block,nconf,right=5mm of 5](6){};
\draw[ar] (2) -- (3);
\draw[ar] (3) -- (4);
\draw[ar] (4) -- (5);
\draw[ar] (5) -- (6);
% Fork
- \node[block,above=7mm of 3](3p){};
- \node[block,right=5mm of 3p](4p){};
- \node[block,right=5mm of 4p](5p){};
- \node[block,right=5mm of 5p](6p){};
- \node[block,right=5mm of 6p](7p){};
+ \node[block,nconf,above=7mm of 3](3p){};
+ \node[block,nconf,right=5mm of 3p](4p){};
+ \node[block,nconf,right=5mm of 4p](5p){};
+ \node[block,nconf,right=5mm of 5p](6p){};
+ \node[block,nconf,right=5mm of 6p](7p){};
\draw[ar] (2.east) -- (3p.west);
\draw[ar] (3p) -- (4p);
\draw[ar] (4p) -- (5p);
@@ -443,47 +414,56 @@
\draw[confl,thick,dotted](I) -- (Ip);
\end{tikzpicture}
\end{center}
- If we experience a reorganisation once, its plausible for another one of the
- same size to happen again. btc-wire learns from reorganisations by updating
- its confirmation time.
+ If we experience a reorganisation once, its dangerously likely for another
+ one of the same size to happen again. btc-wire learns from reorganisations
+ by increasing its confirmation time.
\end{frame}
-\begin{frame}{Handle stuck transactions}
- \begin{center}
- \begin{tikzpicture}[
- dot/.style={circle,fill,inner sep=1pt,}
- ]
- % TODO caption with source (Ychart)
- \node (I) {\includegraphics[width=\textwidth]{media/fee.png}};
- \node [below left=-2.5mm and -1.5cm of I] (Tx) {\small Tx};
- \node [dot,above=8.4mm of Tx](D) {};
- \draw [dotted,thick] (Tx) -- (D);
-
- \only<1>{
- \node [left=-4.5cm of Tx] (C) {\small conf};
- \node [dot,above=8.4mm of C](D1) {};
- \draw [dotted,thick] (C) -- (D1);
- };
- \only<2>{
- \node [left=-17mm of Tx] (Tx1) {\small Tx'};
- \node [dot,above=15.5mm of Tx1](D1) {};
- \draw [dotted,thick] (Tx1) -- (D1);
-
- \node [left=-14.3mm of Tx1] (C) {\small conf};
- \node [dot,above=15.5mm of C](D2) {};
- \draw [dotted,thick] (C) -- (D2);
- };
- \end{tikzpicture}
- \end{center}
- \only<1>{When we send a transaction with a fee too small compared to other
- transactions, it can take an unlimited amount of time for it to be mined.}
- \only<2>{You can configure btc-wire to monitor pending transactions and
- bump their fees if they take too much time to be mined.}
+\begin{frame}{DLT Adapter}{Architecture}
+ \begin{block}{Event system}
+ \begin{itemize}
+ \item \textbf{Watcher} listen for new blocks
+ \item \textbf{Wire Gateway} notify requested debits
+ \item \textbf{Worker} notify state change
+ \end{itemize}
+ \end{block}
\end{frame}
+\begin{frame}{DLT Adapter state machine}
+ \begin{columns}
+ \column{0.5\paperwidth}
+ \begin{figure}
+ \begin{tikzpicture}[
+ rect/.style={rectangle, draw=black, minimum height=6mm, minimum width=50mm},
+ ]
+
+ \node[rect](wo1) {Wait for notification};
+ \node[rect, below=4mm of wo1](wo2) {Reconcile local DB with DLT};
+ \node[rect, below=4mm of wo2](wo3) {Trigger debits};
+ \node[rect, below=4mm of wo3](wo4) {Reissue stuck debits};
+ \node[rect, below=4mm of wo4](wo5) {Bounce malformed credits};
+ \draw[-stealth] (wo1) -- (wo2);
+ \draw[-stealth] (wo2) -- (wo3);
+ \draw[-stealth] (wo3) -- (wo4);
+ \draw[-stealth] (wo4) -- (wo5);
+ \draw[-stealth] (wo5) .. controls ([xshift=-0.4cm] wo5.west) and ([xshift=-0.4cm] wo1.west) .. (wo1);
+ \end{tikzpicture}
+ \caption{Worker loop}
+ \end{figure}
+ \column{0.47\paperwidth}
+ \begin{block}{DLT reconcialisation}
+ \begin{itemize}
+ \item List new and removed transactions since last reconciliation
+ \item Check for confirmed deposits removal
+ \item Register new credits
+ \item Recover lost debits
+ \end{itemize}
+ \end{block}
+ \end{columns}
+\end{frame}
\begin{frame}{Related work}
\begin{block}{Centralization - Coinbase off-chain sending}
@@ -495,13 +475,15 @@
\begin{block}{Layering - Lightning Network}
\begin{itemize}
\item [$+$] Fast and cheap: off chain transaction
- \item [$-$] Incompatible with Bitcoin: require setting up a Bidirectional Payment Channel
+ \item [$-$] Incompatible with Bitcoin: require setting up a bidirectional payment channel
\item [$-$] Fraud attempts are mitigated via a complex penalty system
\end{itemize}
\end{block}
\end{frame}
\begin{frame}{Conclusion}
+ Blockchain can be used a settlement layer for Taler payment system using
+ depolymerizer.
\begin{itemize}
\item [$-$] Trust exchange operator or auditors
\item [$+$] Fast and cheap
@@ -509,7 +491,14 @@
\item [$+$] Linear scalability
\item [$+$] Ecological
\item [$+$] Privacy when it can, transparency when it must (avoid tax evasion and money laundering)
- \item [$+$] Compatibility with blockchains
+ \end{itemize}
+\end{frame}
+
+\begin{frame}{Future work}
+ \begin{itemize}
+ \item Universal auditability, using onchain transactions history
+ \item Smarter analysis, update confirmation delay based on currency network behavior
+ \item Multisig by multiple operator for debit
\end{itemize}
\end{frame}
\end{document}
\ No newline at end of file