api-exchange.rst (34995B)
1 .. 2 This file is part of GNU TALER. 3 Copyright (C) 2014-2025 Taler Systems SA 4 5 TALER is free software; you can redistribute it and/or modify it under the 6 terms of the GNU Affero General Public License as published by the Free Software 7 Foundation; either version 2.1, or (at your option) any later version. 8 9 TALER is distributed in the hope that it will be useful, but WITHOUT ANY 10 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 11 A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. 12 13 You should have received a copy of the GNU Affero General Public License along with 14 TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> 15 16 @author Christian Grothoff 17 @author Özgür Kesim 18 19 ==================== 20 Exchange RESTful API 21 ==================== 22 23 The API specified here follows the :ref:`general conventions <http-common>` 24 for all details not specified in the individual requests. 25 The `glossary <https://docs.taler.net/taler-developer-manual.html#developer-glossary>`_ 26 defines all specific terms used in this section. 27 28 29 --------------- 30 Version History 31 --------------- 32 33 The current protocol version is **v33**. 34 35 * The merchant is currently targeting **v33**. 36 * The AML SPA is currently targeting **v31**. 37 * The KYC SPA is currently targeting **v30**. 38 39 **Version history:** 40 41 * ``v29``: AML reporting on KYC auth transfers 42 * ``v30``: various minor feature additions 43 * ``v31``: improvements for AML reporting 44 * ``v32``: support for extra_wire_subject_metadata 45 * ``v33``: support for wire_transfer_gateway in ``/keys`` and 46 addition of accumulated_total_without_fee in ``/batch-deposit`` 47 48 **Upcoming versions:** 49 50 * ``vRECOUP``: improved recoup protocol 51 * ``vATTEST``: KYC attestation support 52 53 **Ideas for future version:** 54 55 * ``vXXX``: marker for features not yet targeted for release 56 57 58 59 .. include:: tos.rst 60 61 .. _keys: 62 63 --------------------------- 64 Exchange status information 65 --------------------------- 66 67 This API is used by wallets and merchants to obtain global information about 68 the exchange, such as online signing keys, available denominations and the fee 69 structure. This is typically the first call any exchange client makes, as it 70 returns information required to process all of the other interactions with the 71 exchange. The returned information is secured by (1) signature(s) from the exchange, 72 especially the long-term offline signing key of the exchange, which clients should 73 cache; (2) signature(s) from auditors, and the auditor keys should be 74 hard-coded into the wallet as they are the trust anchors for Taler; (3) 75 possibly by using HTTPS. 76 77 78 .. include:: exchange/get-seed.rst 79 80 .. include:: exchange/get-config.rst 81 82 .. include:: exchange/get-keys.rst 83 84 85 ---------------------------------------------- 86 Management operations authorized by master key 87 ---------------------------------------------- 88 89 .. include:: exchange/get-management-keys.rst 90 91 .. include:: exchange/post-management-keys.rst 92 93 .. include:: exchange/post-management-denominations-H_DENOM_PUB-revoke.rst 94 95 .. include:: exchange/post-management-signkeys-EXCHANGE_PUB-revoke.rst 96 97 .. include:: exchange/post-management-auditors.rst 98 99 .. include:: exchange/post-management-auditors-AUDITOR_PUB-disable.rst 100 101 .. include:: exchange/post-management-wire-fee.rst 102 103 .. include:: exchange/post-management-global-fees.rst 104 105 .. include:: exchange/post-management-wire.rst 106 107 .. include:: exchange/post-management-wire-disable.rst 108 109 .. include:: exchange/post-management-drain.rst 110 111 .. include:: exchange/post-management-aml-officers.rst 112 113 .. include:: exchange/post-management-partners.rst 114 115 --------------- 116 Auditor actions 117 --------------- 118 119 .. _auditor_action: 120 121 This part of the API is for the use by auditors interacting with the exchange. 122 123 124 .. include:: exchange/post-auditors-AUDITOR_PUB-H_DENOM_PUB.rst 125 126 127 ---------------- 128 Blinding Prepare 129 ---------------- 130 131 Certain denomination cipher types, such as Clause-Schnorr, require input values 132 from the exchange-side as preparation for the blinding of the coins. See the 133 Bachelor thesis of Gian Demarmels and Lucien Heuzeveldt, 134 `Adding Schnorr’s Blind Signature in Taler <https://www.taler.net/papers/cs-thesis.pdf>`_, 135 for details. 136 137 .. include:: exchange/post-blinding-prepare.rst 138 139 140 141 .. _exchange-withdrawal: 142 143 ---------- 144 Withdrawal 145 ---------- 146 147 This API is used by the wallet to obtain digital coins. 148 149 When transferring money to the exchange such as via SEPA transfers, the exchange creates 150 a *reserve*, which keeps the money from the customer. The customer must 151 specify an EdDSA reserve public key as part of the transfer, and can then 152 withdraw digital coins using the corresponding private key. All incoming and 153 outgoing transactions are recorded under the corresponding public key by the 154 exchange. 155 156 .. note:: 157 158 Eventually the exchange will need to advertise a policy for how long it will 159 keep transaction histories for inactive or even fully drained reserves. We 160 will therefore need some additional handler similar to ``/keys`` to 161 advertise those terms of service. 162 163 164 .. include:: exchange/get-reserves-RESERVE_PUB.rst 165 166 167 168 .. _withdraw: 169 .. include:: exchange/post-withdraw.rst 170 171 172 .. ts:def:: WithdrawRequest 173 174 interface WithdrawRequest { 175 // Cipher that is used for the rerserve's signatures. 176 // For now, only ed25519 signatures are applicable, 177 // but this might change in future versions. 178 cipher: "ED25519"; 179 180 // The reserve's public key, for the the cipher ED25519, 181 // to verify the signature ``reserve_sig``. 182 reserve_pub: EddsaPublicKey; 183 184 // Array of ``n`` hash codes of denomination public keys to order. 185 // The sum of all denomination's values and fees MUST be 186 // at most the balance of the reserve. The balance of 187 // the reserve will be immediatley reduced by that amount. 188 // If ``max_age`` is set, these denominations MUST support 189 // age restriction as defined in the output to /keys. 190 denoms_h: HashCode[]; 191 192 // If set, the maximum age to commit to. This implies: 193 // 1.) it MUST be the same value as the maximum age 194 // of the reserve. 195 // 2.) ``coin_evs`` MUST be an array of ``n*kappa`` 196 // 3.) the denominations in ``denoms_h`` MUST support 197 // age restriction. 198 max_age?: Integer; 199 200 // Master seed for the Clause-Schnorr R-value creation. 201 // MUST match the /blinding-prepare request. 202 // MUST NOT have been used in any prior withdraw request. 203 // MUST be present if one of the fresh coin's 204 // denomination is of type Clause-Schnorr. 205 blinding_seed?: BlindingMasterSeed; 206 207 // Array of blinded coin envelopes of type `CoinEnvelope`. 208 // If ``max_age`` is not set, MUST be n entries. 209 // If ``max_age`` is set, MUST be ``n*kappa`` entries, 210 // arranged in [0..n)..[0..n), with the first n entries 211 // belonging to kappa=0 etc. 212 // In case of age restriction, the exchange will 213 // respond with an index ``gamma``, which is the index 214 // that shall remain undisclosed during the subsequent 215 // reveal phase. 216 // This hash value along with the reserve's public key 217 // will also be used for recoup operations, if needed. 218 coin_evs: CoinEnvelope[]; 219 220 // Signature of `TALER_WithdrawRequestPS` created with 221 // the `reserves's private key <reserve-priv>`. 222 reserve_sig: EddsaSignature; 223 } 224 225 .. ts:def:: WithdrawResponse 226 227 interface WithdrawResponse { 228 // Array of blinded signatures over each ``coin_evs``, 229 // in the same order as was given in the request. 230 // The blinded signatures affirm the coin's validity 231 // after unblinding. 232 ev_sigs: BlindedDenominationSignature[]; 233 234 } 235 236 237 .. ts:def:: AgeWithdrawResponse 238 239 interface AgeWithdrawResponse { 240 // index of the commitments that the client doesn't 241 // have to disclose in the subsequent call to 242 // ``/reveal-withdraw``. 243 noreveal_index: Integer; 244 245 // Signature of `TALER_WithdrawConfirmationPS` whereby 246 // the exchange confirms the ``noreveal_index``. 247 exchange_sig: EddsaSignature; 248 249 // `Public EdDSA key <sign-key-pub>` of the exchange that was used to 250 // generate the signature. Should match one of the exchange's signing 251 // keys from ``/keys``. Again given explicitly as the client might 252 // otherwise be confused by clock skew as to which signing key was used. 253 exchange_pub: EddsaPublicKey; 254 255 } 256 257 .. ts:def:: DenominationGoneMessage 258 259 interface DenominationGoneMessage { 260 261 // Taler error code. Note that beyond 262 // expiration this message format is also 263 // used if the key is not yet valid, or 264 // has been revoked. May be one of 265 // - ``TALER_EC_EXCHANGE_GENERIC_DENOMINATION_VALIDITY_IN_FUTURE`` 266 // - ``TALER_EC_EXCHANGE_GENERIC_DENOMINATION_EXPIRED`` 267 // - ``TALER_EC_EXCHANGE_GENERIC_DENOMINATION_REVOKED`` 268 code: Integer; 269 270 // Signature by the exchange over a 271 // `TALER_DenominationExpiredAffirmationPS`. 272 // Must have purpose ``TALER_SIGNATURE_EXCHANGE_AFFIRM_DENOM_EXPIRED``. 273 exchange_sig: EddsaSignature; 274 275 // Public key of the exchange used to create 276 // the 'exchange_sig. 277 exchange_pub: EddsaPublicKey; 278 279 // Hash of the denomination public key that is unknown. 280 h_denom_pub: HashCode; 281 282 // When was the signature created. 283 timestamp: Timestamp; 284 285 // What kind of operation was requested that now 286 // failed? 287 oper: string; 288 289 } 290 291 292 .. ts:def:: WithdrawError 293 294 interface SingleWithdrawError { 295 // Text describing the error. 296 hint: string; 297 298 // Detailed error code. 299 code: Integer; 300 301 // Amount left in the reserve. 302 balance: Amount; 303 304 } 305 306 307 308 ------------------ 309 310 311 .. _reveal-withdraw: 312 313 **Reveal-Withdraw** 314 315 This endpoint is called by the client after a call to `withdraw`_, 316 *if* the original request had ``max_age`` set and 317 the response was of type `AgeWithdrawResponse`. 318 Now the client has to disclose for each coin all but one of the κ secrets 319 that went into creating the blinded coin's planchets, 320 including the commitment to age restriction, 321 and prove that the age restriction was set correctly. 322 323 .. include:: exchange/post-reveal-withdraw.rst 324 325 326 327 ---------- 328 Refreshing 329 ---------- 330 331 Refreshing creates ``n`` new coins from ``m`` old coins, where the sum of 332 denominations of the new coins must be smaller than the sum of the old coins' 333 denominations plus melting (refresh) and withdrawal fees charged by the exchange. 334 The refreshing API can be used by wallets to melt partially spent coins, making 335 transactions with the freshly exchangeed coins unlinkabe to previous transactions 336 by anyone except the wallet itself. 337 338 Refreshing is a two step process, consisting of 339 340 1. the **melting** of the old coin, together with ``kappa`` batches 341 of blinded planchets candidates, 342 2. the **reveal** of ``kappa-1`` secrets to prove the proper construction 343 of the (revealed) batches of blinded planchets candidates. 344 345 346 ^^^^ 347 Melt 348 ^^^^ 349 350 .. _melt: 351 .. include:: exchange/post-melt.rst 352 353 ^^^^^^^^^^^ 354 Reveal-Melt 355 ^^^^^^^^^^^ 356 357 This endpoint is called by the client after a call to `melt`_. 358 Now the client has to disclose --for each coin-- 359 all but one of the κ secrets that went into creating the blinded coin's planchets, 360 the transfer public keys (linking the ownership of the old and new coin), 361 and the commitment to age restriction, 362 as proof that the age restriction was set correctly (if applicable). 363 364 .. include:: exchange/post-reveal-melt.rst 365 366 367 .. _deposit-par: 368 369 ------- 370 Deposit 371 ------- 372 373 Deposit operations are requested f.e. by a merchant during a transaction or a 374 bidder during an auction. 375 376 For the deposit operation during purchase, the merchant has to obtain the 377 deposit permission for a coin from their customer who owns the coin. When 378 depositing a coin, the merchant is credited an amount specified in the deposit 379 permission, possibly a fraction of the total coin's value, minus the deposit 380 fee as specified by the coin's denomination. 381 382 For auctions, a bidder performs an deposit operation and provides all relevant 383 information for the auction policy (such as timeout and public key as bidder) 384 and can use the ``exchange_sig`` field from the `DepositSuccess` message as a 385 proof to the seller for the escrow of sufficient fund. 386 387 388 .. _deposit: 389 390 .. include:: exchange/post-batch-deposit.rst 391 392 393 394 ------ 395 Recoup 396 ------ 397 398 The purpose of this API is to allow coins to be cashed back in, 399 in certain exceptional situations. 400 This API is only used if the exchange is either about to go out of 401 business or has had its private signing keys compromised (so in 402 either case, the protocol is only used in **abnormal** 403 situations). In the above cases, the exchange signals to the 404 wallets that the emergency cash back protocol has been activated 405 by putting the affected denomination keys into the cash-back 406 part of the ``/keys`` response. If and only if this has happened, 407 coins that were signed with those denomination keys can be cashed 408 in using this API. 409 410 For a recoup, a coin has to provide the necessary information to 411 identify the original transaction (either a withdraw or a refresh) it 412 became minted, and proof ownership of the coin itself. 413 414 415 .. include:: exchange/post-recoup-withdraw.rst 416 417 418 .. include:: exchange/post-recoup-refresh.rst 419 420 421 422 .. _exchange_refund: 423 424 ------- 425 Refunds 426 ------- 427 428 .. include:: exchange/post-coins-COIN_PUB-refund.rst 429 430 431 .. _reserve-history: 432 433 --------------- 434 Reserve History 435 --------------- 436 437 .. include:: exchange/get-reserves-RESERVE_PUB-history.rst 438 439 440 441 .. _coin-history: 442 443 ------------ 444 Coin History 445 ------------ 446 447 .. include:: exchange/get-coins-COIN_PUB-history.rst 448 449 Obtain the transaction history of a coin. Used only in special cases, like 450 when the exchange claims a double-spending error and the wallet does not 451 believe it. Usually, the wallet knows the transaction history of each coin 452 and thus has no need to inquire. 453 454 **Request:** 455 456 The GET request should come with the following HTTP headers: 457 458 *If-None-Match*: 459 The client MAY provide an ``If-None-Match`` header with an 460 Etag. In that case, the server MUST additionally respond with an ``304`` 461 status code in case the coin history matches the provided Etag. 462 463 *Taler-Coin-History-Signature*: 464 The client MUST provide Base-32 encoded EdDSA signature over a 465 ``TALER_SIGNATURE_COIN_HISTORY_REQUEST`` made with the respective 466 ``$COIN_PRIV``, affirming desire to download the current coin 467 transaction history. 468 469 :query start=OFFSET: *Optional.* Only return coin history entries with 470 offsets above the given OFFSET. Allows clients to not 471 retrieve history entries they already have. 472 473 **Response:** 474 475 :http:statuscode:`200 OK`: 476 The operation succeeded, the exchange confirms that no double-spending took 477 place. The response will include a `CoinHistoryResponse` object. 478 :http:statuscode:`204 No content`: 479 The reserve history is known, but at this point from the given starting point it is empty. Can only happen if OFFSET was positive. 480 :http:statuscode:`304 Not modified`: 481 The coin history has not changed since the previous query (detected via Etag 482 in "If-none-match" header). 483 :http:statuscode:`403 Forbidden`: 484 The *TALER_SIGNATURE_COIN_HISTORY_REQUEST* is invalid. 485 This response comes with a standard `ErrorDetail` response. 486 :http:statuscode:`404 Not found`: 487 The coin public key is not (yet) known to the exchange. 488 489 **Details:** 490 491 .. ts:def:: CoinHistoryResponse 492 493 interface CoinHistoryResponse { 494 // Current balance of the coin. 495 balance: Amount; 496 497 // Hash of the coin's denomination. 498 h_denom_pub: HashCode; 499 500 // Transaction history for the coin. 501 history: CoinSpendHistoryItem[]; 502 } 503 504 .. ts:def:: CoinSpendHistoryItem 505 506 // Union discriminated by the "type" field. 507 type CoinSpendHistoryItem = 508 | CoinDepositTransaction 509 | CoinMeltTransaction 510 | CoinRefundTransaction 511 | CoinRecoupWithdrawTransaction 512 | CoinRecoupRefreshTransaction 513 | CoinRecoupRefreshReceiverTransaction 514 | CoinPurseDepositTransaction 515 | CoinPurseRefundTransaction 516 | CoinReserveOpenDepositTransaction; 517 518 .. ts:def:: CoinDepositTransaction 519 520 interface CoinDepositTransaction { 521 type: "DEPOSIT"; 522 523 // Offset of this entry in the reserve history. 524 // Useful to request incremental histories via 525 // the "start" query parameter. 526 history_offset: Integer; 527 528 // The total amount of the coin's value absorbed (or restored in the 529 // case of a refund) by this transaction. 530 // The amount given includes 531 // the deposit fee. The current coin value can thus be computed by 532 // subtracting this amount. 533 amount: Amount; 534 535 // Deposit fee. 536 deposit_fee: Amount; 537 538 // Public key of the merchant. 539 merchant_pub: EddsaPublicKey; 540 541 // Date when the operation was made. 542 timestamp: Timestamp; 543 544 // Date until which the merchant can issue a refund to the customer via the 545 // exchange, possibly zero if refunds are not allowed. 546 refund_deadline?: Timestamp; 547 548 // Hash over the proposal data of the contract that 549 // is being paid. 550 h_contract_terms: HashCode; 551 552 // Hash of the bank account from where we received the funds. 553 h_wire: HashCode; 554 555 // Hash of the public denomination key used to sign the coin. 556 // Needed because 'coin_sig' signs over this, and 557 // that is important to fix the coin's denomination. 558 h_denom_pub: HashCode; 559 560 // Hash over the deposit policy extension. Optional. 561 h_policy?: HashCode; 562 563 // Hash over auxiliary wallet data provided by the wallet 564 // to complete the contract. Optional. 565 wallet_data_hash?: HashCode; 566 567 // Hash over the age commitment of the coin. Optional. 568 h_age_commitment?: HashCode; 569 570 // Signature over `TALER_DepositRequestPS`, made by the customer with the 571 // `coin's private key <coin-priv>`. 572 coin_sig: EddsaSignature; 573 574 } 575 576 .. ts:def:: CoinMeltTransaction 577 578 interface CoinMeltTransaction { 579 type: "MELT"; 580 581 // Offset of this entry in the reserve history. 582 // Useful to request incremental histories via 583 // the "start" query parameter. 584 history_offset: Integer; 585 586 // The total amount of the coin's value absorbed by this transaction. 587 // Note that for melt this means the amount given includes 588 // the melt fee. The current coin value can thus be computed by 589 // subtracting the amounts. 590 amount: Amount; 591 592 // Melt fee. 593 melt_fee: Amount; 594 595 // Commitment from the melt operation, see `TALER_RefreshCommitmentP` 596 rc: HashCode; 597 598 // Hash of the public denomination key used to sign the old coin. 599 // Needed because 'coin_sig' signs over this, and 600 // that is important to fix the coin's denomination. 601 old_denom_pub_h: HashCode; 602 603 // Hash over the age commitment of the coin. Optional. 604 old_age_commitment_h?: AgeCommitmentHash; 605 606 // @since **v32** 607 // This value is opaque to the exchange. It was provided by the client 608 // as part of the original refresh request, and was therefore verified 609 // with the confirm_sig below. 610 // If the reveal step was not performed yet by the old coin owner, 611 // they can use this value and the old coin's private key to derive 612 // all indivual seeds for the n*κ coin candidates for the original 613 // refresh request and replay it 614 refresh_seed: HashCode; 615 616 // @since **v32** 617 // The kappa*n list of transfer public keys that were provided by the 618 // old coin owner during the melt request. 619 transfer_pubs: EddsaPublicKey[kappa][]; 620 621 // @since **v32** 622 // The n denomination public keys for the fresh coins 623 // that the coin owner had requested. 624 denoms_h: HashCode[]; 625 626 // @since **v32** 627 // The ``noreveal_index`` value that was returned by the exchange as response 628 // to the melt request. 629 noreveal_index: Integer; 630 631 // @since **v32** 632 // If the reveal step was successfully peformed by the coin owner, 633 // this field contains the blind coin signatures that were returned 634 // by the exchange for the chosen batch of coins. 635 ev_sigs?: BlindedDenominationSignature[]; 636 637 // Master seed for the Clause-Schnorr R-value 638 // Present if one of the fresh coin's 639 // denominations is of type Clause-Schnorr. 640 blinding_seed?: BlindingMasterSeed; 641 642 // Signature by the coin over a 643 // `TALER_RefreshMeltCoinAffirmationPS` of 644 // purpose ``TALER_SIGNATURE_WALLET_COIN_MELT``. 645 confirm_sig: EddsaSignature; 646 647 } 648 649 .. ts:def:: CoinRefundTransaction 650 651 interface CoinRefundTransaction { 652 type: "REFUND"; 653 654 // Offset of this entry in the reserve history. 655 // Useful to request incremental histories via 656 // the "start" query parameter. 657 history_offset: Integer; 658 659 // The total amount of the coin's value restored 660 // by this transaction. 661 // The amount given excludes the transaction fee. 662 // The current coin value can thus be computed by 663 // adding the amounts to the coin's denomination value. 664 amount: Amount; 665 666 // Refund fee. 667 refund_fee: Amount; 668 669 // Hash over the proposal data of the contract that 670 // is being refunded. 671 h_contract_terms: HashCode; 672 673 // Public key of the merchant. 674 merchant_pub: EddsaPublicKey; 675 676 // Refund transaction ID. 677 rtransaction_id: Integer; 678 679 // `EdDSA Signature <eddsa-sig>` authorizing the REFUND over a 680 // `TALER_MerchantRefundConfirmationPS` with 681 // purpose ``TALER_SIGNATURE_MERCHANT_REFUND_OK``. Made with 682 // the `public key of the merchant <merchant-pub>`. 683 merchant_sig: EddsaSignature; 684 685 } 686 687 688 .. note:: 689 690 The `CoinRecoupWithdrawTransaction` interface defintion is WIP. 691 It will be fully specified and implemented with **vRECOUP**. 692 693 .. ts:def:: CoinRecoupWithdrawTransaction 694 695 // This represents a transaction of a call to /recoup-withdraw 696 // where the coin's residual value has been credited to the 697 // original reserve, from which this coin was withdrawn. 698 interface CoinRecoupWithdrawTransaction { 699 type: "RECOUP-WITHDRAW"; 700 701 // Offset of this entry in the reserve history. 702 // Useful to request incremental histories via 703 // the "start" query parameter. 704 history_offset: Integer; 705 706 // The total amount of the coin's value absorbed 707 // by this transaction. 708 // The current coin value can thus be computed by 709 // subtracting the amount from 710 // the coin's denomination value. 711 amount: Amount; 712 713 // Signature by the exchange over a 714 // `TALER_RecoupConfirmationPS`, must be 715 // of purpose ``TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP``. 716 exchange_sig: EddsaSignature; 717 718 // Public key of the private key used to create 'exchange_sig'. 719 exchange_pub: EddsaPublicKey; 720 721 // Signature by the coin over a 722 // `TALER_RecoupRequestPS` with purpose 723 // ``TALER_SIGNATURE_WALLET_COIN_RECOUP``. 724 coin_sig: EddsaSignature; 725 726 // Hash of the public denomination key used to sign the coin. 727 // Needed because 'coin_sig' signs over this, and 728 // that is important to fix the coin's denomination. 729 h_denom_pub: HashCode; 730 731 // Coin blinding key that was used in the original withdraw request. 732 coin_blind: DenominationBlindingKeyP; 733 734 // The hash of the withdraw commitment of the original withdraw 735 // request that this coin was part of 736 h_commitment: HashCode; 737 738 // Coin's index in the original withdraw request, starting at 0 739 coin_index: Integer; 740 741 // Reserve receiving the recoup. 742 reserve_pub: EddsaPublicKey; 743 744 // Date when the operation was made. 745 timestamp: Timestamp; 746 747 } 748 749 750 .. note:: 751 752 The `CoinRecoupRefreshTransaction` interface defintion is WIP. 753 It will be fully specified and implemented with **vRECOUP**. 754 755 .. ts:def:: CoinRecoupRefreshTransaction 756 757 // This represents a transaction of a call to /recoup-refresh 758 // where this coin was _part_ of the batch of coins whose 759 // residual values were credited to the original coin, from 760 // which also this coin was refresh from. 761 interface CoinRecoupRefreshTransaction { 762 type: "RECOUP-REFRESH"; 763 764 // Offset of this entry in the reserve history. 765 // Useful to request incremental histories via 766 // the "start" query parameter. 767 history_offset: Integer; 768 769 // The total amount of the coin's value absorbed 770 // by this transaction. 771 // The current coin value can thus be computed by 772 // subtracting this amounts from 773 // the coin's denomination value. 774 amount: Amount; 775 776 // Signature by the exchange over a 777 // `TALER_RecoupRefreshConfirmationPS` 778 // of purpose ``TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP_REFRESH``. 779 exchange_sig: EddsaSignature; 780 781 // Public key used to sign 'exchange_sig'. 782 exchange_pub: EddsaPublicKey; 783 784 // The original coin, from which this coin was derived from 785 // in a call to /refresh, and which was then credited with 786 // the residual value of this coin in a call to /recoup-refresh. 787 old_coin_pub: EddsaPublicKey; 788 789 // Signature by the coin over a `TALER_RecoupRequestPS` 790 // with purpose ``TALER_SIGNATURE_WALLET_COIN_RECOUP``. 791 coin_sig: EddsaSignature; 792 793 // Hash of the public denomination key used to sign the coin. 794 // Needed because 'coin_sig' signs over this, and 795 // that is important to fix the coin's denomination. 796 h_denom_pub: HashCode; 797 798 // Coin blinding key that was used in the original refresh request. 799 coin_blind: DenominationBlindingKeyP; 800 801 // The hash of the refresh commitment of the original refresh 802 // request that this coin was derived from. 803 h_commitment: HashCode; 804 805 // Coin's index in the original refresh request, starting at 0 806 coin_index: Integer; 807 808 // Blinding factor of the revoked new coin. 809 new_coin_blinding_secret: DenominationBlindingKeySecret; 810 811 // Blinded public key of the revoked new coin. 812 new_coin_ev: DenominationBlindingKeySecret; 813 814 // Date when the operation was made. 815 timestamp: Timestamp; 816 817 } 818 819 820 .. note:: 821 822 The `CoinRecoupRefreshReceiverTransaction` interface defintion is WIP. 823 It will be fully specified and implemented with **vRECOUP**. 824 825 .. ts:def:: CoinRecoupRefreshReceiverTransaction 826 827 // This represents a transaction of a call to /recoup-refresh 828 // where this coin was the _receiver_ of the residual values 829 // from coins, that originated from a call to /refresh of this coin. 830 interface CoinRecoupRefreshReceiverTransaction { 831 type: "RECOUP-REFRESH-RECEIVER"; 832 833 // Offset of this entry in the reserve history. 834 // Useful to request incremental histories via 835 // the "start" query parameter. 836 history_offset: Integer; 837 838 // The total amount of the coin's value restored 839 // by this transaction. 840 // The current coin value can thus be computed by 841 // adding the amount to the coin's denomination value. 842 amount: Amount; 843 844 // Date when the operation was made. 845 timestamp: Timestamp; 846 847 // Signature by the exchange over a 848 // `TALER_RecoupRefreshConfirmationPS` 849 // of purpose ``TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP_REFRESH``. 850 exchange_sig: EddsaSignature; 851 852 // Public key of the private key used to create 'exchange_sig'. 853 exchange_pub: EddsaPublicKey; 854 855 } 856 857 .. ts:def:: CoinPurseDepositTransaction 858 859 interface CoinPurseDepositTransaction { 860 type: "PURSE-DEPOSIT"; 861 862 // Offset of this entry in the reserve history. 863 // Useful to request incremental histories via 864 // the "start" query parameter. 865 history_offset: Integer; 866 867 // The total amount of the coin's value absorbed 868 // by this transaction. 869 // Note that this means the amount given includes 870 // the deposit fee. The current coin value can thus be computed by 871 // subtracting the amount from 872 // the coin's denomination value. 873 amount: Amount; 874 875 // Base URL of the exchange the purse lives at. 876 exchange_base_url: string; 877 878 // The hash of the age-commitment for the coin. Only present 879 // if the denomination has support for age restriction. 880 h_age_commitment?: AgeCommitmentHash; 881 882 // Deposit fee. 883 deposit_fee: Amount; 884 885 // Public key of the purse. 886 purse_pub: EddsaPublicKey; 887 888 // True if the deposit was refunded for any reason. 889 refunded: boolean; 890 891 // Signature by the coin over a 892 // `TALER_PurseDepositSignaturePS` of 893 // purpose ``TALER_SIGNATURE_PURSE_DEPOSIT``. 894 coin_sig: EddsaSignature; 895 896 // Hash of the public denomination key used to sign the coin. 897 // Needed because 'coin_sig' signs over this, and 898 // that is important to fix the coin's denomination. 899 h_denom_pub: HashCode; 900 901 } 902 903 .. ts:def:: CoinPurseRefundTransaction 904 905 interface CoinPurseRefundTransaction { 906 type: "PURSE-REFUND"; 907 908 // Offset of this entry in the reserve history. 909 // Useful to request incremental histories via 910 // the "start" query parameter. 911 history_offset: Integer; 912 913 // The total amount of the coin's value restored 914 // by this transaction. 915 // The amount given excludes the refund fee. 916 // The current coin value can thus be computed by 917 // adding the amount to the coin's denomination value. 918 amount: Amount; 919 920 // Refund fee (of the coin's denomination). The deposit 921 // fee will be waived. 922 refund_fee: Amount; 923 924 // Signature by the exchange over a 925 // ``TALER_CoinPurseRefundConfirmationPS`` 926 // of purpose ``TALER_SIGNATURE_EXCHANGE_CONFIRM_PURSE_REFUND``. 927 exchange_sig: EddsaSignature; 928 929 // Public key used to sign 'exchange_sig'. 930 exchange_pub: EddsaPublicKey; 931 932 // Public key of the purse that expired. 933 purse_pub: EddsaPublicKey; 934 935 } 936 937 .. ts:def:: CoinReserveOpenDepositTransaction 938 939 interface CoinReserveOpenDepositTransaction { 940 type: "RESERVE-OPEN-DEPOSIT"; 941 942 // Offset of this entry in the reserve history. 943 // Useful to request incremental histories via 944 // the "start" query parameter. 945 history_offset: Integer; 946 947 // The total amount of the coin's value absorbed 948 // by this transaction. 949 // Note that this means the amount given includes 950 // the deposit fee. 951 coin_contribution: Amount; 952 953 // Signature of the reserve open operation being paid for. 954 reserve_sig: EddsaSignature; 955 956 // Signature by the coin over a 957 // `TALER_ReserveOpenDepositSignaturePS` of 958 // purpose ``TALER_SIGNATURE_RESERVE_OPEN_DEPOSIT``. 959 coin_sig: EddsaSignature; 960 961 } 962 963 964 ----------------------- 965 Tracking wire transfers 966 ----------------------- 967 968 This API is used by merchants that need to find out which wire 969 transfers (from the exchange to the merchant) correspond to which deposit 970 operations. Typically, a merchant will receive a wire transfer with a 971 **wire transfer identifier** and want to know the set of deposit 972 operations that correspond to this wire transfer. This is the 973 preferred query that merchants should make for each wire transfer they 974 receive. If a merchant needs to investigate a specific deposit 975 operation (i.e. because it seems that it was not paid), then the 976 merchant can also request the wire transfer identifier for a deposit 977 operation. 978 979 Sufficient information is returned to verify that the coin signatures 980 are correct. This also allows governments to use this API when doing 981 a tax audit on merchants. 982 983 Naturally, the returned information may be sensitive for the merchant. 984 We do not require the merchant to sign the request, as the same requests 985 may also be performed by the government auditing a merchant. 986 However, wire transfer identifiers should have sufficient entropy to 987 ensure that obtaining a successful reply by brute-force is not practical. 988 Nevertheless, the merchant should protect the wire transfer identifiers 989 from his bank statements against unauthorized access, lest his income 990 situation is revealed to an adversary. (This is not a major issue, as 991 an adversary that has access to the line-items of bank statements can 992 typically also view the balance.) 993 994 995 .. include:: exchange/get-transfers-WTID.rst 996 997 .. include:: exchange/get-deposits-H_WIRE-MERCHANT_PUB-H_CONTRACT_TERMS-COIN_PUB.rst 998 999 1000 .. _exchange_w2w: 1001 1002 -------------------------- 1003 Wallet-to-wallet transfers 1004 -------------------------- 1005 1006 .. include:: exchange/get-purses-PURSE_PUB-merge.rst 1007 1008 1009 1010 .. include:: exchange/post-purses-PURSE_PUB-create.rst 1011 1012 1013 .. include:: exchange/delete-purses-PURSE_PUB.rst 1014 1015 1016 .. include:: exchange/post-purses-PURSE_PUB-merge.rst 1017 1018 1019 1020 .. include:: exchange/post-reserves-RESERVE_PUB-purse.rst 1021 1022 .. include:: exchange/get-contracts-CONTRACT_PUB.rst 1023 1024 1025 .. include:: exchange/post-purses-PURSE_PUB-deposit.rst 1026 1027 .. _exchange_wads: 1028 1029 1030 ---- 1031 Wads 1032 ---- 1033 1034 .. note:: 1035 1036 This is a draft API that is not yet implemented. 1037 1038 1039 These endpoints are used to manage exchange-to-exchange payments in support of 1040 wallet-to-wallet payments. Only another exchange should access this endpoint. 1041 1042 1043 .. include:: exchange/get-wads-WAD_ID.rst 1044 1045 1046 ------------------ 1047 KYC status updates 1048 ------------------ 1049 1050 This section describes endpoints used to set up, complete and 1051 inquire about KYC operations performed by an exchange for 1052 regulatory compliance. 1053 1054 .. include:: exchange/post-kyc-wallet.rst 1055 1056 1057 .. include:: exchange/get-kyc-check-H_NORMALIZED_PAYTO.rst 1058 1059 .. include:: exchange/get-kyc-spa-ACCESS_TOKEN.rst 1060 1061 1062 .. include:: exchange/get-kyc-info-ACCESS_TOKEN.rst 1063 1064 .. include:: exchange/post-kyc-upload-ID.rst 1065 1066 .. include:: exchange/post-kyc-start-ID.rst 1067 1068 .. include:: exchange/get-kyc-proof-PROVIDER_NAME.rst 1069 1070 1071 .. include:: exchange/get-kyc-webhook-PROVIDER_NAME-star.rst 1072 1073 1074 -------------- 1075 AML operations 1076 -------------- 1077 1078 This API is only for designated AML officers. It is used 1079 to allow exchange staff to monitor suspicious transactions 1080 and freeze or unfreeze accounts suspected of money laundering. 1081 1082 1083 .. include:: exchange/get-aml-OFFICER_PUB-measures.rst 1084 1085 .. include:: exchange/get-aml-OFFICER_PUB-kyc-statistics-NAMES.rst 1086 1087 1088 .. include:: exchange/get-aml-OFFICER_PUB-decisions.rst 1089 1090 1091 .. include:: exchange/get-aml-OFFICER_PUB-legitimizations.rst 1092 1093 1094 .. include:: exchange/get-aml-OFFICER_PUB-accounts.rst 1095 1096 1097 1098 .. include:: exchange/get-aml-OFFICER_PUB-attributes-H_NORMALIZED_PAYTO.rst 1099 1100 1101 .. include:: exchange/post-aml-OFFICER_PUB-decision.rst 1102 1103 1104 .. include:: exchange/get-aml-OFFICER_PUB-transfers-credit.rst 1105 1106 1107 1108 1109 --------------- 1110 Reserve control 1111 --------------- 1112 1113 This section describes the reserve control API which can be used to (1) 1114 prevent a reserve from expiring, to (2) pay an annual fee to allow a number of 1115 purses to be created for the respective reserve without paying a purse fee 1116 each time, to (3) obtain KYC information associated with a reserve to prove 1117 the identity of the person sending an invoice to the payer, and to (4) close a 1118 reserve before it would naturally expire and possibly (5) wire the funds to a 1119 designated account. 1120 1121 .. note:: 1122 1123 This section is about a proposed API. It is not implemented. See also DD 31. 1124 1125 .. include:: exchange/post-reserves-RESERVE_PUB-open.rst 1126 1127 1128 .. include:: exchange/get-reserves-attest-RESERVE_PUB.rst 1129 1130 1131 .. include:: exchange/post-reserves-attest-RESERVE_PUB.rst 1132 1133 1134 .. include:: exchange/post-reserves-RESERVE_PUB-close.rst 1135 1136 1137 .. _delete-reserve: 1138 1139 .. include:: exchange/delete-reserves-RESERVE_PUB.rst