depolymerizer.tex (24073B)
1 \documentclass[conference]{IEEEtran} 2 \IEEEoverridecommandlockouts 3 % The preceding line is only needed to identify funding in the first footnote. If that is unneeded, please comment it out. 4 \usepackage{cite} 5 \usepackage{amsmath,amssymb,amsfonts} 6 \usepackage{algorithmic} 7 \usepackage{graphicx} 8 \usepackage{textcomp} 9 \usepackage{xcolor} 10 11 %\usepackage[tmargin=1in,bmargin=1in,lmargin=1.25in,rmargin=1.25in]{geometry} 12 % \usepackage[utf8]{inputenc} 13 \usepackage{bytefield} 14 % \usepackage{graphics} 15 % \usepackage{parskip} 16 \usepackage{tikz} 17 \usepackage{url} 18 % \usepackage{float} 19 % \usepackage{authblk} 20 % \usepackage{acro} 21 22 \usetikzlibrary{positioning,fit} 23 24 25 \def\BibTeX{{\rm B\kern-.05em{\sc i\kern-.025em b}\kern-.08em 26 T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}} 27 28 \title{Project Depolymerization: Tokenization of Blockchains} 29 \author{\IEEEauthorblockN{Antoine d'Aligny} 30 \IEEEauthorblockA{student \\ 31 \textit{EFREI Paris}\\ 32 Villejuif, France \\ 33 antoinedaligny@outlook.fr\\} 34 \and 35 \IEEEauthorblockN{Emmanuel Benoist} 36 \IEEEauthorblockA{\textit{School of Engineering and Computer Science} \\ 37 \textit{Bern University of Applied Sciences}\\ 38 Biel, Switzerland\\} 39 \and 40 \IEEEauthorblockN{Christian Grothoff} 41 \IEEEauthorblockA{\textit{School of Engineering and Computer Science} \\ 42 \textit{Bern University of Applied Sciences}\\ 43 Biel, Switzerland} 44 } 45 \begin{document} 46 \maketitle 47 48 \begin{abstract} 49 GNU Taler is an electronic payment system implemented as Free 50 Software. The goal of this project is to enable payments with 51 blockchain-based cryptocurrencies in GNU Taler. 52 53 Blockchain-based cryptocurrencies come with their own special set of 54 challenges, such as lack of finality, unpredictable delays and fees 55 in transactions. Our work analyzes the limitations that arise from 56 using a blockchain as a settlement layer for GNU Taler and describes 57 ways to mitigate their impact. By proving that blockchains can be 58 used as a settlement layer for GNU Taler, we show that it is not only 59 capable of handling bank money, but also widely used cryptocurrencies. 60 61 For cryptocurrencies owners, this integration offers a new solution 62 for instant and low-cost payments that can scale beyond blockchains 63 limitations while preserving or enhancing privacy. 64 \end{abstract} 65 66 \section{Introduction} 67 68 Today, popular cryptocurrencies like 69 Bitcoin~\cite{nakamoto2008bitcoin} and Ethereum~\cite{ethereum} are 70 not useful for electronic payments in everyday life (say to buy bread, 71 pay for a beer or a snack in a vending machine). There are three main 72 reasons for this. First, the distributed character and the validation 73 of blockchains do not allow fast transactions: a transaction in 74 Bitcoin or Ethereum has to be entered in a block and then one has to 75 wait for a certain number of blocks for this transaction to be 76 considered valid. To have a serious validation, it may be necessary to 77 wait for one hour~\cite{nakamoto2008bitcoin}. 78 79 Second, the block size and number of blocks mined are two factors limiting the 80 amount of transactions per second that distributed cryptocurrencies 81 can perform. The number of transactions per second is currently small 82 (3 to 4 for Bitcoin and 20 for Ethereum).~\cite{speed} This makes it 83 impossible to use these two systems as a means of payment in the daily 84 life of users, since the systems simply cannot handle the transaction 85 rates required by millions of users. In practice, the transactions 86 that are successful are those with the highest payment fees attached. 87 Which brings us to the third reason: the effective payment fees are 88 too high for small purchases, as the fees may even exceed the value of 89 the purchase, especially for small purchases like snacks from a 90 vending machine. 91 92 We developed a way to use the GNU Taler electronic payment system as a 93 % Mention blockchain alongside DLT ? as we talk about blockchain in conclusion 94 second-layer solution for Distributed Ledger Technology (DLT) based 95 cryptocurrencies. The GNU Taler system is based on cryptographic 96 tokens distributed by an exchange that can be used for instant 97 payments. Users pay the merchants using digital tokens that were 98 blindly signed by an issuing payment service provider, called an 99 exchange. Merchants receiving GNU Taler payments need to redeem the 100 digital tokens at the exchange. Merchants can either receive fresh 101 tokens, or the exchange can aggregate many off-chain micropayments so 102 that the merchant would receive one bulk transfer for many 103 micropayments on the blockchain. 104 105 Our solution allows to use the GNU Taler system to make payments in 106 Bitcoin and Ethereum. An exchange is created, to which the user 107 transfers an amount in cryptocurrency. In return, the user receives 108 (blindly signed) tokens corresponding to this amount and can spend 109 them at will in any store that accepts these tokens. The transaction 110 is then instantaneous: the exchange operator instantly confirms the 111 validity of the tokens by checking its signature and ensuring that 112 tokens are not double-spent. The merchant can then immediately run 113 the business logic, and freely determine when the payment is to be 114 aggregated and converted into an on-chain transaction. 115 116 A key issue with any layer-two solution is that the merchants must 117 have some confidence that the operator can be trusted. GNU Taler 118 includes an auditor component which can be used to provide real-time 119 audits of an exchange operator. By setting up one or more auditors 120 that have both access to the exchange's database and see the on-chain 121 transactions, this trust issue can be mitigated. 122 123 We give some background on the GNU Taler payment system in 124 Section~\ref{sec:taler}. Then in Section~\ref{sec:architecture} we 125 present the Depolymerization system, which allows to transform Bitcoin 126 and Ethereum assets into GNU Taler tokens and vice versa. We also 127 present in Section~\ref{sec:features} the different specificities of 128 our system allowing to solve the inherent problems of blockchains. 129 130 \section{Background: GNU Taler}\label{sec:taler} 131 132 The GNU Taler system has been designed as an electronic payment system 133 for fiat currencies (Figure~\ref{fig:taler}).~\cite{dold2019} 134 Customers who want to use GNU Taler use a Taler wallet. To get tokens 135 into their wallet, customers make a wire transfer to an exchange. In 136 response, the exchange issues tokens to the users who store them in 137 their wallet. 138 139 \begin{figure}[hb] 140 \begin{center} 141 \scalebox{1.2}{\input{figures/taler_arch.tex}} 142 \end{center} 143 \caption{GNU Taler overview}\label{fig:taler} 144 \end{figure} 145 146 The GNU Taler system is based on four types of entities. The consumers 147 who want to buy goods from merchants. An exchange that signs the 148 tokens into existence, and receives deposited tokens from 149 merchants. Finally, the exchange is supervised by one or more auditors 150 who check that all transactions are regular and that the exchange has 151 adequate funds in escrow to meet its obligations from tokens in 152 circulation. 153 154 When users need tokens, they make a money transfer to the 155 exchange. Then they generate tokens and have them signed by the 156 exchange. The signature is blind, so the exchange does not know the 157 public key of the tokens it has signed~\cite{cbdc2021chaum}. 158 159 The user spends the tokens at a merchant by signing a digital contract 160 with the private keys of one or more tokens. The merchant must then 161 present the tokens to the exchange, which verifies the signature and 162 checks against double-spending. Here, the exchange cannot determine 163 which consumer is spending the token (due to the blind signature). If 164 the tokens are valid, the merchant is credited with the amount of the 165 received tokens. 166 167 168 \section{Depolymerization Architecture}\label{sec:architecture} 169 170 The Depolymerization project consists of a banking interface that 171 connects an exchange to Bitcoin or Ethereum as the underlying 172 settlement layer. The system allows owners of digital currencies to 173 deposit this currency in an exchange, get tokens in exchange, and then 174 to pay with these tokens. The (micro) transactions between customers 175 and merchants are then done within the GNU Taler system and not on the 176 blockchain. Figure~\ref{fig:offchain} shows how Depolymerization 177 allows funds to be transferred to GNU Taler and then transactions to 178 be made off-chain. 179 180 \begin{figure}[hb] 181 \begin{center} 182 \input{figures/settlement_layer.tex} 183 \end{center} 184 \caption{Blockchain settlement layer with Depolymerization.}\label{fig:offchain} 185 \end{figure} 186 187 The Depolymerization system consists of several components. 188 Figure~\ref{fig:architecture} shows the interactions between the Taler 189 exchange, the Depolymerization {\em Wire Gateway}, the 190 Depolymerization {\em DLT Adapter}, and the DLT Full Node. Here, the 191 Taler exchange represents the previously existing Taler payment 192 system, specifically the \texttt{taler-exchange-wirewatch} and 193 \texttt{taler-exchange-transfer} components that are traditionally 194 interacting with the banking system. The Depolymerization Wire Gateway 195 is simply a REST API that presents the Taler exchange with a view of 196 the blockchain that (largely) matches the expected semantics of a 197 traditional settlement layer. At the center of this architecture is a 198 relational database (PostgreSQL) which collects the incoming (credit) 199 and outgoing (debit) transactions of the system. The DLT Full Node is 200 the existing Bitcoin or Ethereum ``full'' client 201 ({\texttt{bitcoind}\footnote{\url{https://bitcoincore.org/}} or 202 {\texttt{geth}\footnote{\url{https://geth.ethereum.org/}}). The 203 Depolymerization DLT Adapter is responsible for DLT-specific 204 adaptations. 205 206 \begin{figure}[hb] 207 \begin{center} 208 \input{figures/depolymerizer_arch.tex} 209 \end{center} 210 \caption{Depolymerization architecture.}\label{fig:architecture} 211 \end{figure} 212 213 When users want to withdraw tokens, they have to credit the 214 exchange's account on the respective DLT. As all users' money is 215 transferred to the same address of the exchange, each user must add 216 information allowing the exchange to associate the incoming funds with 217 the originating user's wallet. To do this, the customer sends a 218 transaction that contains both the money and a public key of the 219 user's wallet in transaction {\em meta-data}. This public key will be 220 used to validate requests for issuing fresh tokens. While meta-data is 221 easy to add in Ethereum, for Bitcoin we use a multi-output 222 transaction. Here, the main output is our account while the other 223 outputs (whose transaction values are negligible) correspond to an 224 ephemeral public key that identifies the user's wallet. 225 226 When customers want to withdraw tokens corresponding to the transfer 227 they made, they sign the requests for new tokens with the private key 228 corresponding to the public key indicated during the transfer. The 229 Taler exchange retrieves the withdrawal request, checks that the 230 public key used during the money transfer matches the signature used 231 for the request, and finally blindly signs the new tokens and sends 232 the signature back to the wallet. 233 234 The Taler exchange is also responsible for redeeming tokens that were 235 spent at merchants. If and when a merchant decides to be credited 236 on-chain, the exchange will instruct the Depolymerization Wire Gateway 237 to transfer the funds from its DLT escrow account to the DLT address 238 indicated by the merchant. 239 240 241 \section{Blockchain-specific Problems and Mitigations} \label{sec:features} 242 243 In this section we describe how the Depolymerization system addresses 244 Blockchain-specific problems. 245 246 \subsection{Forks} 247 248 A big risk for an exchange operator is to believe that an incoming 249 on-chain transaction was final, allow the wallet to withdraw tokens, 250 and later have the original on-chain transfer reversed. 251 252 \begin{figure}[ht] 253 \begin{center} 254 \input{figures/fork.tex} 255 \end{center} 256 \caption{Blockchain fork}\label{fig:fork} 257 \end{figure} 258 259 This can happen with DLT systems in the case of a fork. If a 260 transaction is included in a block (for instance D1 in 261 Figure~\ref{fig:fork}), the exchange might believe that it is durable 262 and final. But if a fork happens that does not contain D1, the 263 transaction may not appear in the new blocks of the ultimately 264 authoritative longest chain. Moreover, we can also have in one of the 265 new blocks (for instance D2 in Figure~\ref{fig:fork}) a conflicting 266 transaction that uses the money at the origin of our transaction for a 267 different transfer. This would prevent the original transaction 268 from ever being committed on the longest chain. 269 270 Since the blindly signed tokens cannot easily be identified (because 271 they were signed {\em blind}), the exchange could lose money. The 272 canonical solution to the problem is to wait a certain number of 273 blocks before validating a transaction. In Depolymerization, the 274 number is set depending on the DLT and the history of forks observed 275 by the system. The resulting delay only impacts the initial issuing 276 of coins, and not the off-chain transactions. 277 278 If the Depolymerizer detects that a fork has reverted an incoming 279 transaction, it suspends operations until the reverted transactions 280 appear in the fork {\em or} until the operator manually intervenes 281 to resolve the situation. 282 283 One such possible intervention enabled by GNU Taler is for the 284 exchange to revoke the affected denomination keys (i.e. the keys used 285 for blind signature of one type of coins), and to request all 286 wallets to reveal the blinding factors of tokens in circulation that 287 correspond to those denominations. This would allow the exchange to 288 re-issue the tokens that were from on-chain transfers that were not 289 reversed. However, in theory it might be too late, as the token might 290 also have already been spent. Still, this remains a possible 291 mitigation for a Depolymerizer operator in case the canonical solution 292 was inadequate. 293 294 \subsection{Fees are Bids} 295 296 Due to the limited rate for on-chain transactions, it is possible for 297 cryptocurrency transactions to get stuck for a long time. Especially 298 if the transaction fee was set too low, it is even possible that transactions 299 effectively never make it out of the pending transaction pool onto the main 300 chain. 301 302 This is problematic when merchants expect to be credited in a timely 303 manner. Depolymerizer keeps track of pending transactions and 304 identifies those that are taking an excessive amount of time to 305 mine. For such stuck transactions, it eventually replaces the 306 transaction~\cite{bip125} with one where the fee was increased to bump 307 its mining priority. Since the process of replacing transactions is 308 expensive, acceptable delays and transaction fees are configurable. 309 310 \subsection{Tiny Amounts} 311 312 The GNU Taler amount format is based on RFC 8905~\cite{rfc8905}. It 313 allows up to $2^{53}$ unit and 8 decimal digits. This format is 314 perfectly suited for Bitcoin where the maximal amount is 21 million 315 bitcoins and the smallest unit being the Satoshi, one Satoshi being 316 worth $10^{-8}$ Bitcoin. However, the smallest unit of Ether is the Wei, 317 with one Ether being worth $10^{18}$ Wei. The amount of Ether in 318 circulation continues to grow without a cap, with over 119,000,000 319 Ether in circulation at the time of writing those lines. Therefore, it 320 is not possible to represent all Ethereum amounts with the current 321 format. 322 323 A standard Ethereum transaction requires 21'000 units of 324 gas~\footnote{\url{https://ethereum.org/en/developers/docs/gas/#post-london}}. The 325 average gas price is currently around 30 GWei. Therefore, a standard 326 transaction costs about $63 \cdot 10^{18}$ Wei in transaction 327 fees. Since the transaction fee is so high, even if we truncate 328 amounts to $10^{-8}$ Ether ($10^{10}$ Wei), we can still represent any 329 amount that can be practically wired. Thus, in Depolymerizer, all 330 Ether amounts must be multiples of $10^{10} Wei$. 331 332 % \subsection{Meta data} % ??? 333 334 \section{Advantages} 335 336 The Depolymerization system allows users to turn Bitcoin or Ethereum 337 funds temporarily into tokens. The tokens are quickly exchangeable and 338 can be used for daily expenses. 339 340 While the number of transactions on blockchains is limited by the size 341 of the blocks, their frequency and thus the size of the blockchain, 342 the GNU Taler payment system has no intrinsic limit. Marco 343 Boss~\cite{boss2022} has successfully configured a GNU Taler exchange 344 to process over 23,000 token transactions per second. Since each 345 transaction uses a limited number of tokens (on average, half of the 346 binary logarithm of the number of currency units spent) an exchange 347 can therefore be expected to process at least 2,300 transactions per 348 second for typical amounts. This is comparable to the Visa network, 349 which is said to perform about 1'700 transaction per second 350 globally.~\cite{tps-payment-systems,speed} 351 352 % FIXME: privacy? 353 354 355 % FIXME: reword? Move into conclusion? 356 357 \section{Related work} 358 359 Blockchain-based systems lack a central instance to validate a 360 transaction, making instantaneous transactions impossible as an 361 expensive distributed Byzantine fault-tolerant consensus protocol must 362 be executed before transactions are confirmed. One way to work around 363 this problem are layer-2 solutions like Lightning, which is an 364 additional payment layer on top of Bitcoin. Its goal is to settle 365 transactions faster without involving a full transaction on the 366 blockchain every time that money is moved. Lightning works by 367 establishing {\em payment channels} between two parties, where one or 368 both parties ``lock'' an initial amount to the channel. Signatures 369 communicated outside the blockchain then change how money is 370 allocated between the two sides of the payment channel. Eventually a 371 payment channel will be closed by submitting a multi-party signature 372 of the latest allocation between the two parties to the Blockchain, 373 releasing the locked money to the two endpoints according to the most 374 recent allocation. 375 376 A payment can be {\em routed} through a network of multiple 377 bidirectional channels. If channels Alice-Bob and Bob-Carol exist and 378 have sufficient capacity, then Alice can send a payment to Carol over 379 the route Alice-Bob-Carol. Routing payments with Lightning is thus 380 contingent upon the existence and discovery of channels with 381 sufficient capacity, forcing participants to lock significant amounts 382 of Bitcoin in a channel, resulting in opportunity costs. The cost of 383 operating a lightning node is prohibitive to an average user. As a 384 result, Lightning basically re-introduces financial intermediaries 385 (aka banks, except here not regulated) with the associated trend 386 towards centralization~\cite{Lin_2020}. Our work is thus a logical 387 continuation and simplification of this trend: instead of a complex 388 federated structure, we simply use a centralized payment system to 389 provide virtually instant transactions, which also eliminates the need 390 for customers to operate a node that needs to be permanently online. 391 392 Aside from scalability, Bitcoin and Ethereum also suffer from coins not 393 being fungible, as they are traceable. As a result, freshly mined 394 coins may be considered more valuable as they cannot possibly have 395 been tainted by criminal transactions in the unspent transaction 396 output's (UTXO) transaction history, which may result in coins being 397 rejected by cryptocurrency exchanges or merchants. Mixing services 398 for DLTs attempt to re-introduce privacy and thus fungibility, but 399 only further taint a UTXO's history as it is clear that the coin was 400 mixed. With Depolymerization, all tokens issued via GNU Taler have no 401 transaction history, and are thus perfectly fungible. 402 403 \section{Future Work} \label{sec:future} 404 405 While the GNU Taler exchange was recently extended to support 406 wallet-to-wallet (peer-to-peer) payments, the GNU Taler wallet 407 currently does not yet support this new feature. This is a major 408 limitation in practice as it requires merchants to receive all 409 payments on-chain eventually. Once GNU Taler wallets support 410 direct wallet-to-wallet payments, it will become practical to 411 do day-to-day transactions with Bitcoin or Ethereum. 412 413 Another concern is that in order to operate legally, a Taler exchange 414 operator will typically be required to perform know-your-customer 415 (KYC) checks. GNU Taler's cryptographic design allows in principle 416 the identification of users withdrawing or receiving funds through the 417 system. In a deployment with fiat money, a GNU Taler deployment can 418 simply re-use the existing KYC processes used by the banks connected 419 to the underlying settlement layer. However, with cryptocurrencies, 420 the operation would typically be immediately global, which could 421 create challenges for practical KYC. Furthermore, the non-fungibility 422 of cryptocurrencies is expected to create problems for anti-money 423 laundering, it will require defining a threshold for when UTXOs should 424 be considered tainted before the Depolymerization system allows the 425 wallet to withdraw tokens. 426 427 \section{Conclusion}\label{sec:conclusion} 428 429 Contemporary cryptocurrencies are too slow and expensive for daily 430 purchases and fail to meet the fungibility of cash. Thanks to 431 Depolymerization, one can use GNU Taler to pay for services in real 432 time with privacy, allowing merchants to deliver the goods without 433 noticeable delay. 434 435 \section*{Acknowledgements} 436 437 We thank Florian Dold and Sebastian Marchano for adding Bitcoin 438 support to the GNU Taler wallet. This work was partially funded 439 by a grant from Taler Systems SA. 440 441 \bibliographystyle{IEEEtran} 442 \bibliography{biblio,rfc} 443 444 \section*{Availability} 445 446 An experimental public Depolymerization exchange is available at 447 \url{https://bitcoin.ice.bfh.ch/}. To use the service, one only needs 448 to install a GNU Taler wallet from \url{https://wallet.taler.net/} and 449 instruct it to use this exchange to withdraw coins. 450 451 \end{document} 452 453 A Free Software reference implementation of the Depolymerization 454 system is available at 455 \begin{center} 456 \url{https://git.taler.net/depolymerization.git/} 457 \end{center} 458 459 460 \end{document} 461 462 463 464 465 466 \begin{figure}[ht] 467 \begin{center} 468 \input{figures/conf_delay.tex} 469 \end{center} 470 \caption{Reorganisation mitigation using confirmation delay} 471 \end{figure} 472 473 \begin{figure}[ht] 474 \begin{center} 475 \input{figures/harmless_reorg.tex} 476 \end{center} 477 \caption{Harmless reorganisation} 478 \end{figure} 479 480 \begin{figure}[ht] 481 \begin{center} 482 \input{figures/conflict.tex} 483 \end{center} 484 \caption{Reorganisation with conflicting transaction} 485 \end{figure} 486 487 \begin{figure}[ht] 488 \begin{center} 489 \input{figures/analysis.tex} 490 \end{center} 491 \caption{Adaptive confirmation} 492 \end{figure} 493 494 \begin{figure}[ht] 495 \begin{center} 496 \begin{bytefield}{33} 497 \bitheader{0,1,32} \\ 498 \bitbox{1}{\tiny 0} & \bitbox{32}{Key Hash} 499 \end{bytefield} 500 \end{center} 501 \caption{Incoming metadata format} 502 \end{figure} 503 504 505 \begin{figure}[ht] 506 \begin{center} 507 \begin{bytefield}[rightcurly=., rightcurlyspace=0pt]{33} 508 \bitheader{0,1,32,33} \\ 509 \begin{rightwordgroup}{Credit} 510 \bitbox{1}{\tiny 0} & \bitbox{32}{Transfer ID} & \bitbox{10}{Base URL} 511 \end{rightwordgroup} \\ \\ 512 \begin{rightwordgroup}{Bounce} 513 \bitbox{1}{\tiny \rotatebox{90}{254}} & \bitbox{32}{Transaction ID} 514 \end{rightwordgroup} 515 \end{bytefield} 516 \end{center} 517 \caption{Outgoing metadata format} 518 \end{figure} 519 520 \begin{figure}[ht] 521 \begin{center} 522 \begin{bytefield}[rightcurly=., rightcurlyspace=0pt]{20} 523 \bitheader{0,3,4,19} \\ 524 \begin{rightwordgroup}{Address} 525 \bitbox{4}{ID} & \bitbox{16}{Half} 526 \end{rightwordgroup} 527 \end{bytefield} 528 529 \end{center} 530 \begin{center} 531 \begin{bytefield}[rightcurly=., rightcurlyspace=0pt]{32} 532 \bitheader{0,1,31} \\ 533 \begin{rightwordgroup}{First ID} 534 \bitbox{1}{\tiny 0} & \bitbox{31}{Random ID} 535 \end{rightwordgroup} \\ \\ 536 \begin{rightwordgroup}{Second ID} 537 \bitbox{1}{\tiny 1} & \bitbox{31}{Random ID} 538 \end{rightwordgroup} 539 \end{bytefield} 540 \end{center} 541 \caption{Outgoing metadata format} 542 \end{figure}