commit b6839ca3b1df1f7d48f5feea33cf6bee3a9d6988
parent e99f3a415b001e85a8c52a6c1bcfdef51a823afa
Author: Christian Grothoff <grothoff@gnunet.org>
Date: Sat, 29 Jun 2024 18:36:26 +0200
cos talk
Diffstat:
3 files changed, 652 insertions(+), 4 deletions(-)
diff --git a/workshops/cosin.tex b/workshops/cosin.tex
@@ -0,0 +1,640 @@
+\documentclass[aspectratio=169,t]{beamer}
+\input taler-macros
+
+\newcommand{\TITLE}{NEXT \\ GENERATION \\ INTERNET}
+\newcommand{\SUB}{GNU Taler for Developers}
+\newcommand{\AUTHOR}{Christian Grothoff \& Florian Dold}
+\newcommand{\SPEAKER}{Christian Grothoff \& Florian Dold}
+\newcommand{\INST}{Bern University of Applied Sciences}
+\newcommand{\DATE}{COSIN'24}
+
+% Do not edit this part
+\title{\TITLE}
+\subtitle{\SUB}
+\date{\DATE}
+\author[\SPEAKER]{\AUTHOR}
+\institute{\INST}
+
+\begin{document}
+
+\begin{frame}[plain]
+\maketitle
+\end{frame}
+
+
+\begin{frame}{What is Taler?}
+ \framesubtitle{\url{https://taler.net/en/features.html}}
+ \noindent
+Taler is
+ \vfill
+ \begin{itemize}
+ \item a Free/Libre software \emph{payment system} infrastructure project
+ \item ... with a surrounding software ecosystem
+ \item ... and a company (Taler Systems S.A.) and community that wants to deploy it
+ as widely as possible.
+ \end{itemize}
+ \vfill
+\noindent
+However, Taler is
+ \begin{itemize}
+ \item \emph{not} a currency
+ \item \emph{not} a long-term store of value
+ \item \emph{not} a network or instance of a system
+ \item \emph{not} decentralized
+ \item \emph{not} based on proof-of-work or proof-of-stake
+ \item \emph{not} a speculative asset / ``get-rich-quick scheme''
+ \end{itemize}
+ \vfill
+\end{frame}
+
+
+\begin{frame}{Taler overview}
+\begin{center}
+\begin{tikzpicture}
+ \tikzstyle{def} = [node distance= 4em and 7em, inner sep=1em, outer sep=.3em];
+ \node (origin) at (0,0) {};
+ \node (exchange) [def,above=of origin,draw]{Exchange};
+ \node (customer) [def, draw, below left=of origin] {Customer};
+ \node (merchant) [def, draw, below right=of origin] {Merchant};
+ \node (auditor) [def, draw, above right=of origin]{Auditor};
+ \tikzstyle{C} = [color=black, line width=1pt]
+ \draw [<-, C] (customer) -- (exchange) node [midway, above, sloped] (TextNode) {withdraw coins};
+ \draw [<-, C] (exchange) -- (merchant) node [midway, above, sloped] (TextNode) {deposit coins};
+ \draw [<-, C] (merchant) -- (customer) node [midway, above, sloped] (TextNode) {spend coins};
+ \draw [<-, C] (exchange) -- (auditor) node [midway, above, sloped] (TextNode) {verify};
+\end{tikzpicture}
+\end{center}
+\end{frame}
+
+
+\begin{frame}{Architecture of Taler}
+\begin{center}
+ \includegraphics[width=0.8\textwidth]{operations.png}
+\end{center}
+\end{frame}
+
+
+\begin{frame}{Merchant architecture}
+\begin{center}
+\begin{tikzpicture}
+ \tikzstyle{def} = [node distance= 3.5em and 2em, inner sep=1em, outer sep=.3em];
+ \node (origin) at (0,0) {};
+ \node (backend) [def,above=of origin,draw]{{\tiny taler-merchant-httpd}};
+ \node (frontend) [def,above left=of backend,draw]{{\tiny E-commerce Frontend}};
+ \node (backoffice) [def,above right=of backend,draw]{Backoffice};
+ \node (postgres) [def, draw, below=of backend] {Postgres};
+
+ \tikzstyle{C} = [color=black, line width=1pt]
+ \draw [->, C] (frontend) -- (backend) node [midway, above, sloped] (TextNode) {REST API};
+ \draw [->, C] (backoffice) -- (backend) node [midway, above, sloped] (TextNode) {REST API};
+ \draw [<->, C] (backend) -- (postgres) node [midway, right] (TextNode) {SQL};
+\end{tikzpicture}
+\end{center}
+\end{frame}
+
+
+\begin{frame}[fragile]{GNU Taler Merchant Backend}{Installation}
+Add a file {\tt /etc/apt/sources.list.d/taler.list}:
+\begin{verbatim}
+deb [signed-by=/etc/apt/keyrings/taler-systems.gpg] \
+ https://deb.taler.net/apt/debian bookworm main
+deb [signed-by=/etc/apt/keyrings/taler-systems.gpg] \
+ https://deb.taler.net/apt/ubuntu/ noble taler-noble
+\end{verbatim}
+And import the key and install the package:
+\begin{verbatim}
+# wget -O /etc/apt/keyrings/taler-systems.gpg \
+ https://taler.net/taler-systems.gpg
+# apt update; apt install taler-merchant
+\end{verbatim}
+\end{frame}
+
+
+\begin{frame}[fragile]{GNU Taler Merchant Backend}{Configuration}
+Setup database and start the service:
+\begin{verbatim}
+# taler-merchant-dbconfig
+# systemctl enable --now taler-merchant.target
+\end{verbatim}
+\begin{itemize}
+\item Listens by default on 9966
+\item Change ``[merchant] SERVE=unix'' to listen on
+ UNIX domain socket
+\item Reverse proxy configuration templates are in
+ {\tt /etc/\{nginx,apache\}/sites-available/}.
+\end{itemize}
+\end{frame}
+
+
+\begin{frame}[fragile]{GNU Taler Merchant Backend}{Authentication}
+ Initially, the service will have no password!
+ \begin{itemize}
+ \item Visit {\tt http://localhost:9966/} with a browser.
+ \item Setup default (admin) account and credentials!
+ \end{itemize}
+ In the REST API, the bearer token is always sent as:
+\begin{verbatim}
+Authorization: Bearer secret-token:$TOKEN
+\end{verbatim}
+See also:
+\begin{center}
+ \url{https://www.rfc-editor.org/rfc/rfc8959.pdf}
+\end{center}
+\end{frame}
+
+
+\begin{frame}[fragile]{GNU Taler Merchant Backend}{Test}
+\vfill
+\begin{verbatim}
+$ wget http://localhost:9966/config
+\end{verbatim}
+\vfill
+\end{frame}
+
+
+\begin{frame}{GNU Taler Merchant Backend}{REST API}
+\vfill
+\begin{center}
+\url{https://docs.taler.net/core/api-merchant.html}
+\end{center}
+\vfill
+\end{frame}
+
+
+\begin{frame}{GNU Taler Merchant Backend}{Key concepts}
+ \begin{itemize}
+ \item Instances
+ \item Orders
+ \item Inventory
+ \item Templates
+ \item Bank accounts
+ \item OTP devices
+ \item Webhooks
+ \end{itemize}
+\end{frame}
+
+
+\begin{frame}{GNU Taler Merchant Backend}{Ongoing developments}
+ \begin{itemize}
+ \item Token families
+ \begin{itemize}
+ \item Subscription
+ \item Discount
+ \end{itemize}
+ \item Donation receipts
+ \end{itemize}
+\end{frame}
+
+
+\begin{frame}{Other components for merchants}
+ \begin{itemize}
+ \item Point of sale app
+ \item {\tt taler-mdb}
+ \item WooCommerce (WordPress) plugin
+ \item Joomla! plugin
+ \item Adobe E-commerce (Magento) plugin
+ \end{itemize}
+\end{frame}
+
+
+\begin{frame}{Wallet architecture}
+ \vfill
+ \begin{center}
+ {\footnotesize
+ \begin{tikzpicture}
+ \tikzstyle{def} = [node distance= 3.5em and 2em, inner sep=1em, outer sep=.3em];
+ \node (android) [def,draw]{Android};
+ \node (ios) [def,right=of android,draw]{iOS};
+ \node (webex) [def,right=of ios,draw]{WebEx};
+ \node (wcore)[def,below=of ios,draw]{wallet-core};
+ \node (db)[def,right=2cm of wcore,draw]{DB};
+ \node (exchange)[def,below=of wcore,draw]{Exchange};
+ \node (merchant)[def,below=of wcore,right=of exchange,draw]{Merchant};
+ \node (bank)[def,below=of wcore,right=of merchant,draw]{Bank Integration};
+ \node [draw,frame,fit=(wcore)(db),label={[xshift=2cm]above:{qtart/browser}}] {};
+ \tikzstyle{C} = [color=black, line width=1pt];
+ \draw [<->, C] (android) -- (wcore) node [midway,left,xshift=-1cm] (TextNode) {wallet-core API};
+ \draw [<->, C] (ios) -- (wcore) node (TextNode) {};
+ \draw [<->, C] (webex) -- (wcore) node (TextNode) {};
+ \draw [<->, C] (wcore) -- (db) node [midway,above] (TextNode) {sqlite3};
+ \draw [<->, C] (wcore) -- (exchange) node [midway,left] (TextNode) {HTTP};
+ \draw [<->, C] (wcore) -- (merchant) node [midway,left] (TextNode) {HTTP};
+ \draw [<->, C] (wcore) -- (bank) node [midway,left] (TextNode) {HTTP};
+ \end{tikzpicture}
+ }
+ \end{center}
+ \vfill
+\end{frame}
+
+
+\begin{frame}[fragile]{GNU Taler wallet}{wallet-core}
+ \vfill
+
+ \textbf{wallet-core} is the component that powers the Taler wallets across
+ different platforms. It is written in TypeScript and it implements of all
+ the core functionality required by the wallets. It takes care of the
+ following:
+
+ \begin{itemize}
+ \item database management (IndexedDB/SQLite3)
+ \item task shepherding
+ \item cryptography
+ \item state machine for resources (transactions, exchange entries, ...)
+ \item communication with external services (exchange, merchant, bank)
+ \item communication with wallet-core clients
+ \end{itemize}
+
+ Most of its functionality is exposed via \textbf{requests}. Apps using
+ wallet-core can interact with it by calling different request methods,
+ passing parameters, and then e.g.\ rendering in the UI the data contained in
+ the response or showing an error message.
+
+ \vfill
+\end{frame}
+
+
+\begin{frame}[fragile]{GNU Taler wallet}{qtart}
+ qtart (\textbf{Q}uickJS \textbf{TA}ler \textbf{R}un\textbf{T}ime) is a
+ QuickJS-based runtime that embeds wallet-core into a native library for
+ usage outside of the browser, such as the mobile apps or any future desktop
+ app.
+
+ \begin{itemize}
+ \item Based on the acclaimed QuickJS JavaScript engine.
+ \item Implements native modules for cryptography.
+ \item Supports native HTTP networking (with multi-threading).
+ \item Provides access to the wallet-core API via a simple callback-based interface.
+ \item Keeps us from having to rewrite wallet-core for every platform!
+ \end{itemize}
+\end{frame}
+
+
+\begin{frame}{Wallet-core API}{Introduction}
+ \begin{center}
+ \begin{tikzpicture}
+ \tikzstyle{def} = [node distance= 3.5em and 10em, inner sep=1em, outer sep=.3em];
+ \node (wallet) [def,draw] {Wallet};
+ \node (wcore) [def,draw,right=of wallet] {wallet-core};
+ \tikzstyle{C} = [color=black, line width=1pt];
+ \draw [->,C,bend left](wallet) to node [above] {request (JSON)} (wcore);
+ \draw [->,C] (wcore) to node [below] {response (JSON)} (wallet);
+ \draw [->,C,bend left,dashed] (wcore) to node [below] {notifications (JSON)} (wallet);
+ \end{tikzpicture}
+ \end{center}
+
+ \begin{itemize}
+ \item Documentation: \url{https://docs.taler.net/wallet/wallet-core.html}
+ \end{itemize}
+
+\end{frame}
+
+
+\begin{frame}[fragile]{Wallet-core API}{Request structure}
+ \begin{center}
+ \begin{tabular}{c c c}
+ \hline
+ Field & Type & Description \\
+ \hline
+ \texttt{id} & integer & request ID \\
+ \texttt{operation} & string & API operation \\
+ \texttt{args} & object & request arguments \\
+ \end{tabular}
+ \end{center}
+
+ Example
+
+\begin{verbatim}
+{
+ "id": 0,
+ "operation": "init",
+ "args": { "logLevel": "INFO" }
+}
+\end{verbatim}
+\end{frame}
+
+
+\begin{frame}[fragile]{Wallet-core API}{Response structure}
+ \begin{center}
+ \begin{tabular}{c c c}
+ \hline
+ Field & Type & Description \\
+ \hline
+ \texttt{type} & string & either \texttt{response} or \texttt{error} \\
+ \texttt{id} & integer & request ID \\
+ \texttt{operation} & string & API operation \\
+ \texttt{result} & object & response data \\
+ \end{tabular}
+ \end{center}
+
+ Example
+
+\begin{verbatim}
+{ "type": "response",
+ "id": 0,
+ "operation": "init",
+ "result": {...} }
+\end{verbatim}
+\end{frame}
+
+
+\begin{frame}[fragile]{Wallet-core API}{Notification structure}
+ \begin{center}
+ \begin{tabular}{c c c}
+ \hline
+ Field & Type & Description \\
+ \hline
+ \texttt{type} & string & will be \texttt{notification} \\
+ \texttt{payload} & object & notification data \\
+ \end{tabular}
+ \end{center}
+
+ Example
+
+\begin{verbatim}
+{
+ "type": "notification",
+ "payload": {
+ "type": "task-observability-event"
+ }
+}
+\end{verbatim}
+\end{frame}
+
+
+\begin{frame}[fragile]{Wallet-core API}{Error structure}
+ An error can be contained inside a response or a notification, and includes
+ the following data, in some cases along with extra fields:
+
+ \begin{center}
+ \begin{tabular}{c c c}
+ \hline
+ Field & Type & Description \\
+ \hline
+ \texttt{code} & integer & GANA error code \\
+ \texttt{when} & timestamp? & time when it occurred \\
+ \texttt{hint} & string? & error message \\
+ \end{tabular}
+ \end{center}
+
+ Example
+
+\begin{verbatim}
+{ "code": 7001,
+ "hint": "could not resolve host: demo.taler.net",
+ "when": { "t_ms": 1718726899827 } }
+\end{verbatim}
+\end{frame}
+
+
+\begin{frame}[fragile]{GNU Taler wallet}{Building wallet-core}
+ \begin{enumerate}
+ \item Install Python, Node.js, NPM and pnPM (\url{https://pnpm.io/})
+ \item Clone the Git repository (\url{https://git.taler.net/wallet-core.git})
+ \item Run the bootstrap script
+\begin{verbatim}
+$ ./bootstrap
+\end{verbatim}
+ \item Run the configuration script
+\begin{verbatim}
+$ ./configure
+\end{verbatim}
+ \item Build all the components!
+\begin{verbatim}
+$ make
+\end{verbatim}
+ \end{enumerate}
+
+ \textbf{Note:} the relevant \texttt{.mjs} file for building qtart will be
+ created under \texttt{packages/taler-wallet-embedded/dist/taler-wallet-core-qjs.mjs}.
+\end{frame}
+
+
+\begin{frame}[fragile]{GNU Taler wallet}{Building web extension}
+ In order to build the web extension, please follow the steps in the previous
+ slide, and then run the following command:
+
+\begin{verbatim}
+$ make webextension
+\end{verbatim}
+
+ This will generate two files under \texttt{packages/taler-wallet-webextension}:
+
+ \begin{itemize}
+ \item \texttt{extension/v2/taler-wallet-webextension-\$VERSION.zip}
+ \item \texttt{extension/v3/taler-wallet-webextension-\$VERSION.zip}
+ \end{itemize}
+
+ Those files are the final packaged extensions. Depending on the manifest
+ version supported by your browser, you should install either \texttt{v2}
+ (e.g. Firefox) or \texttt{v3} (e.g. Chromium/Chrome).
+\end{frame}
+
+
+\begin{frame}[fragile]{GNU Taler wallet}{Building qtart (Android)}
+ \begin{enumerate}
+ \item Install Docker and Docker Compose
+ \item Clone the Git repository (\url{https://git.taler.net/quickjs-tart.git})
+ \item Copy into the root the \texttt{.mjs} file produced when building wallet-core.
+ \item Descend into the \texttt{docker-android} directory.
+ \item Create an empty \texttt{.env} file.
+ \item Run the following command:
+\begin{verbatim}
+$ docker-compose run --rm quickjs
+\end{verbatim}
+ \end{enumerate}
+
+ A local Maven repository will be created under the \texttt{.m2/repository}
+ directory relative to the Git repository root. The absolute path to this
+ directory should be added as a URL to the project-level
+ \texttt{build.gradle} file of the Android app, under
+ \texttt{allprojects/repositories}.
+\end{frame}
+
+
+\begin{frame}[fragile]{GNU Taler wallet}{Building Android app}
+ \begin{enumerate}
+ \item Install Android Studio.
+ \item Clone the Git repository (\url{https://git.taler.net/taler-android.git}).
+ \item Open the project with Android Studio.
+ \item Build qtart from source (optional).
+ \begin{itemize}
+ \item Build wallet-core from source.
+ \item Copy the resulting \texttt{.mjs} file to qtart.
+ \item Run the dockerized qtart build.
+ \item Add local Maven repository to the Android project.
+ \end{itemize}
+ \item Build and run the Android app.
+ \end{enumerate}
+\end{frame}
+
+
+\begin{frame}[fragile]{GNU Taler wallet}{Building iOS app}
+ \begin{enumerate}
+ \item Install Xcode (in macOS).
+ \item Under the same directory:
+ \begin{itemize}
+ \item Clone the iOS app Git repository (\url{https://git.taler.net/taler-ios.git})
+ \item Clone the qtart Git repository (\url{https://git.taler.net/quickjs-tart.git})
+ \end{itemize}
+ \item Build wallet-core from source.
+ \item Copy the resulting \texttt{.mjs} file to qtart.
+ \item Open the iOS project with Xcode.
+ \item Build and run the iOS app.
+ \end{enumerate}
+\end{frame}
+
+
+\begin{frame}[fragile]{Wallet-core CLI}
+ The CLI can be used to test wallet-core features quickly. In order to
+ install (only) the wallet-core CLI and other CLI tools, run the following
+ command after setting up the wallet-core repository:
+\begin{verbatim}
+$ make install-tools
+\end{verbatim}
+\textbf{Useful commands}:
+{\small
+\begin{verbatim}
+$ taler-wallet-cli --help # print help message
+$ taler-wallet-cli transactions # print transaction list
+$ taler-wallet-cli handle-uri $URI # handle a Taler URI
+$ taler-wallet-cli advanced withdraw-manually \
+ --exchange https://exchange.demo.taler.net/ \
+ --amount KUDOS:5 # perform manual withdrawal
+$ taler-wallet-cli run-until-done # run until all work is done
+\end{verbatim}
+}
+\end{frame}
+
+
+\begin{frame}[fragile]{Wallet-core CLI}
+ It is also possible to call wallet-core API requests directly from the
+ CLI, even when there is not a command for it:
+
+\begin{verbatim}
+$ taler-wallet-cli api getWithdrawalDetailsForAmount \
+ '{"exchangeBaseUrl":"https://exchange.demo.taler.net/",
+ "amount":"KUDOS:10"}'
+\end{verbatim}
+ \vfill
+\end{frame}
+
+
+\begin{frame}[fragile]{Wallet-core CLI}
+ By design, wallet-core CLI only performs background tasks during each
+ execution, and when it completes the requested action, it quits. However, it
+ is also possible to run it as a daemon and run commands in a client-server
+ fashion, as shown below:
+
+ \medskip
+
+ \textbf{Run the wallet as a daemon (in the foreground)}
+
+\begin{verbatim}
+$ taler-wallet-cli advanced serve
+\end{verbatim}
+
+ \textbf{Connect to the daemon and execute an action}
+
+\begin{verbatim}
+$ taler-wallet-cli --wallet-connection=$HOME/.wallet-core.sock ...
+\end{verbatim}
+\end{frame}
+
+
+\begin{frame}{Hacking on wallet-core}{Important files}
+ {\small
+ \begin{itemize}
+ \item \texttt{packages/\underline{taler-util}/src/} (common Taler code)
+ \begin{itemize}
+ \item \texttt{taler-types.ts} (core Taler protocol type definitions)
+ \item \texttt{transactions-types.ts} (transaction type definitions)
+ \item \texttt{wallet-types.ts} (core wallet API type definitions)
+ \end{itemize}
+ \item \texttt{packages/\underline{taler-wallet-core}/src/} (main wallet-core code)
+ \begin{itemize}
+ \item \texttt{exchanges.ts} (exchange management and operations)
+ \item \texttt{pay-merchant.ts} (payments to merchants)
+ \item \texttt{pay-peer-*.ts} (p2p send/receive operations)
+ \item \texttt{shepherd.ts} (task scheduler)
+ \item \texttt{testing.ts} (test functions)
+ \item \texttt{transactions.ts} (transaction management)
+ \item \texttt{wallet-api-types.ts} (wallet-core API request/response types)
+ \end{itemize}
+ \item \texttt{packages/\underline{taler-harness}/src/} (integration tests)
+ \end{itemize}
+ }
+\end{frame}
+
+
+\begin{frame}{Other components}
+ \begin{itemize}
+ \item Wallet app(s)
+ \item Auditor
+ \item Challenger
+ \item Sync
+ \item GNU Anastasis
+ \item Twister
+ \item libeufin
+ \end{itemize}
+\end{frame}
+
+
+\begin{frame}{Tutorials}
+ \begin{itemize}
+ \item Merchant payment processing: \url{https://docs.taler.net/taler-merchant-api-tutorial.html}
+ \item Regional/event currency setup: \url{https://docs.taler.net/libeufin/regional-automated-manual.html}
+ \item Video tutorials: \url{https://tutorials.taler.net/}
+ \item Support forum: \url{https://ich.taler.net/}
+ \end{itemize}
+\end{frame}
+
+
+\begin{frame}{Funding}
+ \vfill
+ \begin{center}
+ \url{https://nlnet.nl/propose}
+ \end{center}
+ \vfill
+ Candidates that passed 1st round from April 1st submission proposed:
+ \begin{itemize}
+ \item Some more integrations (frameworks, ERP)
+ \item Merchant implementation (?)
+ \item Improvements to wallet usability
+ \end{itemize}
+ \vfill
+\end{frame}
+
+
+
+% This should be last...
+\begin{frame}{Acknowledgements}
+
+ \begin{minipage}{0.45\textwidth} \ \\
+ {\tiny Funded by the European Union (Project 101135475).}
+
+ \begin{center}
+ \includegraphics[width=0.5\textwidth]{bandera.jpg}
+ \end{center}
+ \end{minipage}
+ \hfill
+ \begin{minipage}{0.45\textwidth}
+ {\tiny Funded by SERI (HEU-Projekt 101135475-TALER).}
+
+ \begin{center}
+ \includegraphics[width=0.65\textwidth]{sbfi.jpg}
+ \end{center}
+ \end{minipage}
+
+ \vfill
+
+ {\tiny
+
+ Views and opinions expressed are however those of the author(s) only
+ and do not necessarily reflect those of the European Union. Neither the
+ European Union nor the granting authority can be held responsible for
+ them.
+
+ }
+\end{frame}
+
+\end{document}
diff --git a/workshops/merchant.tex b/workshops/merchant.tex
@@ -258,10 +258,14 @@ $ wget http://localhost:9966/config
\vfill
- {\tiny Views and opinions expressed are however those of the author(s) only
+ {\tiny
+
+ Views and opinions expressed are however those of the author(s) only
and do not necessarily reflect those of the European Union. Neither the
European Union nor the granting authority can be held responsible for
- them.}
+ them.
+
+ }
\end{frame}
\end{document}
diff --git a/workshops/wallet.tex b/workshops/wallet.tex
@@ -502,10 +502,14 @@ $ taler-wallet-cli --wallet-connection=$HOME/.wallet-core.sock ...
\vfill
- {\tiny Views and opinions expressed are however those of the author(s) only
+ {\tiny
+
+ Views and opinions expressed are however those of the author(s) only
and do not necessarily reflect those of the European Union. Neither the
European Union nor the granting authority can be held responsible for
- them.}
+ them.
+
+ }
\end{frame}
\end{document}