exchange

Base system with REST service to issue digital coins, run by the payment service provider
Log | Files | Refs | Submodules | README | LICENSE

x_taler.tex (20808B)


      1 \chapter{Taler}
      2 
      3 \section{Taler Architecture}
      4 
      5 \subsection{Auditor}
      6 The following text is cited from section 4.4 in \cite{dold:the-gnu-taler-system}
      7 \begin{center}
      8     \textit{
      9         "The auditor consists of two processes that are regularly run and generate auditing reports.  
     10         Both processes access the exchange’s database, either directly (for exchange-internal auditing as part if its operational security) or over a replica (in the case of external auditors).
     11         The taler-wire-auditor process checks that the incoming and outgoing transfers recorded in the exchange’s database match wire transfers of the underlying  bank  account.   
     12         To access the transaction history (typically recorded by the bank), the wire auditor uses a wire plugin, with the same interface and implementation as the exchange’s wire plugins.
     13         The taler-auditor process generates a report with the following information:
     14     }
     15 \end{center}
     16 
     17 \begin{itemize}
     18     \item \textit{Do the operations stored in a reserve’s history match the reserve’s balance?}
     19     \item \textit{Did the exchange record outgoing transactions to the right merchant for deposits after the deadline for the payment was reached?}
     20     \item \textit{Do operations recorded on coins (deposit, refresh, refund) match the remaining value on the coin?}
     21     \item \textit{Do operations respect the expiration of denominations?}
     22     \item \textit{For a denomination, is the number of pairwise different coin public keys recorded in deposit/refresh operations smaller or equal to the number of blind signatures recorded in withdraw/refresh operations? If this invariant is violated, the corresponding denomination must be revoked.}
     23     \item \textit{What is the income if the exchange from different fees?}
     24 \end{itemize}
     25 
     26 \begin{center}
     27     \textit{
     28         \dots
     29         The auditor exposes a web server with the taler-auditor-httpd process.
     30         Currently, it only shows a website that allows the customer to add the auditor to the list of trusted auditors in their wallet. 
     31         In future versions, the auditor will also have HTTP endpoints that allow merchants to submit samples of deposit confirmations,  which  will  be  checked  against  the  deposit  permissions  in  the exchange’s  database  to  detect  compromised  signing  keys  or  missing  writes.
     32         Furthermore,  in  deployments  that  require  the  merchant  to  register  with  the exchange beforehand, the auditor also offers a list of exchanges it audits, so that the merchant backend can automatically register with all exchanges it transitively trusts."
     33     }
     34 \end{center}
     35 Some details were left out (see at the dots) and can be read in section 4.4 in \cite{dold:the-gnu-taler-system}
     36 
     37 \subsubsection{Technical Details}
     38 Documentation: \cite{taler-documentation:auditor-operator-manual} \\
     39 Git Repositories:
     40 \begin{itemize}
     41     \item Main repository: \cite{taler-git:exchange} (Part of exchange repository, inside ./src/auditor and ./src/auditordb)
     42     \item Auditor's public website: \cite{taler-git:auditor}
     43 \end{itemize}
     44 Language: C \\
     45 Dependencies: 
     46 \begin{itemize}
     47     \item GNUnet            >= 0.14.0
     48     \item GNU libmicrohttpd >= 0.9.71
     49     \item Postgres          >= 9.6, including libpq
     50     \item libjansson        >= 2.7
     51     \item libargon2         >= 20171227
     52     \item libsodium         >= 1.0
     53     \item libgcrypt         >= 1.6
     54     \item libqrencode       >= 4.0.0
     55     \item libcurl           >= 7.26 (or libgnurl >= 7.26)
     56     \item GNU libunistring  >= 0.9.3
     57     \item libsqlite3        >= 3.16.2
     58 \end{itemize}
     59 The auditor API is implemented as REST API and uses \ac{JSON} as message format.
     60 The auditor does not implement HTTPS (TLS), instead it recommends using a HTTP reverse Proxy that offers TLS termination.
     61 By delegating the responsibility for TLS termination, the auditor implementation becomes lighter.
     62 
     63 There are a lot more technical details written in the documentation linked above and in the README files.
     64 Since Taler is actively developed and technical details could change, we refer to this documentation.
     65 
     66 \subsection{Exchange}
     67 The following text is cited from section 4.3 in \cite{dold:the-gnu-taler-system}
     68 \begin{center}
     69     \textit{
     70         "The exchange consists of three independent processes:
     71     }
     72 \end{center}
     73 \begin{itemize}
     74     \item \textit{The taler-exchange-httpd process handles HTTP requests from clients, mainly merchants and wallets.}
     75     \item \textit{The taler-exchange-wirewatch process watches for wire transfers to the exchange’s bank account and updates reserves based on that.}
     76     \item \textit{The taler-exchange-aggregator process aggregates outgoing transactions to merchants.}
     77 \end{itemize}
     78 
     79 \begin{center}
     80     \textit{
     81         All three processes exchange data via the same database. 
     82         Only taler-exchange-httpd needs access to the exchanges online signing keys and denomination keys.
     83         The database is accessed via a Taler-specific database abstraction layer. 
     84         Different databases  can  be  supported  via  plugins;  at  the  time  of  writing  this,  only  a PostgreSQL plugin has been implemented.
     85         Wire plugins are used as an abstraction to access the account layer that Taler runs on. 
     86         Specifically, the wirewatch process uses the plugin to monitor incoming transfers, and the aggregator process uses the wire plugin to make wire transfers to merchants.
     87         The following APIs are offered by the exchange:
     88     }
     89 
     90     \textbf{\textit{Announcing keys, bank accounts and other public information}}\\
     91     \textit{
     92             The exchange offers the list of denomination keys, signing keys, auditors, supported bank accounts, revoked keys and other general information needed to use the exchange’s services via the /keys and /wire APIs.
     93     }
     94 
     95     \textbf{\textit{Reserve status and withdrawal}}\\
     96     \textit{
     97             After having wired money to the exchange, the status of the reserve can be checked via the /reserve/status API. Since the wire transfer usually takes some time to arrive at the exchange, wallets should periodically poll this API, and initiate a withdrawal with /reserve/withdraw once the exchange received the funds.
     98     }
     99 
    100     \textbf{\textit{Deposits and tracking}}\\
    101     \textit{
    102             Merchants transmit deposit permissions they have received from customers to the exchange via the/deposit API. Since multiple deposits are aggregated into one wire transfer, the merchant additionally can use the exchange’s /track/transfer API that returns the list of deposits for an identifier included in the wire transfer to the merchant, as well as the /track/transaction API to look up which wire transfer included the payment for a given deposit.
    103     }
    104 
    105     \textbf{\textit{Refunds}}\\
    106     \textit{
    107             The refund API (/refund) can “undo” a deposit if the merchant gave their signature, and the aggregation deadline for the payment has not occurred yet.    
    108     }
    109 
    110     \textbf{\textit{Emergency payback}}\\
    111     \textit{
    112             The emergency payback API (/payback) allows customers to be compensated for coins whose denomination key has been revoked.
    113             Customers must send either a full withdrawal transcript that includes their private blinding factor, or a refresh transcript (of a refresh that had the revoked denominations as one of the targets) that includes blinding factors.
    114             In the former case, the reserve is credited, in the latter case, the source coin of the refresh is refunded and can be refreshed again."
    115     }
    116 \end{center}
    117 
    118 Additional information for how the exchange generates new denomination and signing keys can be found in the end of section 4.3 of \cite{dold:the-gnu-taler-system}.
    119 
    120 \begin{figure}[h!]
    121     \centering
    122     \includegraphics[height=0.5\textwidth]{taler-exchange.png}
    123     \caption{Architecture of the Taler Exchange reference implementation. Source: \cite{dold:the-gnu-taler-system}}
    124     \label{fig:taler-arch-exchange}
    125 \end{figure}
    126 
    127 \subsubsection{Technical Details}
    128 
    129 Documentation: \cite{taler-documentation:exchange-operator-manual} \\
    130 Git Repository: Main repository: \cite{taler-git:exchange} \\
    131 Language: C \\
    132 Dependencies: 
    133 \begin{itemize}
    134     \item GNUnet            >= 0.14.0
    135     \item GNU libmicrohttpd >= 0.9.71
    136     \item Postgres          >= 9.6, including libpq
    137     \item libjansson        >= 2.7
    138     \item libargon2         >= 20171227
    139     \item libsodium         >= 1.0
    140     \item libgcrypt         >= 1.6
    141     \item libqrencode       >= 4.0.0
    142     \item libcurl           >= 7.26 (or libgnurl >= 7.26)
    143     \item GNU libunistring  >= 0.9.3
    144     \item libsqlite3        >= 3.16.2
    145 \end{itemize}
    146 The exchange’s API is implemented as REST API and uses \ac{JSON} as message format.
    147 
    148 There are a lot more technical details written in the documentation linked above and in the README files.
    149 Since Taler is actively developed and technical details could change, we refer to this documentation.
    150 
    151 \subsection{Merchant}
    152 The following text is cited from section 4.5 in \cite{dold:the-gnu-taler-system}
    153 \begin{center}
    154     \textit{
    155         "The Taler merchant backend is a component that abstracts away the details of processing Taler payments and provides a simple HTTP API.
    156         The merchant backend handles cryptographic operations (signature verification, signing), secret management and communication with the exchange.
    157         The backend API (see \url{https://docs.taler.net/api/}) is divided into two types of HTTP endpoints:
    158     }
    159 \end{center}
    160 
    161 \begin{enumerate}
    162     \item \textit{Functionality that is accessed internally by the merchant. 
    163     These API stypically require authentication and/or are only accessible from within the private network of the merchant.}
    164     \item \textit{Functionality that is exposed publicly on the Internet and accessed by the customer’s wallet and browser.}
    165 \end{enumerate}
    166 
    167 \begin{center}
    168     \textit{
    169         A typical merchant has a storefront component that customers visit with their browser, as well as a back office component that allows the merchant to view information about payments that customers made and that integrates with other components such as order processing and shipping."
    170     }
    171 \end{center}
    172 
    173 \subsubsection{Processing Payments}
    174 \begin{center}
    175     \textit{
    176         "To process a payment, the storefront first instructs the backend to create an order.
    177         The order contains information relevant to the purchase, and is in fact a subset of the information contained in the contract terms. 
    178         The backend automatically adds missing information to the order details provided by the storefront. 
    179         The full contract terms can only be signed once the customer provides the claim public key for the contract.\\
    180         Each order is uniquely identified by an order ID, which can be chosen by the storefront or automatically generated by the backend.
    181         The order ID can be used to query the status of the payment. 
    182         If the customer did not pay for an order ID yet, the response from the backend includes a payment redirect URL.
    183         The storefront can redirect the customer to this payment redirect URL; visiting the URL will trigger the customer’s browser/wallet to prompt for a payment.\\
    184         To simplify the implementation of the storefront, the merchant backend can serve a page to the customer’s browser that triggers the payment via the HTTP402 status code and the corresponding headers, and provides a fallback (in the form of a taler:pay link) for loosely integrated browsers. 
    185         When checking the status of a payment that is not settled yet, the response from the merchant backend will contains a payment redirect URL. 
    186         The storefront redirects the browser to this URL, which is served by the merchant backend and triggers the payment.
    187         \dots "
    188     }
    189 \end{center}
    190 
    191 \subsubsection{Back Office APIs}
    192 \begin{center}
    193     \textit{
    194         "The back office API allows the merchant to query information about the history and status of payments, as well as correlate wire transfers to the merchant’s bank account with the respective GNU Taler payment. 
    195         This API is necessary to allow integration with other parts of the merchant’s e-commerce infrastructure."
    196     }
    197 \end{center}
    198 
    199 % Nachfolgende Section nicht notwendig.
    200 % \subsubsection{Example Merchant Frontends}
    201 % This section is included to provide an overview of the reference implementation for the merchant.
    202 % This helps to get a better understanding of how a merchant could potentially look like.
    203 % Note that the actual code could differ from the cited part.
    204 % The actual code can be found in \url{git.taler.net}
    205 % \begin{center}
    206 %     \textit{
    207 %         We implemented the following applications using the merchant backend API.
    208 %     }
    209     
    210 %     \textit{\textbf{Blog Merchant}}\\
    211 %     \textit{
    212 %         The blog merchant’s landing page has a list of article titles with a teaser. 
    213 %         When following the link to the article, the customer is asked to pay to view the article.
    214 %     }
    215 
    216 %     \textit{\textbf{Donations}}\\
    217 %     \textit{
    218 %         The donations frontend allows the customer to select a project to donate to.
    219 %         The fulfillment page shows a donation receipt.
    220 %     }
    221 
    222 %     \textit{\textbf{Codeless Payments}}\\
    223 %     \textit{
    224 %         The codeless payment frontend is a prototype for a user interface that allows merchants to sell products on their website without having to write code to integrate with the merchant backend.
    225 %         Instead, the merchant uses a web interface to manage products and their available stock.
    226 %         The codeless payment frontend then creates an HTML snippet with a payment button that the merchant can copy-and-paste integrate into their storefront.
    227 %     }
    228 
    229 %     \textit{\textbf{Survey}}\\
    230 %     \textit{
    231 %         The survey frontend showcases the tipping functionality of GNU Taler.
    232 %         The user fills out a survey and receives a tip for completing it.
    233 %     }
    234 
    235 %     \textit{\textbf{Back Office}}\\
    236 %     \textit{
    237 %         The example back-office application shows the history and status of payments processed by the merchant.
    238 %     }
    239 % \end{center}
    240 
    241 \begin{figure}[h!]
    242     \centering
    243     \includegraphics[height=0.5\textwidth]{taler-merchant.png}
    244     \caption{Architecture Taler Merchant reference implementation. Source: \cite{dold:the-gnu-taler-system}}
    245     \label{fig:taler-arch-merchant}
    246 \end{figure}
    247 
    248 \subsubsection{Technical Details}
    249 
    250 Documentation: \cite{taler-documentation:merchant-backend-operator-manual} \\
    251 API Documentation: \cite{taler-documentation:merchant-api} \\
    252 Back-office Documentation: \cite{taler-documentation:back-office} \\
    253 Point-of-Sales Documentation: \cite{taler-documentation:pos-manual} \\
    254 Git Repositories: 
    255 \begin{itemize}
    256 \item Backend: \cite{taler-git:merchant}
    257 \item Backoffice: \cite{taler-git:backoffice}
    258 \item Point-of-Sales App: \cite{taler-git:android} (part of android repo)
    259 \end{itemize}
    260 Language: C (Backend), Kotlin (\ac{PoS}), [Python, Javascript] (Backoffice)\\
    261 Dependencies: 
    262 \begin{itemize}
    263     \item GNUnet            >= 0.14.0
    264     \item GNU libmicrohttpd >= 0.9.71
    265     \item Postgres          >= 9.6, including libpq
    266     \item libjansson        >= 2.7
    267     \item libargon2         >= 20171227
    268     \item libsodium         >= 1.0
    269     \item libgcrypt         >= 1.6
    270     \item libqrencode       >= 4.0.0
    271     \item libcurl           >= 7.26 (or libgnurl >= 7.26)
    272     \item GNU libunistring  >= 0.9.3
    273     \item libsqlite3        >= 3.16.2
    274     \item Flask (Backoffice)
    275 \end{itemize}
    276 Frontend Repositories:
    277 \begin{itemize}
    278     \item Payments with Django: \cite{taler-git:django-payments}
    279     \item Wordpress woocommerce plugin: \cite{taler-git:woocommerce}
    280     \item Saleor Frontend: \cite{taler-git:saleor}
    281     \item Demo Frontends: \cite{taler-git:merchant-demos}
    282 \end{itemize}
    283 The merchant’s API is implemented as REST API and uses \ac{JSON} as message format.
    284 The \ac{PoS} app is for the merchant to process customer's orders by adding or removing products, calculating the amount owed by the customer or letting the customer make a Taler payment via QR code or NFC.
    285 The back office Web service allows a merchant to check status of their Taler transactions.
    286 There are already a lot of demo pages and integrations for different e-commerce solutions.
    287 
    288 There are a lot more technical details written in the documentation linked above and in the README files.
    289 Since Taler is actively developed and technical details could change, we refer to this documentation.
    290 
    291 \subsection{Wallet}
    292 The following text is cited from section 4.6 in \cite{dold:the-gnu-taler-system}
    293 \begin{center}
    294     \textit{
    295         "The wallet manages the customer’s reserves and coins, lets the customer view and pay for contracts from merchants. \dots
    296         The reference implementation of the GNU Taler wallet is written in the Type-Script language against the WebExtension API, a cross-browser mechanism for browser extensions.
    297         The reference wallet is a “tightly integrated” wallet, as it directly hooks into the browser to process responses with the HTTP status code“402 Payment Required”.\\
    298         Many cryptographic operations needed to implement the wallet are not commonly available in a browser environment.
    299         We cross-compile the GNU Taler utility library written in C as well as its dependencies (such as libgcrypt) to asm.js (and WebAssembly on supported platforms) using the LLVM-based emscripten toolchain.
    300         Cryptographic operations run in an isolated process implemented as a WebWorker.
    301         This design allows the relatively slow cryptographic operations to run concurrently in the background in multiple threads.
    302         Since the crypto WebWorkers are started on-demand, the wallet only uses minimal resources when not actively used."
    303     }
    304 \end{center}
    305 
    306 \subsubsection{Optimizations}
    307 \begin{center}
    308     \textit{
    309         "To improve the perceived performance of cryptographic operations, the wallet optimistically creates signatures in the background while the user is looking at the “confirm payment” dialog.
    310         If the user does not accept the contract, these signatures are thrown away instead of being sent to the merchant.
    311         This effectively hides the latency of the most expensive cryptographic operations, as they are done while the user consciously needs to make a decision on whether to proceed with a payment."
    312     }
    313 \end{center}
    314 
    315 \subsubsection{Wallet Detection}
    316 \begin{center}
    317     \textit{
    318         " \dots
    319         Browser fingerprinting is a concern with any additional APIs made available to websites, either by the browser itself or by browser extensions.
    320         Since a website can simply try to trigger a payment to determine whether a tightly integrated Taler wallet is installed, one bit of additional fingerprinting information is already available through the usage of Taler.
    321         The dynamic detection methods do not, however, expose any information that is not already available to websites by signaling the wallet through HTTP headers."
    322     }
    323 \end{center}
    324 
    325 \subsubsection{Further Wallet Features}
    326 More information about other Wallet Features like coin selection, wallet liquidation and wallet signaling can be found in sections 4.6.2, 4.6.5 and 4.6.6 of \cite{dold:the-gnu-taler-system}.
    327 
    328 \begin{figure}[h!]
    329     \centering
    330     \includegraphics[height=0.5\textwidth]{taler-wallet.png}
    331     \caption{Architecture of the Taler Wallet reference implementation. Source: \cite{dold:the-gnu-taler-system}}
    332     \label{fig:taler-wallet-reference-impl}
    333 \end{figure}
    334 
    335 \subsubsection{Technical Details}
    336 
    337 Documentation: \cite{taler-documentation:wallet-developer-manual} \\
    338 Wallet-CLI documentation: \cite{taler-documentation:wallet-cli-manual} \\
    339 Git Repository: 
    340 \begin{itemize}
    341     \item Main repository: \cite{taler-git:wallet-core} \\
    342     This Repository includes the wallet-core and the implementations for the web extension and CLI.
    343     \item Android app: \cite{taler-git:android}
    344     \item iOS app: \cite{taler-git:ios}
    345 \end{itemize}
    346 Language: Typescript, Javascript (wallet-core,  web extension), Kotlin (Android app), Swift (iOS app)\\
    347 Dependencies: 
    348 \begin{itemize}
    349     \item prettier            
    350     \item rimraf
    351     \item rollup
    352     \item typescript
    353     \item ava
    354     \item esbuild
    355     \item axios
    356     \item tslib
    357     \item cancellationtoken
    358     \item minimatch
    359     \item source-map-support
    360     \item big-integer
    361     \item fflate
    362     \item esm
    363     \item jed
    364     \item nyc
    365     \item po2json
    366     \item typedoc
    367     \item api-extractor
    368 \end{itemize}
    369 
    370 There are a lot more technical details written in the documentation linked above and in the README files.
    371 Since Taler is actively developed and technical details could change, we refer to this documentation.
    372 
    373