summaryrefslogtreecommitdiff
path: root/texinfo/taler-exchange.texi
blob: 9cf2dac955728684a6c9a06ff847c711dd0ed6da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
\input texinfo   @c -*-texinfo-*-
@c %**start of header
@setfilename taler-exchange.info
@documentencoding UTF-8
@ifinfo
@*Generated by Sphinx 5.3.0.@*
@end ifinfo
@settitle Taler Exchange Manual
@defindex ge
@paragraphindent 0
@exampleindent 4
@finalout
@dircategory Network applications
@direntry
* GNU Taler Exchange: (taler-exchange.info). Taler payment service provider
@end direntry

@c %**end of header

@copying
@quotation
GNU Taler 0.9.4, Mar 07, 2024

GNU Taler team

Copyright @copyright{} 2014-2024 Taler Systems SA (GPLv3+ or GFDL 1.3+)
@end quotation

@end copying

@titlepage
@title Taler Exchange Manual
@insertcopying
@end titlepage
@contents

@c %** start of user preamble

@c %** end of user preamble

@ifnottex
@node Top
@top Taler Exchange Manual
@insertcopying
@end ifnottex

@c %**start of body
@anchor{taler-exchange-manual doc}@anchor{0}
@c This file is part of GNU TALER.
@c 
@c Copyright (C) 2014-2024 Taler Systems SA
@c 
@c TALER is free software; you can redistribute it and/or modify it under the
@c terms of the GNU Affero General Public License as published by the Free Software
@c Foundation; either version 2.1, or (at your option) any later version.
@c 
@c TALER is distributed in the hope that it will be useful, but WITHOUT ANY
@c WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
@c A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more details.
@c 
@c You should have received a copy of the GNU Affero General Public License along with
@c TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
@c 
@c @author Christian Grothoff
@c @author Florian Dold

@menu
* Introduction:: 
* Installation:: 
* Configuration Fundamentals:: 
* Exchange Database Setup:: 
* Basic Setup; Currency@comma{} Denominations and Keys: Basic Setup Currency Denominations and Keys. 
* Wire Gateway Setup:: 
* Legal Setup:: 
* KYC Configuration:: 
* Deployment:: 
* Offline Signing Setup@comma{} Key Maintenance and Tear-Down: Offline Signing Setup Key Maintenance and Tear-Down. 
* AML Configuration:: 
* Setup Linting:: 
* Testing and Troubleshooting:: 
* Template Customization:: 
* Benchmarking:: 
* FIXMEs:: 
* Index:: 

@detailmenu
 --- The Detailed Node Listing ---

Introduction

* About GNU Taler:: 
* About this manual:: 
* Organizational prerequisites:: 
* Architecture overview:: 
* Key Types:: 
* Offline keys:: 
* Online signing key security:: 

Online signing key security

* Functionality:: 
* Security goals:: 
* Setup:: 
* Configuration:: 

Installation

* Before you start:: 
* Installing from source:: 
* Installing the GNU Taler binary packages on Debian:: 
* Installing the GNU Taler binary packages on Trisquel:: 
* Installing the GNU Taler binary packages on Ubuntu:: 
* Services@comma{} users@comma{} groups and file system hierarchy: Services users groups and file system hierarchy. 

Configuration Fundamentals

* Configuration format:: 

Basic Setup: Currency, Denominations and Keys

* Coins (denomination keys): Coins denomination keys. 
* Sign keys:: 
* Setting up the offline signing key:: 

Wire Gateway Setup

* Exchange Bank Account Configuration:: 

Legal Setup

* Legal conditions for using the service:: 
* Terms of Service:: 
* Privacy Policy:: 
* Legal policies directory layout:: 
* Generating the Legal Terms:: 
* Adding translations:: 
* Updating legal documents:: 

Legal policies directory layout

* Example:: 

KYC Configuration

* Taler KYC Terminology:: 
* KYC Configuration Options:: 
* OAuth 2.0 specifics: OAuth 2 0 specifics. 
* Persona specifics:: 
* KYC AID specifics:: 

Deployment

* Serving:: 
* Reverse Proxy Setup:: 
* Launching an exchange:: 

Offline Signing Setup, Key Maintenance and Tear-Down

* Signing the online signing keys:: 
* Account signing:: 
* Wire fee structure:: 
* Auditor configuration:: 
* Revocations:: 

AML Configuration

* AML Officer Setup:: 
* AML Triggers:: 
* AML Forms:: 

Testing and Troubleshooting

* taler-config:: 
* Using taler-config:: 
* Private key storage:: 
* Internal audits:: 
* Database Scheme:: 
* Database upgrades:: 

Template Customization

* Generic Errors Templates:: 
* kycaid-invalid-request:: 
* oauth2-authentication-failure:: 
* oauth2-authorization-failure:: 
* oauth2-authorization-failure-malformed:: 
* oauth2-bad-request:: 
* oauth2-conversion-failure:: 
* oauth2-provider-failure:: 
* persona-exchange-unauthorized:: 
* persona-load-failure:: 
* persona-exchange-unpaid:: 
* persona-logic-failure:: 
* persona-invalid-response:: 
* persona-network-timeout:: 
* persona-kyc-failed:: 
* persona-provider-failure:: 

Benchmarking

* Choosing a bank:: 
* taler-bank-benchmark:: 
* taler-exchange-benchmark:: 
* taler-aggregator-benchmark:: 

@end detailmenu
@end menu

@node Introduction,Installation,Top,Top
@anchor{taler-exchange-manual exchange-operator-manual}@anchor{1}@anchor{taler-exchange-manual introduction}@anchor{2}
@chapter Introduction


@menu
* About GNU Taler:: 
* About this manual:: 
* Organizational prerequisites:: 
* Architecture overview:: 
* Key Types:: 
* Offline keys:: 
* Online signing key security:: 

@end menu

@node About GNU Taler,About this manual,,Introduction
@anchor{taler-exchange-manual about-gnu-taler}@anchor{3}
@section About GNU Taler


@c This file is part of GNU TALER.
@c 
@c Copyright (C) 2014-2023 Taler Systems SA
@c 
@c TALER is free software; you can redistribute it and/or modify it under the
@c terms of the GNU Affero General Public License as published by the Free Software
@c Foundation; either version 2.1, or (at your option) any later version.
@c 
@c TALER is distributed in the hope that it will be useful, but WITHOUT ANY
@c WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
@c A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more details.
@c 
@c You should have received a copy of the GNU Affero General Public License along with
@c TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>

GNU Taler is an open protocol for an electronic payment system with a
free software reference implementation. GNU Taler offers secure, fast
and easy payment processing using well understood cryptographic
techniques. GNU Taler allows customers to remain anonymous, while
ensuring that merchants can be held accountable by governments. Hence,
GNU Taler is compatible with anti-money-laundering (AML) and
know-your-customer (KYC) regulation, as well as data protection
regulation (such as GDPR).

@node About this manual,Organizational prerequisites,About GNU Taler,Introduction
@anchor{taler-exchange-manual about-this-manual}@anchor{4}
@section About this manual


This manual targets system administrators who want to install and
operate a GNU Taler exchange.

@node Organizational prerequisites,Architecture overview,About this manual,Introduction
@anchor{taler-exchange-manual organizational-prerequisites}@anchor{5}
@section Organizational prerequisites


Operating a GNU Taler exchange means that you are operating a payment service
provider, which means that you will most likely need a bank license and/or
follow applicable financial regulation. Exceptions may apply, especially if
you are operating a regional currency or a payment system for an event with a
closed user group.

GNU Taler payment service providers generally need to ensure high availability
and should have `really' good backups (synchronous replication, asynchronous
remote replication, off-site backup, 24/7 monitoring, etc.).  This manual will
not cover these aspects of operating a payment service provider.

We will assume that you can operate a (sufficiently high-availability,
high-assurance) PostgreSQL database. Furthermore, we expect some moderate
familiarity with the compilation and installation of free software
packages. You need to understand the cryptographic concepts of private and
public keys and must be able to protect private keys stored in files on disk.

@cartouche
@quotation Note 
Taler may store sensitive business and customer data in the database.  Any
operator SHOULD thus ensure that backup operations are encrypted and
secured from unauthorized access.
@end quotation
@end cartouche

@node Architecture overview,Key Types,Organizational prerequisites,Introduction
@anchor{taler-exchange-manual architecture-overview}@anchor{6}
@section Architecture overview


GNU Taler is a pure payment system, not a crypto-currency. As such, it
operates in a traditional banking context. In particular, this means that
payments can be executed in ordinary currencies such as USD or EUR.
Furthermore, a typical merchant in Taler has a regular bank account, and would
use it to receive funds via Taler.

Consequently, a typical Taler exchange must interact with a bank. The bank of
the exchange holds funds in an account where the balance is basically
equivalent to the value of all coins in circulation. (Small mismatches arise
whenever customers are about to withdraw coins and have already send the funds
into the bank account, or if merchants just deposited coins and are about to
receive wire transfers for deposited coins, or due to fees charged by the
exchange and the operator not yet having drained the fees from the account.)

The exchange uses an intermediary system to talk to its bank.  This shifts the
technical burden (XML-based communications, additional cryptography, and a
vast variety of standards) for this interaction into another bank-specific
subsystem.  Such intermediary system abstracts the native banking protocol by
exposing the `Taler Wire Gateway API'; this way, the exchange can conduct its
banking operations in a simplified and JSON-based style.

When customers wire money to the exchange’s bank account, the Taler Wire
Gateway API must notify the exchange about the incoming wire transfers. The
exchange then creates a `reserve' based on the subject of the wire
transfer. The wallet which knows the secret key matching the wire transfer
subject can then withdraw coins from the reserve, thereby draining it. The
liability of the exchange against the reserve is thereby converted into a
liability against digital coins issued by the exchange. When the customer
later spends the coins at a merchant, and the merchant `deposits' the coins at
the exchange, the exchange first `aggregates' the amount from multiple
deposits from the same merchant and then instructs its bank to make a wire
transfer to the merchant, thereby fulfilling its obligation and eliminating
the liability. The exchange charges `fees' for some or all of its operations
to cover costs and possibly make a profit.

`Auditors' are third parties, for example financial regulators, that verify
that the exchange operates correctly. The same software is also used to
calculate the exchange’s profits, risk and liabilities by the accountants of
the exchange.

The Taler software stack for an exchange consists of the following
components:


@itemize -

@item 
`HTTP frontend':
The HTTP frontend interacts with Taler wallets and merchant backends.
It is used to withdraw coins, deposit coins, refresh coins, issue
refunds, map wire transfers to Taler transactions, inquire about the
exchange’s bank account details, signing keys and fee structure. The
binary is the @code{taler-exchange-httpd}.

@item 
`Crypto-Helpers':
The @code{taler-exchange-secmod-rsa}, @code{taler-exchange-secmod-cs} and
@code{taler-exchange-secmod-eddsa}
are three programs that are responsible for managing the exchange’s
online signing keys. They must run on the same machine as the
@code{taler-exchange-httpd} as the HTTP frontend communicates with the
crypto helpers using UNIX Domain Sockets.

@item 
`Aggregator':
The aggregator combines multiple deposits made by the same merchant
and (eventually) triggers wire transfers for the aggregate amount.
The merchant can control how quickly wire transfers are made. The
exchange may charge a fee per wire transfer to discourage
excessively frequent transfers. The binary is the
@code{taler-exchange-aggregator}.

@item 
`Closer':
The @code{taler-exchange-closer} tool check that reserves are properly
closed. If a customer wires funds to an exchange and then fails
to withdraw them, the closer will (eventually) trigger a wire
transfer that sends the customer’s funds back to the originating
wire account.

@item 
`Transfer':
The @code{taler-exchange-transfer} tool is responsible for actually
executing the aggregated wire transfers. It is the only process
that needs to have the credentials to execute outgoing wire
transfers.  The tool uses the Taler Wire Gateway API to execute
wire transfers.  This API is provided by the Taler Python Bank
for stand-alone deployments (like those with @code{KUDOS}) and
by LibEuFin.  LibEuFin is an adapter which maps the Taler Wire
REST API to traditional banking protocols like EBICS and FinTS.

@item 
`Wirewatch':
The @code{taler-exchange-wirewatch} tool is responsible for observing
incoming wire transfers to the exchange. It needs to have the
credentials to obtain a list of incoming wire transfers.
The tool also uses the Taler Wire Gateway API to observe such
incoming transfers.  It is possible that observing incoming and
making outgoing wire transfers is done via different bank accounts
and/or credentials.

@item 
`Wire adapter':
A wire adapter is a component that enables exchange to talk to a bank.
Each wire adapter must implement the Taler Wire Gateway API.  Three
wire adapters are currently provided:


@enumerate 

@item 
The `libtalerfakebank' implements a bank with a wire adapter API
inside of a testcase.  @code{taler-fakebank-run} is a stand-alone
process using libtalerfakebank.  Note that this adapter is only
useful for tests, as all transaction data is kept in memory.

@item 
For production, `libeufin'’s @code{libeufin-nexus} component
implements a wire adapter towards the traditional SEPA banking
system with IBAN accounts using the EBICS protocol.

@item 
To use GNU Taler with blockchains, the `Depolymerization'
component provides a wire gateway API that runs on top of
blockchains like Bitcoin and Ethereum.
@end enumerate

The client-side wire adapter API is implemented in `libtalerbank' and
is used by @code{taler-exchange-transfer} to execute wire transfers and by
@code{taler-exchange-wirewatch} and the Taler auditor auditor to query bank
transaction histories.

@item 
`DBMS':
The exchange requires a DBMS to stores the transaction history for
the Taler exchange and aggregator, and a (typically separate) DBMS
for the Taler auditor. For now, the GNU Taler reference implementation
only supports PostgreSQL, but the code could be easily extended to
support another DBMS.
.. index:: PostgreSQL

@item 
`Auditor':
The auditor verifies that the transactions performed by the exchange
were done properly. It checks the various signatures, totals up the
amounts and alerts the operator to any inconsistencies. It also
computes the expected bank balance, revenue and risk exposure of the
exchange operator. The main binary is the @code{taler-auditor}.
Aside from the key setup procedures, the most critical setup for
deploying an auditor is providing the auditor with an up-to-date
copy of the exchange’s database.
@end itemize

@node Key Types,Offline keys,Architecture overview,Introduction
@anchor{taler-exchange-manual key-types}@anchor{7}@anchor{taler-exchange-manual keytypes}@anchor{8}
@section Key Types


The exchange works with four types of keys:


@itemize -

@item 
master key (kept offline, configured manually at merchants and wallets)

@item 
online message signing keys (signs normal messages from the exchange)

@item 
denomination keys (signs digital coins)

@item 
security module keys (signs online message signing keys and denomination keys)
@end itemize

Additionally, the exchange is sometimes concerned with the auditor’s public
key (to verify messages signed by auditors approved by the exchange operator)
and the merchant’s public key (to verify refunds are authorized by the
merchant).

Most of the keys are managed fully automatically or configured as part of the
denomination configuration.  Some configuration settings must be manually
set with regards to the exchange’s master key.

@node Offline keys,Online signing key security,Key Types,Introduction
@anchor{taler-exchange-manual offline-keys}@anchor{9}
@section Offline keys


The exchange (and ideally also its auditor(s)) uses a long-term offline master
siging key that identifies the operator and is used to authenticate critical
information, such as the exchange’s bank account and the actual keys the
exchange uses online.

Interactions with the offline system are performed using the
@code{taler-exchange-offline} tool.  To use the offline system will require
exchange operators to copy JSON files from or to the offline system (say using
an USB stick).  The offline system does not need any significant amount of
computing power, a Raspberry-Pi is perfectly sufficient and the form-factor
might be good for safe-keeping! (You should keep a copy of the (encrypted)
private offline key on more than one physical medium though.)

Exchange operators are strongly advised to secure their private master key and
any copies on encrypted, always-offline computers. Again, this manual assumes
that you are familiar with good best practices in operational security,
including securing key material.

@node Online signing key security,,Offline keys,Introduction
@anchor{taler-exchange-manual online-signing-key-security}@anchor{a}
@section Online signing key security


To provide an additional level of protection for the private `online' signing
keys used by the exchange, the actual cryptographic signing operations are
performed by three helper processes, @code{taler-exchange-secmod-rsa},
@code{taler-exchange-secmod-cs} and @code{taler-exchange-secmod-eddsa}.

The current implementation does not yet support the use of a hardware security
module (HSM).  If you have such a device with adequate functionality and are
interested in Taler supporting it, please contact the developers for HSM
integration support.

@menu
* Functionality:: 
* Security goals:: 
* Setup:: 
* Configuration:: 

@end menu

@node Functionality,Security goals,,Online signing key security
@anchor{taler-exchange-manual functionality}@anchor{b}
@subsection Functionality


The UNIX domain sockets of the `secmod' helpers have mode 0620 (u+rw, g+w).
The exchange process MUST thus be in the same group as the crypto helper
processes to enable access to the keys. No other users should be in that
group!

The two helper processes will create the required private keys, and allow
anyone with access to the UNIX domain socket to sign arbitrary messages with
the keys or to inform them about a key being revoked.  The helper processes
are also responsible for deleting the private keys if their validity period
expires or if they are informed about a key having been revoked.

@node Security goals,Setup,Functionality,Online signing key security
@anchor{taler-exchange-manual security-goals}@anchor{c}
@subsection Security goals


From a security point of view, the helpers are designed to `only' make it
harder for an attacker who took control of the HTTP daemon’s account to
extract the private keys, limiting the attackers ability to creating
signatures to the duration of their control of that account.

@cartouche
@quotation Note 
In the future, the helper processes should additionally provide a mechanism
to track the total number of signatures they have made for the various keys.
@end quotation
@end cartouche

@node Setup,Configuration,Security goals,Online signing key security
@anchor{taler-exchange-manual setup}@anchor{d}
@subsection Setup


The helper processes should be run under a user ID that is separate from that
of the user running the main @code{taler-exchange-httpd} service.  To get any
security benefit from this, it is important that helpers run under a different
user ID than the main HTTP frontend. In fact, ideally, each helper should run
under its own user ID.  The @code{taler-exchange-httpd} service’s will securely
communicate with the helpers using UNIX domain sockets.

@node Configuration,,Setup,Online signing key security
@anchor{taler-exchange-manual configuration}@anchor{e}
@subsection Configuration


The helpers and the exchange HTTP service need both access to the same
configuration information.  Having divergent configurations may result in
run-time failures.  It is recommended that the configuration file (@code{-c}
option) is simply shared between all of the different processes, even though
they run as different system users. The configuration does not contain any
sensitive information.

@node Installation,Configuration Fundamentals,Introduction,Top
@anchor{taler-exchange-manual exchangeinstallation}@anchor{f}@anchor{taler-exchange-manual installation}@anchor{10}
@chapter Installation


Before installing a Taler exchange, please make sure that your system does not
have swap space enabled.  Swap space is a security risk that Taler does not
try to mitigate against.

We recommend the setup of offline signing keys to be done on a second machine that
does not have Internet access.

In this guide’s shell-session fragments, the command prompt shows two pieces
of information:


@itemize *

@item 
Who is performing the command
(@code{$user} vs @code{root}, and ending character @code{$} vs @code{#}).

@item 
Host where the command is supposed to be executed
(@code{exchange-offline} vs @code{exchange-online}).
It is possible to do the entire setup on one machine,
but we do not recommend this for security reasons.
@end itemize

@menu
* Before you start:: 
* Installing from source:: 
* Installing the GNU Taler binary packages on Debian:: 
* Installing the GNU Taler binary packages on Trisquel:: 
* Installing the GNU Taler binary packages on Ubuntu:: 
* Services@comma{} users@comma{} groups and file system hierarchy: Services users groups and file system hierarchy. 

@end menu

@node Before you start,Installing from source,,Installation
@anchor{taler-exchange-manual before-you-start}@anchor{11}
@section Before you start


To deploy this with a real bank, you need:

@quotation


@itemize *

@item 
IBAN of the bank account to use

@item 
BIC of the bank

@item 
EBICS host, user and partner IDs
@end itemize
@end quotation

Information to write down during the installation:

@quotation


@itemize *

@item 
LibEuFin Nexus superuser password

@item 
Taler facade base URL

@item 
exchange Nexus username and password
@end itemize
@end quotation

@node Installing from source,Installing the GNU Taler binary packages on Debian,Before you start,Installation
@anchor{taler-exchange-manual installing-from-source}@anchor{12}
@section Installing from source


The following instructions will show how to install libgnunetutil and
the GNU Taler exchange from source.

The package sources can be find in our
download directory@footnote{http://ftpmirror.gnu.org/taler/}.

@c This file is part of GNU TALER.
@c 
@c Copyright (C) 2014-2023 Taler Systems SA
@c 
@c TALER is free software; you can redistribute it and/or modify it under the
@c terms of the GNU Affero General Public License as published by the Free Software
@c Foundation; either version 2.1, or (at your option) any later version.
@c 
@c TALER is distributed in the hope that it will be useful, but WITHOUT ANY
@c WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
@c A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more details.
@c 
@c You should have received a copy of the GNU Affero General Public License along with
@c TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
@c 
@c @author Christian Grothoff

GNU Taler components version numbers follow the @code{MAJOR.MINOR.MICRO} format.
The general rule for compatibility is that @code{MAJOR} and @code{MINOR} must match.
Exceptions to this general rule are documented in the release notes.
For example, Taler merchant 1.3.0 should be compatible with Taler exchange 1.4.x
as the MAJOR version matches.  A MAJOR version of 0 indicates experimental
development, and you are expected to always run all of the `latest' releases
together (no compatibility guarantees).

First, the following packages need to be installed before we can compile the
backend:


@itemize -

@item 
“Sphinx RTD Theme” Python package aka @code{python3-sphinx-rtd-theme}
on Debian-based systems (for GNUnet documentation support, can be
omitted if GNUnet is configured with @code{--disable-documentation})

@item 
libsqlite3 >= 3.16.2

@item 
GNU libunistring >= 0.9.3

@item 
libcurl >= 7.26 (or libgnurl >= 7.26)

@item 
libqrencode >= 4.0.0 (Taler merchant only)

@item 
GNU libgcrypt >= 1.6 (1.10 or later highly recommended)

@item 
libsodium >= 1.0

@item 
libargon2 >= 20171227

@item 
libjansson >= 2.7

@item 
PostgreSQL >= 15, including libpq

@item 
GNU libmicrohttpd >= 0.9.71

@item 
GNUnet >= 0.20 (from source tarball@footnote{http://ftpmirror.gnu.org/gnunet/})

@item 
Python3 with @code{jinja2}
@end itemize

If you are on Debian stable or later, the following command may help you
install these dependencies:

@example
# apt-get install \
  libqrencode-dev \
  libsqlite3-dev \
  libltdl-dev \
  libunistring-dev \
  libsodium-dev \
  libargon2-dev \
  libcurl4-gnutls-dev \
  libgcrypt20-dev \
  libjansson-dev \
  libpq-dev \
  libmicrohttpd-dev \
  python3-jinja2 \
  postgresql-15
@end example

Before you install GNUnet, you must download and install the dependencies
mentioned in the previous section, otherwise the build may succeed, but could
fail to export some of the tooling required by GNU Taler.

On Ubuntu, you also need to install pkg-config, for example:

@example
$ apt-get install pkg-config
@end example

To install GNUnet, unpack the tarball and change
into the resulting directory, then proceed as follows:

@example
$ ./configure [--prefix=GNUNETPFX]
$ # Each dependency can be fetched from non standard locations via
$ # the '--with-<LIBNAME>' option. See './configure --help'.
$ make
# make install
# ldconfig
@end example

If you did not specify a prefix, GNUnet will install to @code{/usr/local},
which requires you to run the last step as @code{root}.
The @code{ldconfig} command (also run as @code{root}) makes the
shared object libraries (@code{.so} files)
visible to the various installed programs.

Please note that unlike most packages, if you want to run the @code{make check}
command, you should run it only `after' having done @code{make install}.  The
latter ensures that necessary binaries are copied to the right place.

In any case, if @code{make check} fails, please consider filing a
bug report with the Taler bug tracker@footnote{https://bugs.taler.net}.

There is no need to actually run a GNUnet peer to use the Taler merchant
backend – all the merchant needs from GNUnet is a number of headers and
libraries!

After installing GNUnet, unpack the GNU Taler exchange tarball,
change into the resulting directory, and proceed as follows:

@example
$ ./configure [--prefix=EXCHANGEPFX] \
              [--with-gnunet=GNUNETPFX]
$ # Each dependency can be fetched from non standard locations via
$ # the '--with-<LIBNAME>' option. See './configure --help'.
$ make
# make install
@end example

If you did not specify a prefix, the exchange will install to @code{/usr/local},
which requires you to run the last step as @code{root}.  You have to specify
@code{--with-gnunet=/usr/local} if you installed GNUnet to @code{/usr/local} in the
previous step.

Please note that unlike most packages, if you want to run the @code{make check}
command, you should run it only `after' having done @code{make install}.  The
latter ensures that necessary binaries are copied to the right place.

In any case, if @code{make check} fails, please consider filing a
bug report with the Taler bug tracker@footnote{https://bugs.taler.net}.

@node Installing the GNU Taler binary packages on Debian,Installing the GNU Taler binary packages on Trisquel,Installing from source,Installation
@anchor{taler-exchange-manual installing-the-gnu-taler-binary-packages-on-debian}@anchor{13}
@section Installing the GNU Taler binary packages on Debian


To install the GNU Taler Debian packages, first ensure that you have
the right Debian distribution. At this time, the packages are built for
Debian bookworm.

You need to add a file to import the GNU Taler packages. Typically,
this is done by adding a file @code{/etc/apt/sources.list.d/taler.list} that
looks like this:

@example
deb [signed-by=/etc/apt/keyrings/taler-systems.gpg] https://deb.taler.net/apt/debian bookworm main
@end example

Next, you must import the Taler Systems SA public package signing key
into your keyring and update the package lists:

@example
# wget -O /etc/apt/keyrings/taler-systems.gpg \
    https://taler.net/taler-systems.gpg
# apt update
@end example

@cartouche
@quotation Note 
You may want to verify the correctness of the Taler Systems SA key out-of-band.
@end quotation
@end cartouche

Now your system is ready to install the official GNU Taler binary packages
using apt.

To install the Taler exchange, you can now simply run:

@example
[root@@exchange-online]# apt install taler-exchange
@end example

Note that the package does not perform any configuration work except for
setting up the various users and the systemd service scripts. You still must
configure at least the database, HTTP reverse proxy (typically with TLS
certificates), denomination and fee structure, bank account, auditor(s),
offline signing and the terms of service.

On the offline system, you should run at least:

@example
[root@@exchange-offline]# apt install taler-exchange-offline
@end example

@node Installing the GNU Taler binary packages on Trisquel,Installing the GNU Taler binary packages on Ubuntu,Installing the GNU Taler binary packages on Debian,Installation
@anchor{taler-exchange-manual installing-the-gnu-taler-binary-packages-on-trisquel}@anchor{14}
@section Installing the GNU Taler binary packages on Trisquel


To install the GNU Taler Trisquel packages, first ensure that you have
the right Trisquel distribution. Packages are currently available for
Trisquel GNU/Linux 10.0.  Simply follow the same instructions provided
for Ubuntu.

@node Installing the GNU Taler binary packages on Ubuntu,Services users groups and file system hierarchy,Installing the GNU Taler binary packages on Trisquel,Installation
@anchor{taler-exchange-manual installing-the-gnu-taler-binary-packages-on-ubuntu}@anchor{15}
@section Installing the GNU Taler binary packages on Ubuntu


To install the GNU Taler Ubuntu packages, first ensure that you have
the right Ubuntu distribution. At this time, the packages are built for
Ubuntu Lunar and Ubuntu Jammy. Make sure to have @code{universe} in your
@code{/etc/apt/sources.list} (after @code{main}) as we depend on some packages
from Ubuntu @code{universe}.

A typical @code{/etc/apt/sources.list.d/taler.list} file for this setup
would look like this for Ubuntu Lunar:

@example
deb [signed-by=/etc/apt/keyrings/taler-systems.gpg] https://deb.taler.net/apt/ubuntu/ lunar taler-lunar
@end example

For Ubuntu Jammy use this instead:

@example
deb [signed-by=/etc/apt/keyrings/taler-systems.gpg] https://deb.taler.net/apt/ubuntu/ jammy taler-jammy
@end example

The last line is crucial, as it adds the GNU Taler packages.

Next, you must import the Taler Systems SA public package signing key
into your keyring and update the package lists:

@example
# wget -O /etc/apt/keyrings/taler-systems.gpg \
    https://taler.net/taler-systems.gpg
# apt update
@end example

@cartouche
@quotation Note 
You may want to verify the correctness of the Taler Systems key out-of-band.
@end quotation
@end cartouche

Now your system is ready to install the official GNU Taler binary packages
using apt.

To install the Taler exchange, you can now simply run:

@example
[root@@exchange-online]# apt install taler-exchange
@end example

Note that the package does not perform any configuration work except for
setting up the various users and the systemd service scripts. You still must
configure at least the database, HTTP reverse proxy (typically with TLS
certificates), denomination and fee structure, bank account, auditor(s),
offline signing and the terms of service.

On the offline system, you should run at least:

@example
[root@@exchange-offline]# apt install taler-exchange-offline
@end example

@node Services users groups and file system hierarchy,,Installing the GNU Taler binary packages on Ubuntu,Installation
@anchor{taler-exchange-manual services-users-groups-and-file-system-hierarchy}@anchor{16}
@section Services, users, groups and file system hierarchy


The `taler-exchange' package will create several system users
to compartmentalize different parts of the system:


@itemize *

@item 
@code{taler-exchange-httpd}: runs the HTTP daemon with the core business logic.

@item 
@code{taler-exchange-secmod-rsa}: manages the RSA private online signing keys.

@item 
@code{taler-exchange-secmod-cs}: manages the CS private online signing keys.

@item 
@code{taler-exchange-secmod-eddsa}: manages the EdDSA private online signing keys.

@item 
@code{taler-exchange-closer}: closes idle reserves by triggering wire transfers that refund the originator.

@item 
@code{taler-exchange-aggregator}: aggregates deposits into larger wire transfer requests.

@item 
@code{taler-exchange-transfer}: performs wire transfers with the bank (via LibEuFin/Nexus).

@item 
@code{taler-exchange-wirewatch}: checks for incoming wire transfers with the bank (via LibEuFin/Nexus).

@item 
@code{postgres}: runs the PostgreSQL database (from `postgresql' package).

@item 
@code{www-data}: runs the frontend HTTPS service with the TLS keys (from `nginx' package).
@end itemize

@cartouche
@quotation Note 
The `taler-merchant' package additionally creates a @code{taler-merchant-httpd} user
to run the HTTP daemon with the merchant business logic.
@end quotation
@end cartouche

The exchange setup uses the following system groups:


@itemize *

@item 
@code{taler-exchange-db}: group for all Taler users with direct database access, specifically taler-exchange-httpd, taler-exchange-wirewatch, taler-exchange-closer and taler-exchange-aggregator.

@item 
@code{taler-exchange-secmod}: group for processes with access to online signing keys; this group must have four users: taler-exchange-secmod-rsa, taler-exchange-secmod-cs, taler-exchange-secmod-eddsa and taler-exchange-httpd.

@item 
@code{taler-exchange-offline}: group for the access to the offline private key (only used on the offline host and not used on the online system).
@end itemize

The package will deploy systemd service files in
@code{/usr/lib/systemd/system/} for the various components:


@itemize *

@item 
@code{taler-exchange-aggregator.service}: service that schedules wire transfers
which combine multiple deposits to the same merchant.

@item 
@code{taler-exchange-closer.service}: service that watches for reserves that have been abandoned and schedules wire transfers to send the money back to the originator.

@item 
@code{taler-exchange-httpd.service}: main Taler exchange logic with the public REST API.

@item 
@code{taler-exchange-httpd.socket}: systemd socket activation for the Taler exchange HTTP daemon.

@item 
@code{taler-exchange-secmod-eddsa.service}: software security module for making EdDSA signatures.

@item 
@code{taler-exchange-secmod-rsa.service}: software security module for making RSA signatures.

@item 
@code{taler-exchange-secmod-cs.service}: software security module for making CS signatures.

@item 
@code{taler-exchange-transfer.service}: service that triggers outgoing wire transfers (pays merchants).

@item 
@code{taler-exchange-wirewatch.service}: service that watches for incoming wire transfers (first step of withdraw).

@item 
@code{taler-exchange.target}: Main target for the Taler exchange to be operational.
@end itemize

The deployment creates the following key locations in the system:


@itemize *

@item 
@code{/etc/taler/}: configuration files.

@item 
@code{/run/taler/}: contains the UNIX domain sockets for inter-process communication (IPC).

@item 
@code{/var/lib/taler/}: serves as the $HOME for all Taler users and contains sub-directories
with the private keys; which keys are stored here depends on the host:


@itemize *

@item 
online system: exchange-secmod-eddsa, exchange-secmod-cs and exchange-secmod-rsa keys.

@item 
offline system: exchange-offline keys.
@end itemize
@end itemize

@node Configuration Fundamentals,Exchange Database Setup,Installation,Top
@anchor{taler-exchange-manual configuration-fundamentals}@anchor{17}
@chapter Configuration Fundamentals


This chapter provides fundamental details about the exchange configuration.

The configuration for all Taler components uses a single configuration file
as entry point: @code{/etc/taler/taler.conf}.

System defaults are automatically loaded from files in
@code{/usr/share/taler/config.d}.  These default files should never be modified.

The default configuration @code{taler.conf} configuration file also includes all
configuration files in @code{/etc/taler/conf.d}.  The settings from files in
@code{conf.d} are only relevant to particular components of Taler, while
@code{taler.conf} contains settings that affect all components.

The directory @code{/etc/taler/secrets} contains configuration file snippets with
values that should only be readable to certain users.  They are included with the @code{@@inline-secret@@}
directive and should end with @code{.secret.conf}.

To view the entire configuration annotated with the source of each configuration option, you
can use the @code{taler-config} helper:

@example
[root@@exchange-online]# taler-config --diagnostics
< ... annotated, full configuration ... >
@end example

@cartouche
@quotation Warning 
While @code{taler-config} also supports rewriting configuration files, we strongly
recommend to edit configuration files manually, as @code{taler-config} does not
preserve comments and, by default, rewrites @code{/etc/taler/taler.conf}.
@end quotation
@end cartouche

@menu
* Configuration format:: 

@end menu

@node Configuration format,,,Configuration Fundamentals
@anchor{taler-exchange-manual configuration-format}@anchor{18}
@section Configuration format


All GNU Taler components are designed to possibly share the same
configuration files.  When installing a GNU Taler component, the
installation deploys default values in configuration files located
at $@{prefix@}/share/taler/config.d/ where $@{prefix@} is the installation
prefix. Different components must be installed to the same prefix.

In order to override these defaults, the user can write a custom configuration
file and either pass it to the component at execution time using the `-c'
option, or name it taler.conf and place it under $HOME/.config/ which is where
components will look by default. Note that the systemd service files pass @code{-c
/etc/taler/taler.conf}, thus making @code{/etc/taler/taler.conf}
the primary location for the configuration.

A config file is a text file containing sections, and each section
contains maps options to their values.  Configuration files follow
basically the INI syntax:

@example
[section1]
value1 = string
value2 = 23

[section2]
value21 = string
value22 = /path22
@end example

Comments start with a hash (@code{#}).  Throughout the configuration, it is
possible to use @code{$}-substitution for options relating to names of files or
directories. It is also possible to provide defaults values for those
variables that are unset, by using the following syntax:
@code{$@{VAR:-default@}}. There are two ways a user can set the value
of @code{$}-prefixable variables:

@quotation


@enumerate 

@item 
by defining them under a @code{[paths]} section:
@end enumerate

@quotation

@example
[paths]
TALER_DEPLOYMENT_SHARED = $@{HOME@}/shared-data
..
[section-x]
path-x = $@{TALER_DEPLOYMENT_SHARED@}/x
@end example
@end quotation


@enumerate 2

@item 
or by setting them in the environment:
@end enumerate

@quotation

@example
$ export VAR=/x
@end example
@end quotation
@end quotation

The configuration loader will give precedence to variables set under
@code{[path]} over environment variables.

The utility @code{taler-config}, which gets installed along with the exchange,
can be used get and set configuration values without directly editing the
configuration file. The option @code{-f} is particularly useful to resolve
pathnames, when they use several levels of @code{$}-expanded variables. See
@code{taler-config --help}.

The repository @code{git://git.taler.net/deployment} contains example code
for generating configuration files under @code{deployment/netzbon/}.

@node Exchange Database Setup,Basic Setup Currency Denominations and Keys,Configuration Fundamentals,Top
@anchor{taler-exchange-manual exchange-database-setup}@anchor{19}
@chapter Exchange Database Setup


The access credentials for the exchange’s database are configured in
@code{/etc/taler/secrets/exchange-db.secret.conf}.  Currently, only PostgreSQL is
supported as a database backend.

The following users must have access to the exchange database:


@itemize *

@item 
taler-exchange-httpd

@item 
taler-exchange-wire

@item 
taler-exchange-aggregator

@item 
taler-exchange-closer
@end itemize

These users are all in the taler-exchange-db group, and the
@code{exchange-db.secret.conf} should be only readable by users in
this group.

@cartouche
@quotation Note 
The `taler-exchange-dbconfig' tool can be used to automate the database
setup. When using the Debian/Ubuntu packages, the users should already have
been created, so you can just run the tool without any arguments and should
have a working database configuration. The rest of this section only
explains what the `taler-exchange-dbconfig' shell script fully automates.
@end quotation
@end cartouche

To create a database for the Taler exchange on the local system, run:

@example
[root@@exchange-online]# su - postgres
[postgres@@exchange-online]# createuser taler-exchange-httpd
[postgres@@exchange-online]# createuser taler-exchange-wire
[postgres@@exchange-online]# createuser taler-exchange-aggregator
[postgres@@exchange-online]# createuser taler-exchange-closer
[postgres@@exchange-online]# createdb -O taler-exchange-httpd taler-exchange
[postgres@@exchange-online]# exit
@end example

This will create a @code{taler-exchange} database owned by the
@code{taler-exchange-httpd} user.  We will use that user later to perform
database maintenance operations.

Assuming the above database setup, the database credentials to configure
in the configuration file would simply be:


@float LiteralBlock

@caption{/etc/taler/secrets/exchange-db.secret.conf}

@example
[exchange]
DB = postgres

[exchangedb-postgres]
CONFIG=postgres:///taler-exchange
@end example

@end float


If the database is run on a different host, please follow the instructions
from the PostgreSQL manual for configuring remote access.

After configuring the database credentials, the exchange database needs
to be initialized with the following command:

@example
[root@@exchange-online]# sudo -u taler-exchange-httpd taler-exchange-dbinit

..note::

  To run this command, the user must have `@w{`}CREATE TABLE`@w{`}, `@w{`}CREATE
  INDEX`@w{`}, `@w{`}ALTER TABLE`@w{`} and (in the future possibly even) `@w{`}DROP TABLE`@w{`}
  permissions.  Those permissions are only required for this step (which may
  have to be repeated when upgrading a deployment).  Afterwards, during
  normal operation, permissions to `@w{`}CREATE`@w{`} or `@w{`}ALTER`@w{`} tables are not
  required by any of the Taler exchange processes and thus should not be
  granted.  For more information, see
  :doc:`manpages/taler-exchange-dbinit.1`.
@end example

Finally we need to grant the other accounts limited access:

@example
[root@@exchange-online]# sudo -u taler-exchange-httpd bash
[taler-exchange-httpd@@exchange-online]# echo 'GRANT SELECT,INSERT,UPDATE ON ALL TABLES IN SCHEMA exchange TO "taler-exchange-aggregator";' \
  | psql taler-exchange
[taler-exchange-httpd@@exchange-online]# echo 'GRANT SELECT,INSERT,UPDATE ON ALL TABLES IN SCHEMA exchange TO "taler-exchange-closer";' \
  | psql taler-exchange
[taler-exchange-httpd@@exchange-online]# echo 'GRANT SELECT,INSERT,UPDATE ON ALL TABLES IN SCHEMA exchange TO "taler-exchange-wire";' \
  | psql taler-exchange
[taler-exchange-httpd@@exchange-online]# echo 'GRANT USAGE ON ALL SEQUENCES IN SCHEMA exchange TO "taler-exchange-aggregator";' \
  | psql taler-exchange
[taler-exchange-httpd@@exchange-online]# echo 'GRANT USAGE ON ALL SEQUENCES IN SCHEMA exchange TO "taler-exchange-closer";' \
  | psql taler-exchange
[taler-exchange-httpd@@exchange-online]# echo 'GRANT USAGE ON ALL SEQUENCES IN SCHEMA exchange TO "taler-exchange-wire";' \
  | psql taler-exchange
[taler-exchange-httpd@@exchange-online]# exit
@end example

@cartouche
@quotation Note 
The above instructions for changing database permissions only work `after'
having initialized the database with @code{taler-exchange-dbinit}, as
the tables need to exist before permissions can be granted on them. The
@code{taler-exchange-dbinit} tool cannot setup these permissions, as it
does not know which users will be used for which processes.
@end quotation
@end cartouche

@node Basic Setup Currency Denominations and Keys,Wire Gateway Setup,Exchange Database Setup,Top
@anchor{taler-exchange-manual basic-setup-currency-denominations-and-keys}@anchor{1a}
@chapter Basic Setup: Currency, Denominations and Keys


A Taler exchange only supports a single currency.  The currency
and the smallest currency unit supported by the bank system
must be specified in @code{/etc/taler/taler.conf}.


@float LiteralBlock

@caption{/etc/taler/taler.conf}

@example
 [taler]
 CURRENCY = EUR
 CURRENCY_ROUND_UNIT = EUR:0.01

 # ... rest of file ...
@end example

@end float


@cartouche
@quotation Warning 
@quotation

When editing @code{/etc/taler/taler.conf}, take care to not accidentally remove
the @code{@@inline-matching@@} directive to include the configuration files in @code{conf.d}.
@end quotation
@anchor{taler-exchange-manual coins-denomination-keys}@anchor{1b}
@end quotation
@end cartouche

@menu
* Coins (denomination keys): Coins denomination keys. 
* Sign keys:: 
* Setting up the offline signing key:: 

@end menu

@node Coins denomination keys,Sign keys,,Basic Setup Currency Denominations and Keys
@anchor{taler-exchange-manual id1}@anchor{1c}
@section Coins (denomination keys)


Next, the electronic cash denominations that the exchange offers must be
specified.

Sections specifying denomination (coin) information start with @code{coin_}.  By
convention, the name continues with @code{$CURRENCY_[$SUBUNIT]_$VALUE_$REVISION},
i.e. @code{[coin_eur_ct_10_0]} for a 10 cent piece. However, only the @code{coin_}
prefix is mandatory.  Once configured, these configuration values must not
change.  The @code{$REVISION} part of the section name should be incremented if
any of the coin attributes in the section changes.  Each @code{coin_}-section
must then have the following options:


@itemize -

@item 
@code{VALUE}: How much is the coin worth, the format is
CURRENCY:VALUE.FRACTION. For example, a 10 cent piece is “EUR:0.10”.

@item 
@code{DURATION_WITHDRAW}: How long can a coin of this type be withdrawn?
This limits the losses incurred by the exchange when a denomination
key is compromised.

@item 
@code{DURATION_SPEND}: How long is a coin of the given type valid? Smaller
values result in lower storage costs for the exchange.

@item 
@code{DURATION_LEGAL}: How long is the coin of the given type legal?

@item 
@code{FEE_WITHDRAW}: What does it cost to withdraw this coin? Specified
using the same format as value.

@item 
@code{FEE_DEPOSIT}: What does it cost to deposit this coin? Specified using
the same format as value.

@item 
@code{FEE_REFRESH}: What does it cost to refresh this coin? Specified using
the same format as value.

@item 
@code{FEE_REFUND}: What does it cost to refund this coin?
Specified using the same format as value.

@item 
@code{CIPHER}: Which cipher to use for this coin? Must be either @code{RSA} or
@code{CS}.

@item 
@code{RSA_KEYSIZE}: How many bits should the RSA modulus (product of the two
primes) have for this type of coin.

@item 

@table @asis

@item @code{AGE_RESTRICTED}: Set to @code{YES} to make this a denomination with support

for age restrictions. See age restriction extension below for details.
This option is optional and defaults to @code{NO}.
@end table
@end itemize

See manpages/taler.conf.5 for information on `duration' values
(i.e. @code{DURATION_WITHDRAW} and @code{DURATION_SPEND} above,
and @code{OVERLAP_DURATION} and @code{DURATION} below).
Additionally, there are two global configuration options of note:


@itemize -

@item 
@code{[taler-exchange-secmod-rsa/OVERLAP_DURATION]}: What is the overlap of the
withdrawal timespan for denomination keys?  The value given here must
be smaller than any of the @code{DURATION_WITHDRAW} values for any of the coins.

@item 
@code{[taler-exchange-secmod-rsa/LOOKAHEAD_SIGN]}: For how far into the future
should denomination keys be pre-generated?  This allows the exchange and
auditor operators to download, offline-sign, and upload denomination key
signatures for denomination keys that will be used in the future by the
exchange.
@end itemize

@geindex maintenance

@cartouche
@quotation Note 
We recommend setting the @code{LOOKAHEAD_SIGN} value to at least one year and
then to perform the offline-signing procedure at least once every 6 months
to ensure that there is sufficient time for wallets to learn the new keys
and to avoid unavailability in case this critical maintenance procedure is
delayed.
@end quotation
@end cartouche

@cartouche
@quotation Note 
It is crucial that the configuration provided in these sections is identical (!)
for the exchange and the crypto helpers.  We recommend pointing both users
to the same configuration file!
@end quotation
@end cartouche

The @code{taler-wallet-cli} has a helper command that generates a
reasonable denomination structure.

@example
[root@@exchange-online]# taler-wallet-cli deployment gen-coin-config \
                          --min-amount EUR:0.01 \
                          --max-amount EUR:100 \
                          > /etc/taler/conf.d/exchange-coins.conf
@end example

You can manually review and edit the generated configuration file. The main
change that is possibly required is updating the various fees.  Note that you
MUST NOT edit a coin configuration section after the initial setup. If you
must @code{change} the values, you must instead create a new section with a
different unique name (still with the @code{coin-} prefix) and comment out or
remove the existing section.  Do take care to not introduce the name of the
disabled section again in the future.

@node Sign keys,Setting up the offline signing key,Coins denomination keys,Basic Setup Currency Denominations and Keys
@anchor{taler-exchange-manual id2}@anchor{1d}@anchor{taler-exchange-manual sign-keys}@anchor{1e}
@section Sign keys


There are three global configuration options of note for sign keys:


@itemize -

@item 
@code{[taler-exchange-secmod-eddsa/DURATION]}: How long are sign keys
used to sign messages? After this time interval expires, a fresh
sign key will be used (key rotation).  We recommend using
a @code{DURATION} of a few weeks to a few months for sign keys.

@item 
@code{[taler-exchange-secmod-eddsa/OVERLAP_DURATION]}: What is the overlap of the
timespan for sign keys?  We recommend a few minutes or hours.  Must
be smaller than @code{DURATION}.

@item 
@code{[taler-exchange-secmod-eddsa/LOOKAHEAD_SIGN]}: For how far into the future
should sign keys be pre-generated?  This allows the exchange and
auditor operators to download, offline-sign, and upload sign key
signatures for sign keys that will be used in the future by the exchange.
@end itemize

@cartouche
@quotation Note 
We recommend setting the @code{LOOKAHEAD_SIGN} value to at least one year and
then to perform the offline-signing procedure at least once every 6 months
to ensure that there is sufficient time for wallets to learn the new keys
and to avoid unavailability in case this critical maintenance procedure is
delayed.
@end quotation
@end cartouche

@node Setting up the offline signing key,,Sign keys,Basic Setup Currency Denominations and Keys
@anchor{taler-exchange-manual offlineconfiguration}@anchor{1f}@anchor{taler-exchange-manual setting-up-the-offline-signing-key}@anchor{20}
@section Setting up the offline signing key


Before launching an exchange, the offline signing (master) key must be
generated and set in the configuration.  The offline signing keys of the
exchange should be stored on a different machine.  The responsibilities of
this offline signing machine are:


@itemize *

@item 
Generation of the exchange’s offline master signing key.

@item 
Secure storage of the exchange’s offline master signing key.

@item 
Generation of certificates (signed with the offline master signing key) that will be imported by the exchange.

@item 
Revocation of keys when the online system was compromised or is being terminated
@end itemize

Configuration file options related to the master key are:


@itemize -

@item 

@table @asis

@item @code{[exchange-offline/MASTER_PRIV_FILE]}: Path to the exchange’s master

private file.  Only needs to be provided on the offline system where the
@code{taler-exchange-offline} command is used.  The default value is usually
fine and does not require adjustment.
@end table

@item 

@table @asis

@item @code{[exchange/MASTER_PUBLIC_KEY]}: Must specify the exchange’s master public

key.  Needed for the exchange to verify information signed by the offline
system.  This value must almost always be set explicitly by hand.
@end table
@end itemize

@example
[root@@exchange-offline]# taler-exchange-offline setup
< ... prints the exchange master public key >
@end example

The public key printed as the output of this command must be put into the
configuration of the online machine:


@float LiteralBlock

@caption{/etc/taler/conf.d/exchange-business.conf}

@example
 [exchange]
 MASTER_PUBLIC_KEY = YE6Q6TR1ED...

 # ... rest of file ...
@end example

@end float


@node Wire Gateway Setup,Legal Setup,Basic Setup Currency Denominations and Keys,Top
@anchor{taler-exchange-manual wire-gateway-setup}@anchor{21}
@chapter Wire Gateway Setup


The Taler Wire Gateway is an API that
connects the Taler exchange to the underlying core banking system.  There are
several implementations of wire gateways:

@quotation


@itemize *

@item 
Project deploymerization@footnote{https://git.taler.net/depolymerization.git} implements a wire gateway on top of Bitcoin or Ethereum

@item 
The libeufin-bank provides a wire gateway interface on top of a regional currency bank

@item 
The `taler-fakebank-run' command is an in-memory bank simulator with a wire gateway interface for testing
@end itemize
@end quotation

@c FIXME :ref:`libeufin-nexus <libeufin-nexus>` is an implementation of the Wire Gateway API for the EBICS protocol. Add to list above once nexus implements the TWG directly!

Before continuing, you need to decide which wire gateway you want to use,
and install and configure it on your system.  Afterwards, you need to
have two key pieces of information from that setup:

@quotation


@itemize *

@item 
The username and password to access the exchange’s account in the system.

@item 
The @code{payto://} URI of that account (see RFC 8905@footnote{https://www.rfc-editor.org/rfc/rfc8905}).
@end itemize
@end quotation

@menu
* Exchange Bank Account Configuration:: 

@end menu

@node Exchange Bank Account Configuration,,,Wire Gateway Setup
@anchor{taler-exchange-manual exchange-bank-account-configuration}@anchor{22}@anchor{taler-exchange-manual id3}@anchor{23}
@section Exchange Bank Account Configuration


An exchange must be configured with the right settings to access its bank
account via a Taler wire gateway.  An
exchange can be configured to use multiple bank accounts by using multiple
wire gateways.  Typically only one wire gateway is used.

To configure a bank account in Taler, we need to furnish two pieces of
information:


@itemize -

@item 
The @code{payto://} URI of the bank account, which uniquely idenfies the
account. Examples for such URIs include
@code{payto://iban/CH9300762011623852957} for a bank account with
an IBAN or
@code{payto://x-taler-bank/localhost:8080/2} for the 2nd bank account a
the Taler bank demonstrator running at @code{localhost} on port 8080.
The first part of the URI following @code{payto://} (@code{iban} or
@code{x-taler-bank}) is called the wire method.

@item 
The @code{taler-exchange-wirewatch} and @code{taler-exchange-transfer}
tools needs to be provided resources for authentication
to the respective banking service. The format in which the
authentication information is currently a username and password
for HTTP basic authentication.
@end itemize

Each Taler wire gateway is configured in a configuration section that follows
the pattern @code{exchange-account-$id}, where @code{$id} is an internal identifier
for the bank account accessed by the exchange.  The basic information for an
account should be put in @code{/etc/taler/conf.d/exchange-business.conf}.  The
secret credentials to access the Taler Wire Gateway API should be put into a
corresponding @code{exchange-accountcredentials-$id} section in
@code{/etc/taler/secrets/exchange-accountcredentials.conf}.  The latter file
should be only readable for the @code{taler-exchange-wire} user.  Only the
@code{taler-exchange-wirewatch} and @code{taler-exchange-transfer} services should
run as the @code{taler-exchange-wire} user.  Other exchange processes do not need
to have access to the account credentials.

You can configure multiple accounts for an exchange by creating sections
starting with @code{exchange-account-} for the section name. You must specify
@code{ENABLE_}-settings for each account whether it should be used, and for what
(incoming or outgoing wire transfers):


@float LiteralBlock

@caption{/etc/taler/conf.d/exchange-business.conf}

@example
[exchange-account-1]
# Account identifier in the form of an RFC-8905 payto:// URI.
# For SEPA, looks like payto://iban/$IBAN?receiver-name=$NAME
# Make sure to URL-encode spaces in $NAME!
#
# With x-taler-bank (for Fakebank)
# PAYTO_URI = "payto://x-taler-bank/bank.demo.taler.net/Exchange?receiver-name=exop"
#
# Example using IBAN (for use with LibEuFin)
PAYTO_URI = "payto://iban/CH9300762011623852957?receiver=name=exop"

# URL for talking to the bank wire the wire API.
WIRE_GATEWAY_URL = https://bank.demo.taler.net/taler-wire-gateway/Exchange

# Use for exchange-aggregator (outgoing transfers)
ENABLE_DEBIT = YES
# Use for exchange-wirewatch (and listed in /wire)
ENABLE_CREDIT = YES

@@inline-secret@@ exchange-accountcredentials-1 ../secrets/exchange-accountcredentials.secret.conf
@end example

@end float



@float LiteralBlock

@caption{/etc/taler/secrets/exchange-accountcredentials.secret.conf}

@example
[exchange-accountcredentials-1]

# LibEuFin expects basic auth.
WIRE_GATEWAY_AUTH_METHOD = basic

# Username and password to access the Taler wire gateway.
USERNAME = ...
PASSWORD = ...

# Base URL of the Taler wire gateway.
WIRE_GATEWAY_URL = ...
@end example

@end float


Such a wire gateway configuration can be tested with the following commands:

@example
[root@@exchange-online]# taler-exchange-wire-gateway-client \
  --section exchange-accountcredentials-1 --debit-history
[root@@exchange-online]# taler-exchange-wire-gateway-client \
  --section exchange-accountcredentials-1 --credit-history
@end example

On success, you will see some of your account’s transaction history (or an
empty history), while on failure you should see an error message.

@node Legal Setup,KYC Configuration,Wire Gateway Setup,Top
@anchor{taler-exchange-manual legal-setup}@anchor{24}@anchor{taler-exchange-manual legalsetup}@anchor{25}
@chapter Legal Setup


This chapter describes how to setup certain legal aspects of a GNU Taler
exchange. Users that just want to set up an exchange as an experiment without
legal requirements can safely skip these steps.

@menu
* Legal conditions for using the service:: 
* Terms of Service:: 
* Privacy Policy:: 
* Legal policies directory layout:: 
* Generating the Legal Terms:: 
* Adding translations:: 
* Updating legal documents:: 

@end menu

@node Legal conditions for using the service,Terms of Service,,Legal Setup
@anchor{taler-exchange-manual legal-conditions-for-using-the-service}@anchor{26}
@section Legal conditions for using the service


@c This file is part of GNU TALER.
@c 
@c Copyright (C) 2014-2023 Taler Systems SA
@c 
@c TALER is free software; you can redistribute it and/or modify it under the
@c terms of the GNU Affero General Public License as published by the Free Software
@c Foundation; either version 2.1, or (at your option) any later version.
@c 
@c TALER is distributed in the hope that it will be useful, but WITHOUT ANY
@c WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
@c A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more details.
@c 
@c You should have received a copy of the GNU Affero General Public License along with
@c TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
@c 
@c @author Christian Grothoff

The service has well-known API endpoints to return its legal conditions to the
user in various languages and various formats.  This section describes how to
setup and configure the legal conditions.

@node Terms of Service,Privacy Policy,Legal conditions for using the service,Legal Setup
@anchor{taler-exchange-manual terms-of-service}@anchor{27}
@section Terms of Service


The service has an endpoint “/terms” to return the terms of service (in legal
language) of the service operator.  Client software show these terms of
service to the user when the user is first interacting with the service.
Terms of service are optional for experimental deployments, if none are
configured, the service will return a simple statement saying that there are
no terms of service available.

To configure the terms of service response, there are two options
in the configuration file for the service:


@itemize -

@item 
@code{TERMS_ETAG}: The current “Etag” to return for the terms of service.
This value must be changed whenever the terms of service are
updated. A common value to use would be a version number.
Note that if you change the @code{TERMS_ETAG}, you MUST also provide
the respective files in @code{TERMS_DIR} (see below).

@item 
@code{TERMS_DIR}: The directory that contains the terms of service.
The files in the directory must be readable to the service
process.
@end itemize

@node Privacy Policy,Legal policies directory layout,Terms of Service,Legal Setup
@anchor{taler-exchange-manual privacy-policy}@anchor{28}
@section Privacy Policy


The service has an endpoint “/pp” to return the terms privacy policy (in legal
language) of the service operator.  Clients should show the privacy policy to
the user when the user explicitly asks for it, but it should not be shown by
default.  Privacy policies are optional for experimental deployments, if none
are configured, the service will return a simple statement saying that there
is no privacy policy available.

To configure the privacy policy response, there are two options
in the configuration file for the service:


@itemize -

@item 
@code{PRIVACY_ETAG}: The current “Etag” to return for the privacy policy.
This value must be changed whenever the privacy policy is
updated. A common value to use would be a version number.
Note that if you change the @code{PRIVACY_ETAG}, you MUST also provide
the respective files in @code{PRIVACY_DIR} (see below).

@item 
@code{PRIVACY_DIR}: The directory that contains the privacy policy.
The files in the directory must be readable to the service
process.
@end itemize

@node Legal policies directory layout,Generating the Legal Terms,Privacy Policy,Legal Setup
@anchor{taler-exchange-manual legal-policies-directory-layout}@anchor{29}
@section Legal policies directory layout


The @code{TERMS_DIR} and @code{PRIVACY_DIR} directory structures must follow a
particular layout.  You may use the same directory for both the terms of
service and the privacy policy, as long as you use different ETAGs.  Inside of
the directory, there should be sub-directories using two-letter language codes
like “en”, “de”, or “jp”.  Each of these directories would then hold
translations of the current terms of service into the respective language.
Empty directories are permitted in case translations are not available.

Then, inside each language directory, files with the name of the value set as
the @code{TERMS_ETAG} or @code{PRIVACY_ETAG} must be provided. The extension of each
of the files should be typical for the respective mime type.  The set of
supported mime types is currently hard-coded in the service, and includes
“.epub”, “.html”, “.md”, “.pdf” and “.txt” files. If other files are present,
the service may show a warning on startup.

@menu
* Example:: 

@end menu

@node Example,,,Legal policies directory layout
@anchor{taler-exchange-manual example}@anchor{2a}
@subsection Example


A sample file structure for a @code{TERMS_ETAG} of “tos-v0” would be:


@itemize -

@item 
TERMS_DIR/en/tos-v0.txt

@item 
TERMS_DIR/en/tos-v0.html

@item 
TERMS_DIR/en/tos-v0.pdf

@item 
TERMS_DIR/en/tos-v0.epub

@item 
TERMS_DIR/en/tos-v0.md

@item 
TERMS_DIR/de/tos-v0.txt

@item 
TERMS_DIR/de/tos-v0.html

@item 
TERMS_DIR/de/tos-v0.pdf

@item 
TERMS_DIR/de/tos-v0.epub

@item 
TERMS_DIR/de/tos-v0.md
@end itemize

If the user requests an HTML format with language preferences “fr” followed by
“en”, the service would return @code{TERMS_DIR/en/tos-v0.html} lacking a version in
French.

@node Generating the Legal Terms,Adding translations,Legal policies directory layout,Legal Setup
@anchor{taler-exchange-manual generating-the-legal-terms}@anchor{2b}
@section Generating the Legal Terms


The @code{taler-terms-generator} script can be used to generate directories with
terms of service and privacy policies in multiple languages and all required
data formats from a single source file in @code{.rst} format and GNU gettext
translations in @code{.po} format.

To use the tool, you need to first write your legal conditions in English in
reStructuredText (rst).  You should find a templates in
@code{$PREFIX/share/terms/*.rst} where @code{$PREFIX} is the location where you
installed the service to. Whenever you make substantive changes to the legal
terms, you must use a fresh filename and change the respective @code{ETAG}.  The
resulting file must be called @code{$ETAG.rst} and the first line of the file should be the title of the document.

Once you have written the @code{$ETAG.rst} file in English, you can
generate the first set of outputs:

@example
$ taler-terms-generator -i $ETAG
@end example

Afterwards, you should find the terms in various formats for all configured
languages (initially only English) in @code{$PREFIX/share/terms/}.  The generator
has a few options which are documented in its man page.

@node Adding translations,Updating legal documents,Generating the Legal Terms,Legal Setup
@anchor{taler-exchange-manual adding-translations}@anchor{2c}
@section Adding translations


Translations must be available in subdirectories
@code{locale/$LANGUAGE/LC_MESSAGES/$ETAG.po}.
To start translating, you first need to add a new
language:

@example
$ taler-terms-generator -i $ETAG -l $LANGUAGE
@end example

Here, @code{$LANGUAGE} should be a two-letter language
code like @code{de} or @code{fr}.  The command will generate
a file @code{locale/$LANGUAGE/LC_MESSAGES/$ETAG.po}
which contains each English sentence or paragraph
in the original document and an initially empty
translation.  Translators should update the @code{.po}
file. Afterwards, simply re-run

@example
$ taler-terms-generator -i $ETAG
@end example

to make the current translation(s) available to the
service.

@cartouche
@quotation Note 
You must restart the service whenever adding or updating legal documents or their translations.
@end quotation
@end cartouche

@node Updating legal documents,,Adding translations,Legal Setup
@anchor{taler-exchange-manual updating-legal-documents}@anchor{2d}
@section Updating legal documents


When making minor changes without legal implications, edit the @code{.rst} file,
then re-run the step to add a new language for each existing translation to
produce an updated @code{.po} file. Translate the sentences that have changed and
finally run the generator (without @code{-l}) on the ETAG (@code{-i $ETAG}) to
create the final files.

When making major changes with legal implications, you should first rename (or
copy) the existing @code{.rst} file and the associated translation files to a new
unique name.  Afterwards, make the major changes, update the @code{.po} files,
complete the translations and re-create the final files.  Finally, do not
forget to update the @code{ETAG} configuration option to the new name and to
restart the service.

@node KYC Configuration,Deployment,Legal Setup,Top
@anchor{taler-exchange-manual kyc-configuration}@anchor{2e}
@chapter KYC Configuration


To legally operate, Taler exchange operators may have to comply with KYC
regulation that requires financial institutions to identify parties involved
in transactions at certain points.

Taler permits an exchange to require KYC data under the following circumstances:

@quotation


@itemize *

@item 
Customer withdraws money over a threshold

@item 
Wallet receives (via refunds) money resulting in a balance over a threshold

@item 
Wallet receives money via P2P payments over a threshold

@item 
Merchant receives money over a threshold

@item 
Reserve is “opened” for invoicing (`planned feature')
@end itemize
@end quotation

Any of the above requests can trigger the KYC process,
which can be illustrated as follows:

@image{taler-exchange-figures/kyc-process,,,,png}

At the end of the KYC process, the wallet re-tries the
original request, and assuming KYC was successful, the
request should then succeed.

@menu
* Taler KYC Terminology:: 
* KYC Configuration Options:: 
* OAuth 2.0 specifics: OAuth 2 0 specifics. 
* Persona specifics:: 
* KYC AID specifics:: 

@end menu

@node Taler KYC Terminology,KYC Configuration Options,,KYC Configuration
@anchor{taler-exchange-manual taler-kyc-terminology}@anchor{2f}
@section Taler KYC Terminology



@itemize *

@item 
`Check': A check establishes a particular attribute of a user, such as
their name based on an ID document and lifeness, mailing address, phone
number, taxpayer identity, etc.

@item 
`Type of operation': The operation type determines which Taler-specific
operation has triggered the KYC requirement. We support four types of
operation: withdraw (by customer), deposit (by merchant), P2P receive (by
wallet) and (high) wallet balance.

@item 
`Condition': A condition specifies when KYC is required. Conditions
include the `type of operation', a threshold amount (e.g. above EUR:1000)
and possibly a time period (e.g. over the last month).

@item 
`Cost': Metric for the business expense for a KYC check at a certain
`provider'. Not in any currency, costs are simply relative and non-negative
values. Costs are considered when multiple choices are allowed by the
`configuration'.

@item 
`Expiration': KYC legitimizations may be outdated. Expiration rules
determine when `checks' have to be performed again.

@item 
`Legitimization rules': The legitimization rules determine under which
`conditions' which `checks' must be performend and the `expiration' time
period for the `checks'.

@item 
`Logic': Logic refers to a specific bit of code (realized as an exchange
plugin) that enables the interaction with a specific `provider'.  Logic
typically requires configuration for access control (such as an
authorization token) and possibly the endpoint of the specific `provider'
implementing the respective API.

@item 
`Provider': A provider performs a specific set of `checks' at a certain
`cost'. Interaction with a provider is performed by provider-specific
`logic'.
@end itemize

@node KYC Configuration Options,OAuth 2 0 specifics,Taler KYC Terminology,KYC Configuration
@anchor{taler-exchange-manual kyc-configuration-options}@anchor{30}
@section KYC Configuration Options


The KYC configuration determines the `legitimization rules', and specifies
which providers offer which `checks' at what `cost'.

The configuration specifies a set of providers, one per configuration section. The names of the configuration
sections must being with @code{kyc-proider-} followed by
an arbitrary @code{$PROVIDER_ID}:


@float LiteralBlock

@caption{/etc/taler/conf.d/exchange-kyc-providers.conf}

@example
[kyc-provider-$PROVIDER_ID]
# How expensive is it to use this provider?
# Used to pick the cheapest provider possible.
COST = 42
# Which plugin is responsible for this provider?
# Choices include "oauth2", "kycaid" and "persona".
LOGIC = oauth2
# Which type of user does this provider handle?
# Either INDIVIDUAL or BUSINESS.
USER_TYPE = INDIVIDUAL
# Which checks does this provider provide?
# List of strings, no specific semantics.
PROVIDED_CHECKS = SMS GOVID PHOTO
# Plus additional logic-specific options, e.g.:
AUTHORIZATION_TOKEN = superdupersecret
FORM_ID = business_legi_form
# How long is the check considered valid?
EXPIRATION = 3650d
@end example

@end float


The configuration also must specify a set of legitimization requirements, again one
per configuration section:


@float LiteralBlock

@caption{/etc/taler/conf.d/exchange-kyc-rules.conf}

@example
[kyc-legitimization-$RULE_NAME]
# Operation that triggers this legitimization.
# Must be one of WITHDRAW, DEPOSIT, P2P-RECEIVE
# or WALLET-BALANCE.
OPERATION_TYPE = WITHDRAW
# Required checks to be performed.
# List of strings, must individually match the
# strings in one or more provider's PROVIDED_CHECKS.
REQUIRED_CHECKS = SMS GOVID
# Threshold amount above which the legitimization is
# triggered.  The total must be exceeded in the given
# timeframe.
THRESHOLD = KUDOS:100
# Timeframe over which the amount to be compared to
# the  THRESHOLD is calculated.  Can be 'forever'.
# Ignored for WALLET-BALANCE.
TIMEFRAME = 30d
@end example

@end float


@node OAuth 2 0 specifics,Persona specifics,KYC Configuration Options,KYC Configuration
@anchor{taler-exchange-manual oauth-2-0-specifics}@anchor{31}
@section OAuth 2.0 specifics


In terms of configuration, the OAuth 2.0 logic requires the respective client
credentials to be configured apriori to enable access to the legitimization
service.  The OAuth 2.0 configuration options are:


@float LiteralBlock

@caption{/etc/taler/conf.d/exchange-oauth2.conf}

@example
[kyc-provider-example-oauth2]
LOGIC = oauth2
# (generic options omitted)
# How long is the KYC check valid?
KYC_OAUTH2_VALIDITY = forever

# URL to which we redirect the user for the login process
KYC_OAUTH2_AUTHORIZE_URL = "http://kyc.example.com/authorize"
# URL where we POST the user's authentication information
KYC_OAUTH2_TOKEN_URL = "http://kyc.example.com/token"
# URL of the user info access point.
KYC_OAUTH2_INFO_URL = "http://kyc.example.com/info"

# Where does the client get redirected upon completion?
KYC_OAUTH2_POST_URL = "http://example.com/thank-you"

# For authentication to the OAuth2.0 service
KYC_OAUTH2_CLIENT_ID = testcase
KYC_OAUTH2_CLIENT_SECRET = password

# Mustach template that converts OAuth2.0 data about the user
# into GNU Taler standardized attribute data.
KYC_OAUTH2_CONVERTER_HELPER = taler-exchange-kyc-oauth2-challenger.sh
@end example

@end float


The converter helper is expected to be customized to the selected OAuth2.0
service: different services may return different details about the user or
business, hence there cannot be a universal converter for all purposes. The
default shell script uses the @code{jq} tool to convert the JSON returned by the
service into the KYC attributes (also in JSON) expected by the exchange.  The
script will need to be adjusted based on the attributes collected by the
specific backend.

The Challenger service for address validation supports OAuth2.0, but does not
have a static AUTHORIZE_URL. Instead, the AUTHORIZE_URL must be enabled by the client
using a special authenticated request to the Challenger’s @code{/setup} endpoint.
The exchange supports this by appending @code{#setup} to the AUTHORIZE_URL (note
that fragments are illegal in OAuth2.0 URLs).  Be careful to quote the URL,
as @code{#} is otherwise interpreted as the beginning of a comment by the
configuration file syntax.


@float LiteralBlock

@caption{/etc/taler/conf.d/exchange-challenger-oauth2.conf}

@example
[kyc-provider-challenger-oauth2]
LOGIC = oauth2
KYC_OAUTH2_AUTHORIZE_URL = "http://challenger.example.com/authorize/#setup"
KYC_OAUTH2_TOKEN_URL = "http://challenger.example.com/token"
KYC_OAUTH2_INFO_URL = "http://challenger.example.com/info"
@end example

@end float


When using OAuth 2.0, the `CLIENT REDIRECT URI' must be set to the
@code{/kyc-proof/$PROVIDER_SECTION} endpoint. For example, given the
configuration above and an exchange running on the host
@code{exchange.example.com}, the redirect URI would be
@code{https://exchange.example.com/kyc-proof/kyc-provider-challenger-oauth2/}.

@node Persona specifics,KYC AID specifics,OAuth 2 0 specifics,KYC Configuration
@anchor{taler-exchange-manual persona-specifics}@anchor{32}
@section Persona specifics


We use the hosted flow. The Persona endpoints return a @code{request-id}, which
we log for diagnosis.

Persona should be configured to use the @code{/kyc-webhook/} endpoint of the
exchange to notify the exchange about the completion of KYC processes.  The
webhook is authenticated using a shared secret, which should be in the
configuration.  To use the Persona webhook, you must set the webhook URL in
the Persona service to @code{$EXCHANGE_BASE_URL/kyc-webhook/$SECTION_NAME/} where
@code{$SECTION_NAME} is the name of the configuration section.  You should also
extract the authentication token for the webhook and put it into the
configuration as shown above.


@float LiteralBlock

@caption{/etc/taler/conf.d/exchange-persona.conf}

@example
[kyclogic-persona]
# Webhook authorization token. Global for all uses
# of the persona provider!
WEBHOOK_AUTH_TOKEN = wbhsec_698b5a19-c790-47f6-b396-deb572ec82f9

[kyc-provider-example-persona]
LOGIC = persona
# (generic options omitted)

# How long is the KYC check valid?
KYC_PERSONA_VALIDITY = 365d

# Which subdomain is used for our API?
KYC_PERSONA_SUBDOMAIN = taler

# Authentication token to use.
KYC_PERSONA_AUTH_TOKEN = persona_sandbox_42XXXX

# Form to use.
KYC_PERSONA_TEMPLATE_ID = itempl_Uj6Xxxxx

# Where do we redirect to after KYC finished successfully.
KYC_PERSONA_POST_URL = "https://taler.net/kyc-done"

# Salt to give to requests for idempotency.
# Optional.
# KYC_PERSONA_SALT = salt

# Helper to convert JSON with KYC data returned by Persona into GNU Taler
# internal format. Should probably always be set to some variant of
# "taler-exchange-kyc-persona-converter.sh".
KYC_PERSONA_CONVERTER_HELPER = "taler-exchange-kyc-persona-converter.sh"
@end example

@end float


The converter helper is expected to be customized to the
selected template: different templates may return different details
about the user or business, hence there cannot be a universal converter
for all purposes. The default shell script uses the @code{jq} tool to
convert the JSON returned by Persona into the KYC attributes (also
in JSON) expected by the exchange.  The script will need to be adjusted
based on the attributes collected by the specific template.

@node KYC AID specifics,,Persona specifics,KYC Configuration
@anchor{taler-exchange-manual kyc-aid-specifics}@anchor{33}
@section KYC AID specifics


We use the hosted flow.

KYCAID must be configured to use the @code{/kyc-webhook/$SECTION_NAME/} endpoint
of the exchange to notify the exchange about the completion of KYC processes.


@float LiteralBlock

@caption{/etc/taler/conf.d/exchange-kycaid.conf}

@example
[kyc-provider-example-kycaid]
LOGIC = kycaid
# (generic options omitted)

# How long is the KYC check valid?
KYC_KYCAID_VALIDITY = 365d

# Authentication token to use.
KYC_KYCAID_AUTH_TOKEN = XXX

# Form to use.
KYC_KYCAID_FORM_ID = XXX

# URL to go to after the process is complete.
KYC_KYCAID_POST_URL = "https://taler.net/kyc-done"

# Script to convert the KYCAID data into the Taler format.
KYC_KYCAID_CONVERTER_HELPER = taler-exchange-kyc-kycaid-converter.sh
@end example

@end float


The converter helper is expected to be customized to the selected template:
different templates may return different details about the user or business,
hence there cannot be a universal converter for all purposes. The default
shell script uses the @code{jq} tool to convert the JSON returned by Persona into
the KYC attributes (also in JSON) expected by the exchange.  The script will
need to be adjusted based on the attributes collected by the specific
template.

@node Deployment,Offline Signing Setup Key Maintenance and Tear-Down,KYC Configuration,Top
@anchor{taler-exchange-manual deployment}@anchor{34}@anchor{taler-exchange-manual id4}@anchor{35}
@chapter Deployment


This chapter describes how to deploy the exchange once the basic installation
and configuration are completed.

@menu
* Serving:: 
* Reverse Proxy Setup:: 
* Launching an exchange:: 

@end menu

@node Serving,Reverse Proxy Setup,,Deployment
@anchor{taler-exchange-manual id5}@anchor{36}@anchor{taler-exchange-manual serving}@anchor{37}
@section Serving


The exchange can serve HTTP over both TCP and UNIX domain socket.

The following options are to be configured in the section @code{[exchange]}:


@itemize -

@item 
@code{SERVE}: Must be set to @code{tcp} to serve HTTP over TCP, or @code{unix} to serve
HTTP over a UNIX domain socket.

@item 
@code{PORT}: Set to the TCP port to listen on if @code{SERVE} is @code{tcp}.

@item 
@code{UNIXPATH}: Set to the UNIX domain socket path to listen on if @code{SERVE} is
@code{unix}.

@item 

@table @asis

@item @code{UNIXPATH_MODE}: Number giving the mode with the access permission mask

for the @code{UNIXPATH} (i.e. 660 = @code{rw-rw---}). Make sure to set it in such
a way that your reverse proxy has permissions to access the UNIX domain
socket.  The default (660) assumes that the reverse proxy is a member of
the group under which the exchange HTTP server is running.
@end table
@end itemize

@node Reverse Proxy Setup,Launching an exchange,Serving,Deployment
@anchor{taler-exchange-manual reverse-proxy-setup}@anchor{38}@anchor{taler-exchange-manual reverseproxy}@anchor{39}
@section Reverse Proxy Setup


By default, the @code{taler-exchange-httpd} service listens for HTTP connections
on a UNIX domain socket.  To make the service publicly available, a reverse
proxy such as nginx should be used.  We strongly recommend to configure nginx
to use TLS.

The public URL that the exchange will be served under should
be put in @code{/etc/taler/conf.d/exchange-business.conf} configuration file.


@float LiteralBlock

@caption{/etc/taler/conf.d/exchange-business.conf}

@example
 [exchange]
 BASE_URL = https://example.com/

 # ... rest of file ...
@end example

@end float


The @code{taler-exchange} package ships with a sample configuration that can be
enabled in nginx:

@example
[root@@exchange-online]# vim /etc/nginx/sites-available/taler-exchange
< ... customize configuration ... >
[root@@exchange-online]# ln -s /etc/nginx/sites-available/taler-exchange \
                              /etc/nginx/sites-enabled/taler-exchange
[root@@exchange-online]# systemctl reload nginx
@end example

Note that the reverse proxy must set a HTTP @code{X-Forwarded-Host} header to
refer to the hostname used by nginx and a HTTP @code{X-Forwarded-Proto} header to
inform the exchange whether the external protocol was @code{http} or @code{https}.
Thus, depending on your setup, you will likely have to edit those parts of the
provided @code{taler-exchange} configuration file.

With this last step, we are finally ready to launch the
main exchange process.

@node Launching an exchange,,Reverse Proxy Setup,Deployment
@anchor{taler-exchange-manual launch}@anchor{3a}@anchor{taler-exchange-manual launching-an-exchange}@anchor{3b}
@section Launching an exchange


A running exchange requires starting the following processes:


@itemize -

@item 
@code{taler-exchange-secmod-rsa} (as special user, sharing group with the HTTPD)

@item 
@code{taler-exchange-secmod-cs} (as special user, sharing group with the HTTPD)

@item 
@code{taler-exchange-secmod-eddsa} (as special user, sharing group with the HTTPD)

@item 
@code{taler-exchange-httpd} (needs database access)

@item 
@code{taler-exchange-aggregator} (only needs database access)

@item 
@code{taler-exchange-closer} (only needs database access)

@item 
@code{taler-exchange-wirewatch} (needs bank account read credentials and database access)

@item 
@code{taler-exchange-transfer} (needs credentials to initiate outgoing wire transfers and database access)
@end itemize

The crypto helpers (@code{secmod}) must be started before the @code{taler-exchange-httpd} and
they should use the same configuration file.

For the most secure deployment, we recommend using separate users for each of
these processes to minimize information disclosures should any of them be
compromised.  The helpers do not need access to the PostgreSQL database (and
thus also should not have it).

The processes that require access to the bank account need to have a
configuration file with the respective credentials in it. We recommend using a
separate configuration at least for @code{taler-exchange-transfer} which is the
`only' process that needs to know the credentials to execute outgoing wire
transfers.

All of these processes should also be started via a hypervisor like
@code{systemd} or @code{gnunet-arm} that automatically re-starts them should they
have terminated unexpectedly.  If the bank is down (say for maintenance), it is
`possible' to halt the @code{taler-exchange-wirewatch} and/or
@code{taler-exchange-transfer} processes (to avoid them making requests to the
bank API that can only fail) without impacting other operations of the
exchange. Naturally, incoming wire transfers will only be observed once
@code{taler-exchange-wirewatch} is resumed, and merchants may complain if the
disabled @code{taler-exchange-transfer} process causes payment deadlines to be
missed.

@cartouche
@quotation Note 
The @code{taler-exchange-httpd} does not ship with HTTPS enabled by default.
In production, it should be run behind an HTTPS reverse proxy that performs
TLS termination on the same system.  Thus, it would typically be configured
to listen on a UNIX domain socket.  The @code{/management} and @code{/auditors}
APIs do technically not have to be exposed on the Internet (only to the
administrators running @code{taler-exchange-offline}) and should be blocked
by the reverse proxy for requests originating from outside of the bank.
(However, this is not a strong security assumption: in principle having
these endpoints available should do no harm. However, it increases the
attack surface.)
@end quotation
@end cartouche

Given proper packaging, all of the above are realized via a simple systemd
target. This enables the various processes of an exchange service to be
started using a simple command:

@example
[root@@exchange-online]# systemctl start taler-exchange.target
@end example

@cartouche
@quotation Note 
At this point, the exchange service is not yet fully operational.
@end quotation
@end cartouche

To check whether the exchange is running correctly under the advertised
base URL, run:

@example
[root@@exchange-online]# export BASE_URL=$(taler-config -s exchange -o base_url)
[root@@exchange-online]# wget $@{BASE_URL@}management/keys
@end example

The request might take some time to complete on slow machines, because
a lot of key material will be generated.

@node Offline Signing Setup Key Maintenance and Tear-Down,AML Configuration,Deployment,Top
@anchor{taler-exchange-manual offline-signing-setup-key-maintenance-and-tear-down}@anchor{3c}
@chapter Offline Signing Setup, Key Maintenance and Tear-Down


The exchange HTTP service must be running before you can complete the
following offline signing procedure. Note that when an exchange is running
without offline keys its not fully operational.  To make the exchange HTTP
service fully operational, the following steps involving the offline signing
machine must be completed:

@quotation


@enumerate 

@item 
The public keys of various online keys used by the exchange service are exported
via a management HTTP API.

@item 
The offline signing system validates this request and signs it.
Additionally, the offline signing system signs policy messages
to configure the exchange’s bank accounts and associated fees.

@item 
The messages generated by the offline signing system are uploaded
via the management API of the exchange HTTP service.
@end enumerate
@end quotation

A typical minimal setup would look something like this:

@example
[anybody@@exchange-online]# taler-exchange-offline \
  download > sig-request.json

[root@@exchange-offline]# taler-exchange-offline \
  sign < sig-request.json > sig-response.json
[root@@exchange-offline]# taler-exchange-offline \
  enable-account payto://iban/$IBAN?receiver-name=$NAME > acct-response.json
[root@@exchange-offline]# taler-exchange-offline \
  wire-fee now iban EUR:0 EUR:0 > fee-response.json
[root@@exchange-offline]# taler-exchange-offline \
  global-fee now EUR:0 EUR:0 EUR:0 4w 6y 4 > global-response.json

[anybody@@exchange-online]# taler-exchange-offline upload < sig-response.json
[anybody@@exchange-online]# taler-exchange-offline upload < acct-response.json
[anybody@@exchange-online]# taler-exchange-offline upload < fee-response.json
[anybody@@exchange-online]# taler-exchange-offline upload < global-response.json
@end example

The following sections will discuss these steps in more depth.

@menu
* Signing the online signing keys:: 
* Account signing:: 
* Wire fee structure:: 
* Auditor configuration:: 
* Revocations:: 

@end menu

@node Signing the online signing keys,Account signing,,Offline Signing Setup Key Maintenance and Tear-Down
@anchor{taler-exchange-manual keys-generation}@anchor{3d}@anchor{taler-exchange-manual signing-the-online-signing-keys}@anchor{3e}
@section Signing the online signing keys


To sign the online signing keys, first the `future' key material should be downloaded using:

@example
$ taler-exchange-offline download > future-keys.json
@end example

Afterwards, `future-keys.json' contains data about denomination and
online signing keys that the exchange operator needs to sign with
the offline tool.  The file should be copied to the offline system.
There, the operator should run:

@example
$ taler-exchange-offline show < future-keys.json
@end example

and verify that the output contains the fee structure and key lifetimes
they expect to see. They should also note the public keys being shown
and communicate those to the `auditors' over a secure channel.  Once
they are convinced the file is acceptable, they should run:

@example
$ taler-exchange-offline sign < future-keys.json > offline-sigs.json
@end example

The `offline-sigs.json' file must then be copied to an online system
that is able to again communicate with the exchange. On that system, run:

@example
$ taler-exchange-offline upload < offline-sigs.json
@end example

to provision the signatures to the exchange.

The @code{download sign upload} sequence in the commands above has to be done
periodically, as it signs the various online signing keys of the exchange
which periodically expire.

@node Account signing,Wire fee structure,Signing the online signing keys,Offline Signing Setup Key Maintenance and Tear-Down
@anchor{taler-exchange-manual account-signing}@anchor{3f}@anchor{taler-exchange-manual exchange-account-signing}@anchor{40}
@section Account signing


The @code{enable-account} step is important to must be used to sign the
@code{payto://} URI in a way suitable to convince wallets that this is the
correct address to wire funds to.  Note that for each bank account, additional
options `must' be set in the configuration file to tell the exchange how to
access the bank account. The offline tool `only' configures the externally
visible portions of the setup.  The chapter on bank account configuration@footnote{_exchange-bank-account-configuration} has further details.

taler-exchange-offline accepts additional options to configure the use of the
account. For example, additional options can be used to add currency
conversion or to restrict interactions to bank accounts from certain
countries:

@example
$ taler-exchange-offline \
    enable-account payto://iban/CH9300762011623852957
      conversion-url https://conversion.example.com/
@end example

For details on optional @code{enable-account} arguments,
see manpages/taler-exchange-offline.1.

@node Wire fee structure,Auditor configuration,Account signing,Offline Signing Setup Key Maintenance and Tear-Down
@anchor{taler-exchange-manual id6}@anchor{41}@anchor{taler-exchange-manual wire-fee-structure}@anchor{42}
@section Wire fee structure


@geindex wire fee

@geindex fee

For each wire method (“iban” or “x-taler-bank”) the
exchange must know about applicable wire fees. This is also done
using the @code{taler-exchange-offline} tool:

@example
$ taler-exchange-offline wire-fee 2040 iban EUR:0.05 EUR:0.10
@end example

The above sets the wire fees for wire transfers involving @code{iban} accounts
(in Euros) in the year 2040 to 5 cents (wire fee) and 10 cents (closing fee).
The tool only supports setting fees that applies for the entire calendar year.

We recommend provisioning an exchange with wire fees at least for the next two
years.  Note that once the fees have been set for a year, they cannot be
changed (basically, by signing the fees the exchange makes a legally binding
offer to the customers).

@geindex maintenance

@cartouche
@quotation Note 
Provisioning future wire fees, like provisioning future denomination
and signing keys, are key regular maintenance procedures for every
exchange operator.  We recommend setting automated reminders for
this maintenance activity!
@end quotation
@end cartouche

@node Auditor configuration,Revocations,Wire fee structure,Offline Signing Setup Key Maintenance and Tear-Down
@anchor{taler-exchange-manual auditor-configuration}@anchor{43}@anchor{taler-exchange-manual id7}@anchor{44}
@section Auditor configuration


At this point, the exchange will be able to use those keys, but wallets and
merchants may not yet trust them!  Thus, the next step is for an auditor to
affirm that they are auditing this exchange.  Before an auditor can do this,
the exchange service must be informed about any auditor that is expected to
provision it with auditor signatures.

This is also done using the @code{taler-exchange-offline} tool on the offline
system.  First, the auditor must be configured and provide the exchange
operator with its public key (using @code{taler-auditor-offline setup}) and the
URL of it’s REST API.  The exchange operator also needs a human-readable name
that may be shown to users to identify the auditor.  For more information on
how to setup and operate an auditor, see
manpages/taler-auditor-offline.1 and taler-auditor-manual.

Given this information, the exchange operator can enable the auditor:

@example
$ taler-exchange-offline enable-auditor $PUB_KEY $REST_URL "$AUDITOR_NAME" > auditor.json
@end example

As before, the `auditor.json' file must then be copied from the offline system
to a system connected to the exchange and there @code{uploaded} to the exchange using @code{taler-exchange-offline upload}.

@node Revocations,,Auditor configuration,Offline Signing Setup Key Maintenance and Tear-Down
@anchor{taler-exchange-manual id8}@anchor{45}@anchor{taler-exchange-manual revocations}@anchor{46}
@section Revocations


When an exchange goes out of business or detects that the private key of
a denomination key pair has been compromised, it may revoke some or all
of its denomination keys. At this point, the hashes of the revoked keys
must be returned as part of the @code{/keys} response under “recoup”.
Wallets detect this, and then return unspent coins of the respective
denomination key using the @code{/recoup} API.

To revoke a denomination key, you need to know the hash of the denomination
public key, @code{$HDP}.  The @code{$HDP} value is usually included in the security
report that is generated when a compromise is detected).  Given this
value, the key revocation can be approved on the offline system:

@example
$ taler-exchange-offline revoke-denominatin $HDP > revocation.json
@end example

The resulting `revocation.json' must be copied to a system connected to the
exchange and uploaded to the exchange using the @code{upload} subcommand
of @code{taler-exchange-offline}.

@cartouche
@quotation Note 
Denomination key revocations should only happen
under highly unusual (“emergency”) conditions and not in normal
operation.
@end quotation
@end cartouche

@node AML Configuration,Setup Linting,Offline Signing Setup Key Maintenance and Tear-Down,Top
@anchor{taler-exchange-manual aml-configuration}@anchor{47}
@chapter AML Configuration


The AML configuration steps are used to add or remove keys of exchange
operator staff that are responsible for anti-money laundering (AML)
compliance.  These AML officers are shown suspicious transactions and are
granted access to the KYC data of an exchange. They can then investigate the
transaction and decide on freezing or permitting the transfer. They may also
request additional KYC data from the consumer and can change the threshold
amount above which a further AML review is triggered.

@menu
* AML Officer Setup:: 
* AML Triggers:: 
* AML Forms:: 

@end menu

@node AML Officer Setup,AML Triggers,,AML Configuration
@anchor{taler-exchange-manual aml-officer-setup}@anchor{48}
@section AML Officer Setup


To begin the AML setup, AML staff should launch the GNU Taler
exchange AML SPA Web interface. (FIXME-Sebastian: how?). The
SPA will generate a public-private key pair and store it in the
local storage of the browser.  The public key will be displayed
and must be securely transmitted to the offline system for
approval.  Using the offline system, one can then configure
which staff has access to the AML operations:

@example
[root@@exchange-offline]# taler-exchange-offline \
   aml-enable $PUBLIC_KEY "Legal Name" rw > aml.json
[root@@exchange-online]# taler-exchange-offline \
   upload < aml.json
@end example

The above commands would add an AML officer with the given “Legal Name” with
read-write (rw) access to the AML officer database.  Using “ro” instead of
“rw” would grant read-only access to the data, leaving out the ability to
actually make AML decisions.  Once AML access has been granted, the AML
officer can use the SPA to review cases and (with “rw” access) take AML
decisions.

Access rights can be revoked at any time using:

@example
[root@@exchange-offline]# taler-exchange-offline \
   aml-disable $PUBLIC_KEY "Legal Name" > aml-off.json
[root@@exchange-online]# taler-exchange-offline \
   upload < aml-off.json
@end example

@node AML Triggers,AML Forms,AML Officer Setup,AML Configuration
@anchor{taler-exchange-manual aml-triggers}@anchor{49}
@section AML Triggers


AML decision processes are automatically triggered under certain configurable
conditions.  The primary condition that `must' be configured is the
@code{AML_THRESHOLD}:


@float LiteralBlock

@caption{/etc/taler/conf.d/exchange-business.conf}

@example
[exchange]
# Accounts or wallets with monthly transaction volumes above this threshold
# are considered suspicious and are automatically flagged for AML review
# and put on hold until an AML officer has reached a decision.
AML_THRESHOLD = "EUR:1000000"
@end example

@end float


Additionally, certain KYC attributes (such as the user being a
politically exposed person) may lead to an account being
flagged for AML review.  The specific logic is configured by
providing the exchange with an external helper program that
makes the decision given the KYC attributes:


@float LiteralBlock

@caption{/etc/taler/conf.d/exchange-business.conf}

@example
[exchange]
# Specifies a program to run on KYC attribute data to decide
# whether we should immediately flag an account for AML review.
KYC_AML_TRIGGER = taler-exchange-kyc-aml-pep-trigger.sh
@end example

@end float


The given program will be given the KYC attributes in JSON format on standard
input, and must return 0 to continue without AML and non-zero to flag the
account for manual review.  To disable this trigger, simply leave the option to
its default value of ‘[/usr/bin/]true’. To flag all new users for manual
review, simply set the program to ‘[/usr/bin/]false’.

@node AML Forms,,AML Triggers,AML Configuration
@anchor{taler-exchange-manual aml-forms}@anchor{4a}
@section AML Forms


AML forms are defined by the DD 54 dynamic forms.
The shipped implementation with of the exchange is installed in

@example
$@{INSTALL_PREFIX@}/share/taler/exchange/spa/forms.js
@end example

The variable @code{form} contains the list of all form available. For
every entry in the list the next properties are expected to be present:

@code{label}: used in the UI as the name of the form

@code{id}: identification name, this will be saved in the exchange database
along with the values to correctly render the form again.
It should simple, short and without any character outside numbers,
letters and underscore.

@code{version}: when editing a form, instead of just replacing fields
it will be better to create a new form with the same id and new version.
That way old forms in the database will used old definition of the form.
It should be a number.

@code{impl} : a function that returns the design and behavior of form.
See DD 54 dynamic forms.

@cartouche
@quotation Attention 
do not remove a form the list if it has been used. Otherwise you
won’t be able to see the information save in the exchange database.
@end quotation
@end cartouche

To add a new one you can simply copy and paste one element, and edit it.

It is much easier to download @code{@@gnu-taler/aml-backoffice-ui} source
from @code{https://git.taler.net/wallet-core.git/}, compile and copy the file
from the @code{dist/prod}.

@node Setup Linting,Testing and Troubleshooting,AML Configuration,Top
@anchor{taler-exchange-manual setup-linting}@anchor{4b}
@chapter Setup Linting


The @code{taler-wallet-cli} package comes with an experimental tool that runs various
checks on the current GNU Taler exchange deployment:

@example
[root@@exchange-online]# apt install taler-wallet-cli
[root@@exchange-online]# taler-wallet-cli deployment lint-exchange
@end example

You can optionally pass the @code{--debug} option to get more verbose output, and
@code{--continue} to continue with further checks even though a previous one has
failed.

@node Testing and Troubleshooting,Template Customization,Setup Linting,Top
@anchor{taler-exchange-manual testing-and-troubleshooting}@anchor{4c}
@chapter Testing and Troubleshooting


We recommend testing whether an exchange deployment is functional by using the
Taler wallet command line interface.  The tool can be used to withdraw and
deposit electronic cash via the exchange without having to deploy and operate a
separate merchant backend and storefront.

The following shell session illustrates how the wallet can be used to withdraw
electronic cash from the exchange and subsequently spend it.  For these steps,
a merchant backend is not required, as the wallet acts as a merchant.

@example
# This will now output a payto URI that money needs to be sent to in order to allow withdrawal
# of taler coins.
$ taler-wallet-cli advanced withdraw-manually --exchange $EXCHANGE_URL --amount EUR:10.50
@end example

Show the status of the manual withdrawal operation.

@example
$ taler-wallet-cli transactions
@end example

At this point, a bank transfer to the exchange’s bank account
needs to be made with the correct subject / remittance information
as instructed by the wallet after the first step.  With the
above configuration, it should take about 5 minutes after the
wire transfer for the incoming transfer to be observed by the
Nexus.

Run the following command to check whether the exchange received
an incoming bank transfer:

@example
[root@@exchange-online]# taler-exchange-wire-gateway-client \
   --section exchange-accountcredentials-1 --credit-history
@end example

Once the transfer has been made, try completing the withdrawal
using:

@example
$ taler-wallet-cli run-pending
@end example

Afterwards, check the status of transactions and show the
current wallet balance:

@example
$ taler-wallet-cli transactions
$ taler-wallet-cli balance
@end example

Now, we can directly deposit coins via the exchange into a target
account.  (Usually, a payment is made via a merchant.  The wallet
provides this functionality for testing.)

@example
$ taler-wallet-cli deposit create EUR:5 \
  payto://iban/$IBAN?receiver-name=Name
$ taler-wallet-cli run-pending
@end example

Check if this transaction was successful (from the perspective
of the wallet):

@example
$ taler-wallet-cli transactions
@end example

If the transaction failed, fix any open issue(s) with the exchange and
run the “run-pending” command.

The wallet can also track if the exchange wired the money to the merchant
account.  The “deposit group id” can be found in the output of the
transactions list.

@example
$ taler-wallet-cli deposit track $DEPOSIT_GROUP_ID
@end example

You can also check using the exchange-tools whether the exchange sent
the an outgoing transfer:

@example
[root@@exchange-online]# taler-exchange-wire-gateway-client \
  --section exchange-accountcredentials-1 --debit-history
@end example

After enough time has passed, the money should arrive at the specified IBAN.

For more information on the taler-wallet-cli tool, see
taler-wallet.

@menu
* taler-config:: 
* Using taler-config:: 
* Private key storage:: 
* Internal audits:: 
* Database Scheme:: 
* Database upgrades:: 

@end menu

@node taler-config,Using taler-config,,Testing and Troubleshooting
@anchor{taler-exchange-manual taler-config}@anchor{4d}
@section taler-config


@node Using taler-config,Private key storage,taler-config,Testing and Troubleshooting
@anchor{taler-exchange-manual using-taler-002dconfig-exchange}@anchor{4e}@anchor{taler-exchange-manual using-taler-config}@anchor{4f}
@section Using taler-config


The tool @code{taler-config} can be used to extract or manipulate configuration
values; however, the configuration use the well-known INI file format and is
generally better edited by hand to preserve comments and structure.  Thus, @code{taler-config} should primarily be used
to inspect or understand a configuration that is in place,
and not to update it!

Run

@example
$ taler-config -s $SECTION
@end example

to list all of the configuration values in section @code{$SECTION}.

Run

@example
$ taler-config -s $SECTION -o $OPTION
@end example

to extract the respective configuration value for option @code{$OPTION} in
section @code{$SECTION}.

Finally, to change a setting and clobber your entire
configuration file structure, inlining all values and
removing all comments, run

@example
$ taler-config -s $SECTION -o $OPTION -V $VALUE
@end example

to set the respective configuration value to @code{$VALUE}. Note that you
have to manually restart affected Taler components after you change the
configuration to make the new configuration go into effect.

Some default options will use $-variables, such as @code{$DATADIR} within
their value. To expand the @code{$DATADIR} or other $-variables in the
configuration, pass the @code{-f} option to @code{taler-config}. For example,
compare:

@example
$ taler-config --section exchange-offline --option MASTER_PRIV_FILE
$ taler-config -f --section exchange-offline --option MASTER_PRIV_FILE
@end example

While the configuration file is typically located at
@code{$HOME/.config/taler.conf}, an alternative location can be specified to any
GNU Taler component using the @code{-c} option.

@node Private key storage,Internal audits,Using taler-config,Testing and Troubleshooting
@anchor{taler-exchange-manual private-key-storage}@anchor{50}
@section Private key storage


Keeping the private keys the helpers create secret is paramount. If the
private keys are lost, it is easy to provision fresh keys (with the help of
the auditor).  Thus, we recommend that the private keys of the crypto helpers
are `not' backed up: in the rare event of a disk failure, they can be
regenerated.  However, we do recommend using RAID (1+1 or 1+1+1) for all
disks of the system.

@node Internal audits,Database Scheme,Private key storage,Testing and Troubleshooting
@anchor{taler-exchange-manual internal-audit}@anchor{51}@anchor{taler-exchange-manual internal-audits}@anchor{52}
@section Internal audits


While an exchange should use an external auditor to attest to regulators that
it is operating correctly, an exchange operator can also use the auditor’s
logic to perform internal checks.  For this, an exchange operator can generally
follow the auditor guide.  However, instead of using @code{taler-auditor-sync},
an internal audit can and likely should be performed either directly against
the production exchange database or against a synchronous copy created using
standard database replication techniques. After all, the exchange operator
runs this for diagnostics and can generally trust its own database to maintain
the database invariants.

Running the auditor against a the original the production database (without
using @code{taler-auditor-sync}) enables the auditing logic to perform a few
additional checks that can detect inconsistencies.  These checks are enabled
by passing the `-i' option to the @code{taler-auditor} command.  As always,
the resulting report should be read carefully to see if there are any problems
with the setup.

Reports are generally created incrementally, with @code{taler-auditor} reporting
only incidents and balance changes that were not covered in previous reports.
While it is possible to reset the auditor database and to restart the audit
from the very beginning, this is generally not recommended as this may be too
expensive.

@node Database Scheme,Database upgrades,Internal audits,Testing and Troubleshooting
@anchor{taler-exchange-manual database-scheme}@anchor{53}@anchor{taler-exchange-manual id9}@anchor{54}
@section Database Scheme


The exchange database must be initialized using @code{taler-exchange-dbinit}.
This tool creates the tables required by the Taler exchange to operate.
The tool also allows you to reset the Taler exchange database, which is
useful for test cases but should never be used in production. Finally,
@code{taler-exchange-dbinit} has a function to garbage collect a database,
allowing administrators to purge records that are no longer required.

The database scheme used by the exchange looks as follows:

@image{taler-exchange-figures/exchange-db,,,,png}

@node Database upgrades,,Database Scheme,Testing and Troubleshooting
@anchor{taler-exchange-manual database-upgrades}@anchor{55}@anchor{taler-exchange-manual id10}@anchor{56}
@section Database upgrades


Before installing a new exchange version, you should probably make a backup of
the existing database and study the release notes on migration.  In general,
the way to migrate is to stop all existing Taler exchange processes and run:

@example
$ taler-exchange-dbinit
@end example

This will migrate the existing schema to the new schema. You also may need
to grant Taler exchange processes the rights to the new tables (see last
step of database setup).

@cartouche
@quotation Note 
The `taler-exchange-dbconfig' tool can be used to automate the database
migration. In general, simply invoking it again should trigger the
migration including `taler-exchange-dbinit' and setting the permissions.
@end quotation
@end cartouche

If you do not want to keep any data from the previous installation, the
exchange database can be fully re-initialized using:

@example
$ taler-exchange-dbinit --reset
@end example

However, running this command will result in all data in the database
being lost, which may result in significant financial liabilities as the
exchange can then not detect double-spending. Hence this operation must
not be performed in a production system. You still also need to then
grant the permissions to the other exchange processes again.

@node Template Customization,Benchmarking,Testing and Troubleshooting,Top
@anchor{taler-exchange-manual exchangetemplatecustomization}@anchor{57}@anchor{taler-exchange-manual template-customization}@anchor{58}
@chapter Template Customization


The Exchange comes with various HTML templates that are shown to
guide users through the KYC process. The Exchange uses Mustach@footnote{https://gitlab.com/jbol/mustach} as the templating engine.  This section
describes the various templates.  In general, the templates must be installed
to the @code{share/taler/exchange/templates/} directory. The file names must be of
the form @code{$NAME.$LANG.must} where @code{$NAME} is the name of the template and
@code{$LANG} is the 2-letter language code of the template. English templates
must exist and will be used as a fallback.  If the browser (user-agent) has
provided language preferences in the HTTP header and the respective language
exists, the correct language will be automatically served.

The following subsections give details about each of the templates. Most
subsection titles are the @code{$NAME} of the respective template.

@menu
* Generic Errors Templates:: 
* kycaid-invalid-request:: 
* oauth2-authentication-failure:: 
* oauth2-authorization-failure:: 
* oauth2-authorization-failure-malformed:: 
* oauth2-bad-request:: 
* oauth2-conversion-failure:: 
* oauth2-provider-failure:: 
* persona-exchange-unauthorized:: 
* persona-load-failure:: 
* persona-exchange-unpaid:: 
* persona-logic-failure:: 
* persona-invalid-response:: 
* persona-network-timeout:: 
* persona-kyc-failed:: 
* persona-provider-failure:: 

@end menu

@node Generic Errors Templates,kycaid-invalid-request,,Template Customization
@anchor{taler-exchange-manual generic-errors-templates}@anchor{59}
@section Generic Errors Templates


A number of templates are used for generic errors. These are:

@quotation


@itemize *

@item 
kyc-proof-already-done (KYC process already completed)

@item 
kyc-bad-request (400 Bad Request)

@item 
kyc-proof-endpoint-unknown (404 Not Found for KYC logic)

@item 
kyc-proof-internal-error (500 Internal Server Error)

@item 
kyc-proof-target-unknown (404 Not Found for KYC operation)
@end itemize
@end quotation

All of these templates are instantiated using the following information:

@quotation


@itemize *

@item 
ec: Integer; numeric Taler error code, should be shown to indicate the
error compactly for reporting to developers

@item 
hint: String; human-readable Taler error code, should be shown for the
user to understand the error

@item 
message: String; optional, extended human-readable text provided to elaborate
on the error, should be shown to provide additional context
@end itemize
@end quotation

@node kycaid-invalid-request,oauth2-authentication-failure,Generic Errors Templates,Template Customization
@anchor{taler-exchange-manual kycaid-invalid-request}@anchor{5a}
@section kycaid-invalid-request


The KYCaid plugin does not support requests to the
@code{/kyc-proof/} endpoint (HTTP 400 bad request).

This template is instantiated using the following information:

@quotation


@itemize *

@item 
ec: Integer; numeric Taler error code, should be shown to indicate the
error compactly for reporting to developers

@item 
hint: String; human-readable Taler error code, should be shown for the
user to understand the error

@item 
error: String; error code from the server

@item 
error_details: String; optional error description from the server

@item 
error_uri: optional URI with further details about the error from the server
@end itemize
@end quotation

@node oauth2-authentication-failure,oauth2-authorization-failure,kycaid-invalid-request,Template Customization
@anchor{taler-exchange-manual oauth2-authentication-failure}@anchor{5b}
@section oauth2-authentication-failure


The OAuth2 server said that the request was not
properly authenticated (HTTP 403 Forbidden).

This template is instantiated using the following information:

@quotation


@itemize *

@item 
ec: Integer; numeric Taler error code, should be shown to indicate the
error compactly for reporting to developers

@item 
hint: String; human-readable Taler error code, should be shown for the
user to understand the error
@end itemize
@end quotation

@node oauth2-authorization-failure,oauth2-authorization-failure-malformed,oauth2-authentication-failure,Template Customization
@anchor{taler-exchange-manual oauth2-authorization-failure}@anchor{5c}
@section oauth2-authorization-failure


The OAuth2 server refused to return the KYC data
because the authorization code provided was
invalid (HTTP 403 Forbidden).

This template is instantiated using the following information:

@quotation


@itemize *

@item 
ec: Integer; numeric Taler error code, should be shown to indicate the
error compactly for reporting to developers

@item 
hint: String; human-readable Taler error code, should be shown for the
user to understand the error

@item 
error: String; error code from the server

@item 
error_message: String; error message from the server
@end itemize
@end quotation

@node oauth2-authorization-failure-malformed,oauth2-bad-request,oauth2-authorization-failure,Template Customization
@anchor{taler-exchange-manual oauth2-authorization-failure-malformed}@anchor{5d}
@section oauth2-authorization-failure-malformed


The server refused the authorization, but then provided
a malformed response (HTTP 502 Bad Gateway).

This template is instantiated using the following information:

@quotation


@itemize *

@item 
ec: Integer; numeric Taler error code, should be shown to indicate the
error compactly for reporting to developers

@item 
hint: String; human-readable Taler error code, should be shown for the
user to understand the error

@item 
debug: Bool; true if we are running in debug mode and are allowed to return HTML with potentially sensitive information

@item 
server_response: Object; could be NULL; this includes the (malformed) OAuth2 server response, it should be shown to the use if “debug” is true
@end itemize
@end quotation

@node oauth2-bad-request,oauth2-conversion-failure,oauth2-authorization-failure-malformed,Template Customization
@anchor{taler-exchange-manual oauth2-bad-request}@anchor{5e}
@section oauth2-bad-request


The client made an invalid request (HTTP 400 Bad Request).

This template is instantiated using the following information:

@quotation


@itemize *

@item 
ec: Integer; numeric Taler error code, should be shown to indicate the
error compactly for reporting to developers

@item 
hint: String; human-readable Taler error code, should be shown for the
user to understand the error

@item 
message: String; additional error message elaborating on what was bad about the request
@end itemize
@end quotation

@node oauth2-conversion-failure,oauth2-provider-failure,oauth2-bad-request,Template Customization
@anchor{taler-exchange-manual oauth2-conversion-failure}@anchor{5f}
@section oauth2-conversion-failure


Converting the KYC data into the exchange’s internal
format failed (HTTP 502 Bad Gateway).

This template is instantiated using the following information:

@quotation


@itemize *

@item 
ec: Integer; numeric Taler error code, should be shown to indicate the
error compactly for reporting to developers

@item 
hint: String; human-readable Taler error code, should be shown for the
user to understand the error

@item 
debug: Bool; true if we are running in debug mode and are allowed to return HTML with potentially sensitive information

@item 
converter: String; name of the conversion command that failed which was used by the Exchange

@item 
attributes: Object; attributes returned by the conversion command, often NULL (after all, conversion failed)

@item 
message: error message elaborating on the conversion failure
@end itemize
@end quotation

@node oauth2-provider-failure,persona-exchange-unauthorized,oauth2-conversion-failure,Template Customization
@anchor{taler-exchange-manual oauth2-provider-failure}@anchor{60}
@section oauth2-provider-failure


We did not get an acceptable response from the OAuth2
provider (HTTP 502 Bad Gateway).

This template is instantiated using the following information:

@quotation


@itemize *

@item 
ec: Integer; numeric Taler error code, should be shown to indicate the
error compactly for reporting to developers

@item 
hint: String; human-readable Taler error code, should be shown for the
user to understand the error

@item 
message: String; could be NULL; text elaborating on the details of the failure
@end itemize
@end quotation

@node persona-exchange-unauthorized,persona-load-failure,oauth2-provider-failure,Template Customization
@anchor{taler-exchange-manual persona-exchange-unauthorized}@anchor{61}
@section persona-exchange-unauthorized


The Persona server refused our request (HTTP 403 Forbidden from Persona, returned as a HTTP 502 Bad Gateway).

This template is instantiated using the following information:

@quotation


@itemize *

@item 
ec: Integer; numeric Taler error code, should be shown to indicate the
error compactly for reporting to developers

@item 
hint: String; human-readable Taler error code, should be shown for the
user to understand the error

@item 
data: Object; data returned from Persona service, optional

@item 
persona_http_status: Integer; HTTP status code returned by Persona
@end itemize
@end quotation

@node persona-load-failure,persona-exchange-unpaid,persona-exchange-unauthorized,Template Customization
@anchor{taler-exchange-manual persona-load-failure}@anchor{62}
@section persona-load-failure


The Persona server refused our request (HTTP 429 Too Many Requests from Persona, returned as a HTTP 503 Service Unavailable).

This template is instantiated using the following information:

@quotation


@itemize *

@item 
ec: Integer; numeric Taler error code, should be shown to indicate the
error compactly for reporting to developers

@item 
hint: String; human-readable Taler error code, should be shown for the
user to understand the error

@item 
data: Object; data returned from Persona service, optional

@item 
persona_http_status: Integer; HTTP status code returned by Persona
@end itemize
@end quotation

@node persona-exchange-unpaid,persona-logic-failure,persona-load-failure,Template Customization
@anchor{taler-exchange-manual persona-exchange-unpaid}@anchor{63}
@section persona-exchange-unpaid


The Persona server refused our request (HTTP 402 Payment REquired from Persona, returned as a HTTP 503 Service Unavailable).

This template is instantiated using the following information:

@quotation


@itemize *

@item 
ec: Integer; numeric Taler error code, should be shown to indicate the
error compactly for reporting to developers

@item 
hint: String; human-readable Taler error code, should be shown for the
user to understand the error

@item 
data: Object; data returned from Persona service, optional

@item 
persona_http_status: Integer; HTTP status code returned by Persona
@end itemize
@end quotation

@node persona-logic-failure,persona-invalid-response,persona-exchange-unpaid,Template Customization
@anchor{taler-exchange-manual persona-logic-failure}@anchor{64}
@section persona-logic-failure


The Persona server refused our request (HTTP 400, 403, 409, 422 from Persona, returned as a HTTP 502 Bad Gateway).

This template is instantiated using the following information:

@quotation


@itemize *

@item 
ec: Integer; numeric Taler error code, should be shown to indicate the
error compactly for reporting to developers

@item 
hint: String; human-readable Taler error code, should be shown for the
user to understand the error

@item 
data: Object; data returned from Persona service, optional

@item 
persona_http_status: Integer; HTTP status code returned by Persona
@end itemize
@end quotation

@node persona-invalid-response,persona-network-timeout,persona-logic-failure,Template Customization
@anchor{taler-exchange-manual persona-invalid-response}@anchor{65}
@section persona-invalid-response


The Persona server refused our request in an
unexpected way; returned as a HTTP 502 Bad Gateway.

This template is instantiated using the following information:

@quotation


@itemize *

@item 
ec: Integer; numeric Taler error code, should be shown to indicate the
error compactly for reporting to developers

@item 
hint: String; human-readable Taler error code, should be shown for the
user to understand the error

@item 
debug: Bool; true if we are running in debug mode and are allowed to return HTML with potentially sensitive information

@item 
server_response: Object; could be NULL; this includes the (malformed) OAuth2 server response, it should be shown to the use if “debug” is true
@end itemize
@end quotation

@node persona-network-timeout,persona-kyc-failed,persona-invalid-response,Template Customization
@anchor{taler-exchange-manual persona-network-timeout}@anchor{66}
@section persona-network-timeout


The Persona server refused our request (HTTP 408 from Persona, returned as a HTTP 504 Gateway Timeout).

This template is instantiated using the following information:

@quotation


@itemize *

@item 
ec: Integer; numeric Taler error code, should be shown to indicate the
error compactly for reporting to developers

@item 
hint: String; human-readable Taler error code, should be shown for the
user to understand the error

@item 
data: Object; data returned from Persona service, optional

@item 
persona_http_status: Integer; HTTP status code returned by Persona
@end itemize
@end quotation

@node persona-kyc-failed,persona-provider-failure,persona-network-timeout,Template Customization
@anchor{taler-exchange-manual persona-kyc-failed}@anchor{67}
@section persona-kyc-failed


The Persona server indicated a problem with the KYC process, saying it was not completed.

This template is instantiated using the following information:

@quotation


@itemize *

@item 
persona_inquiry_id: String; internal ID of the inquiry within Persona, useful for further diagnostics by staff

@item 
data: Object; could be NULL; this includes the server response, it contains extensive diagnostics, see Persona documentation on their @code{/api/v1/inquiries/$ID}.

@item 
persona_http_status: Integer; HTTP status code returned by Persona
@end itemize
@end quotation

@node persona-provider-failure,,persona-kyc-failed,Template Customization
@anchor{taler-exchange-manual persona-provider-failure}@anchor{68}
@section persona-provider-failure


The Persona server refused our request (HTTP 500 from Persona, returned as a HTTP 502 Bad Gateway).

This template is instantiated using the following information:

@quotation


@itemize *

@item 
ec: Integer; numeric Taler error code, should be shown to indicate the
error compactly for reporting to developers

@item 
hint: String; human-readable Taler error code, should be shown for the
user to understand the error

@item 
data: Object; data returned from Persona service, optional

@item 
persona_http_status: Integer; HTTP status code returned by Persona
@end itemize
@end quotation

@node Benchmarking,FIXMEs,Template Customization,Top
@anchor{taler-exchange-manual benchmarking}@anchor{69}@anchor{taler-exchange-manual exchangebenchmarking}@anchor{6a}
@chapter Benchmarking


This chapter describes how to run various benchmarks against a Taler exchange.
These benchmark can be used to measure the performance of the exchange by
running a (possibly large) number of simulated clients against one Taler
deployment with a bank, exchange and (optionally) auditor.

Real benchmarks that are intended to demonstrate the scalability of GNU Taler
should not use the tools presented in this section: they may be suitable for
microbenchmarking and tuning, but the setup is inherently not optimzied for
performance or realism, both for the load generation and the server side.
Thus, we do not recommend using these performance numbers to assess the
scalability of GNU Taler.  That said, the tools can be useful to help identify
performance issues.

The @code{taler-unified-setup.sh} script can be used to launch all required
services and clients. However, the resulting deployment is simplistic
(everything on the local machine, one single-threaded process per service
type) and not optimized for performance at all. However, this can still be
useful to assess the performance impact of changes
to the code or configuration.

The various configuration files used in the code snippets in this section can
be found in the @code{src/benchmark/} directory of the exchange. These are
generally intended as starting points.  Note that the configuration files
ending in @code{.edited} are created by @code{taler-unified-setup.sh} and contain
some options that are determined at runtime by the setup logic provided by
@code{taler-unified-setup.sh}.

@menu
* Choosing a bank:: 
* taler-bank-benchmark:: 
* taler-exchange-benchmark:: 
* taler-aggregator-benchmark:: 

@end menu

@node Choosing a bank,taler-bank-benchmark,,Benchmarking
@anchor{taler-exchange-manual benchmark-choose-bank}@anchor{6b}@anchor{taler-exchange-manual choosing-a-bank}@anchor{6c}
@section Choosing a bank


For the bank, both a fakebank (@code{-f}) and libeufin-based (@code{-ns})
bank deployment are currently supported by all benchmark tools and
configuration templates.

Fakebank is an ultra-fast in-memory implementation of the Taler bank API. It
is suitable when the goal is to benchmark the core GNU Taler payment system
and to ignore the real-time gross settlement (RTGS) system typically provided
by an existing bank.  When using the fakebank, @code{taler-unified-setup.sh} must
be started with the @code{-f} option and be told to use the right exchange bank
account from the configuration files via @code{-u exchange-account-1}.

@example
$ dropdb talercheck; createdb talercheck
$ taler-unified-setup.sh -emwt -c $CONF -f -u exchange-account-1
@end example

libeufin is GNU Taler’s adapter to the core banking system using the EBICS
banking protocol standard.  It uses a Postgres database to persist data and is
thus much slower than fakebank.  If your GNU Taler deployment uses libeufin in
production, it likely makes sense to benchmark with libeufin.  When using the
fakebank, @code{taler-unified-setup.sh} must be started with the @code{-ns} options
(starting libeufin-nexus and libeufin-sandbox) and be told to use the right
exchange bank account from the configuration files via @code{-u
exchange-account-2}.  Note that @code{taler-unified-setup.sh} currently cannot
reset a libeufin database, and also will not run if the database is already
initialized. Thus, you must re-create the database every time before
running the command:

@example
$ dropdb talercheck; createdb talercheck
$ taler-unified-setup.sh -emwt -c $CONF -ns -u exchange-account-2
@end example

@node taler-bank-benchmark,taler-exchange-benchmark,Choosing a bank,Benchmarking
@anchor{taler-exchange-manual taler-bank-benchmark}@anchor{6d}
@section taler-bank-benchmark


This is the simplest benchmarking tool, simulating only the bank
interaction.

@example
$ CONF="benchmark-cs.conf"
$ # or with libeufin
$ dropdb talercheck; createdb talercheck
$ taler-unified-setup.sh -emwt -c "$CONF" -f -u exchange-account-1
$ # Once <<READY>>, in another shell (remember to set $CONF):
$ time taler-bank-benchmark -c "$CONF" -r 40 -p 4 -P4 -u exchange-account-1 -f
$ # or with libeufin
$ dropdb talercheck; createdb talercheck
$ taler-unified-setup.sh -emwt -c "$CONF" -ns -u exchange-account-2
$ # Once <<READY>>, in another shell (remember to set $CONF):
$ time taler-bank-benchmark -c "$CONF" -r 40 -p 1 -P1 -u exchange-account-2
@end example

For each `parallel' (@code{-p}) client, a number of `reserves' (@code{-r}) is first
established by `transferring' money from a “user” account (42) to the
Exchange’s account with the respective reserve public key as wire subject.
Processing is then handled by `parallel' (@code{-P}) service workers.

@node taler-exchange-benchmark,taler-aggregator-benchmark,taler-bank-benchmark,Benchmarking
@anchor{taler-exchange-manual taler-exchange-benchmark}@anchor{6e}
@section taler-exchange-benchmark


This is the benchmarking tool simulates a number of clients withdrawing,
depositing and refreshing coins.  Operations that are not covered by the
@code{taler-exchange-benchmark} tool today include closing reserves, refunds,
recoups and P2P payments.

@example
$ CONF="benchmark-cs.conf" # -rsa also makes sense
$ # With fakebank
$ dropdb talercheck; createdb talercheck
$ taler-unified-setup.sh -aemwt -c "$CONF" -f -u exchange-account-1
$ # Once <<READY>>, in another shell (remember to set $CONF):
$ taler-exchange-benchmark -c "$CONF".edited -u exchange-account-1 -n 1 -p1 -r 5 -f
$ #
$ # With libeufin
$ dropdb talercheck; createdb talercheck
$ taler-unified-setup.sh -aemwt -c "$CONF" -ns -u exchange-account-2
$ # Once <<READY>>, in another shell (remember to set $CONF):
$ taler-exchange-benchmark -c "$CONF".edited -u exchange-account-2 -L WARNING -n 1 -p1 -r 5
@end example

For each `parallel' (@code{-p}) client, a number of `reserves' (@code{-r}) is first
established by `transferring' money from a “user” account (42) to the
Exchange’s account with the respective reserve public key as wire subject.
Next, the client will `withdraw' a `number of coins' (@code{-n}) from the
reserve and `deposit' them. Additionally, a `fraction' (@code{-R}) of the dirty
coins will then be subject to `refreshing'.  For some deposits, the auditor
will receive `deposit confirmations'.

The output of @code{taler-exchange-benchmark} will include for each parallel
client the total time spent in each of the major operations, possible
repetitions (i.e. if the operation failed the first time), total execution
time (operating system and user space) and other details.

@node taler-aggregator-benchmark,,taler-exchange-benchmark,Benchmarking
@anchor{taler-exchange-manual taler-aggregator-benchmark}@anchor{6f}
@section taler-aggregator-benchmark


This is another simple benchmark tool that merely prepares an exchange
database to run a stand-alone benchmark of the @code{taler-exchange-aggregator}
tool.  After preparing a database and running the tool, you can then
run one or more @code{taler-exchange-aggregator} processes and measure how
quickly they perform the aggregation work.

@example
$ CONF=benchmark-rsa.conf
$ taler-exchange-dbinit -c "$CONF" --reset
$ ./taler-aggregator-benchmark -c "$CONF" -m 500 -r 10 -d 100
$ time taler-exchange-aggregator -c "$CONF" --test
@end example

This above commands will first create 100 deposits with 10 refunds into each
of 500 merchant accounts using randomized time stamps.  Afterwards, it will
time a single aggregator process in @code{--test} mode (asking it to terminate
as soon as there is no more pending work).

@node FIXMEs,Index,Benchmarking,Top
@anchor{taler-exchange-manual fixmes}@anchor{70}
@chapter FIXMEs



@itemize *

@item 
We should have some summary with the inventory of services that should be
running.  Systemd by default doesn’t show this nicely.  Maybe suggest running
“systemd list-dependencies taler-exchange.target”?

@item 
What happens when the TWG doesn’t like one particular outgoing transaction?
How to recover from that as a sysadmin when it happens in practice?
@end itemize

@node Index,,FIXMEs,Top
@unnumbered Index


@printindex ge


@c %**end of body
@bye