taler-docs

Documentation for GNU Taler components, APIs and protocols
Log | Files | Refs | README | LICENSE

get-coins-COIN_PUB-history.rst (18218B)


      1 .. http:get:: /coins/$COIN_PUB/history
      2 
      3   Obtain the transaction history of a coin.  Used only in special cases, like
      4   when the exchange claims a double-spending error and the wallet does not
      5   believe it. Usually, the wallet knows the transaction history of each coin
      6   and thus has no need to inquire.
      7 
      8   **Request:**
      9 
     10   *Taler-Coin-History-Signature*:
     11     The client MUST provide Base-32 encoded EdDSA signature over a
     12     ``TALER_SIGNATURE_COIN_HISTORY_REQUEST`` made with the respective
     13     ``$COIN_PRIV``, affirming desire to download the coin's
     14     transaction history.
     15 
     16   *If-None-Match*:
     17     The client MAY provide an ``If-None-Match`` header with an ETag.
     18     The client MAY provide an ``If-None-Match`` header with an
     19     Etag.  In that case, the server MUST additionally respond with an ``304``
     20     status code in case the coin history matches the provided Etag.
     21 
     22   :query start=OFFSET: *Optional.* Only return coin history entries with
     23                        offsets above the given OFFSET. Allows clients to not
     24                        retrieve history entries they already have.
     25 
     26   **Response:**
     27 
     28   :http:statuscode:`200 OK`:
     29     The coin is known to the exchange and the response is
     30     the coin's transaction history.
     31     The response will be a `CoinHistoryResponse` object.
     32   :http:statuscode:`204 No content`:
     33     The reserve history is known, but at this point from the given
     34     starting point it is empty. Can only happen if OFFSET was
     35     positive (and the ETag changed or ``If-None-Match`` was not given).
     36   :http:statuscode:`304 Not modified`:
     37     The coin history has not changed since the previous query
     38     (detected via Etag in "If-none-match" header).
     39   :http:statuscode:`403 Forbidden`:
     40     The *TALER_SIGNATURE_COIN_HISTORY_REQUEST* signature is invalid.
     41     This response comes with a standard `ErrorDetail` response with
     42     a code of ``TALER_EC_EXCHANGE_COIN_HISTORY_BAD_SIGNATURE``.
     43   :http:statuscode:`404 Not found`:
     44     The coin is unknown to the exchange.
     45     This response comes with a standard `ErrorDetail` response with
     46     a code of ``TALER_EC_EXCHANGE_GENERIC_COIN_UNKNOWN``.
     47   :http:statuscode:`500 Internal Server Error`:
     48     The server experienced an internal error.
     49     This response comes with a standard `ErrorDetail` response.
     50     Possible error codes include
     51     ``TALER_EC_GENERIC_DB_FETCH_FAILED``,
     52     ``TALER_EC_GENERIC_DB_SOFT_FAILURE``, or
     53     ``TALER_EC_GENERIC_JSON_ALLOCATION_FAILURE``
     54 
     55   **Details:**
     56 
     57   .. ts:def:: CoinHistoryResponse
     58 
     59     interface CoinHistoryResponse {
     60       // Current balance of the coin.
     61       balance: Amount;
     62 
     63       // Hash of the coin's denomination.
     64       h_denom_pub: HashCode;
     65 
     66       // Transaction history for the coin.
     67       history: CoinSpendHistoryItem[];
     68     }
     69 
     70   .. ts:def:: CoinSpendHistoryItem
     71 
     72     // Union discriminated by the "type" field.
     73     type CoinSpendHistoryItem =
     74       | CoinDepositTransaction
     75       | CoinMeltTransaction
     76       | CoinRefundTransaction
     77       | CoinRecoupWithdrawTransaction
     78       | CoinRecoupRefreshTransaction
     79       | CoinRecoupRefreshReceiverTransaction
     80       | CoinPurseDepositTransaction
     81       | CoinPurseRefundTransaction
     82       | CoinReserveOpenDepositTransaction;
     83 
     84   .. ts:def:: CoinDepositTransaction
     85 
     86     interface CoinDepositTransaction {
     87       type: "DEPOSIT";
     88 
     89       // Offset of this entry in the reserve history.
     90       // Useful to request incremental histories via
     91       // the "start" query parameter.
     92       history_offset: Integer;
     93 
     94       // The total amount of the coin's value absorbed (or restored in the
     95       // case of a refund) by this transaction.
     96       // The amount given includes
     97       // the deposit fee. The current coin value can thus be computed by
     98       // subtracting this amount.
     99       amount: Amount;
    100 
    101       // Deposit fee.
    102       deposit_fee: Amount;
    103 
    104       // Public key of the merchant.
    105       merchant_pub: EddsaPublicKey;
    106 
    107       // Date when the operation was made.
    108       timestamp: Timestamp;
    109 
    110       // Date until which the merchant can issue a refund to the customer via the
    111       // exchange, possibly zero if refunds are not allowed.
    112       refund_deadline?: Timestamp;
    113 
    114       // Hash over the proposal data of the contract that
    115       // is being paid.
    116       h_contract_terms: HashCode;
    117 
    118       // Hash of the bank account from where we received the funds.
    119       h_wire: HashCode;
    120 
    121       // Hash of the public denomination key used to sign the coin.
    122       // Needed because 'coin_sig' signs over this, and
    123       // that is important to fix the coin's denomination.
    124       h_denom_pub: HashCode;
    125 
    126       // Hash over the deposit policy extension. Optional.
    127       h_policy?: HashCode;
    128 
    129       // Hash over auxiliary wallet data provided by the wallet
    130       // to complete the contract. Optional.
    131       wallet_data_hash?: HashCode;
    132 
    133       // Hash over the age commitment of the coin. Optional.
    134       h_age_commitment?: HashCode;
    135 
    136       // Signature over `TALER_DepositRequestPS`, made by the customer with the
    137       // `coin's private key <coin-priv>`.
    138       coin_sig: EddsaSignature;
    139 
    140     }
    141 
    142   .. ts:def:: CoinMeltTransaction
    143 
    144     interface CoinMeltTransaction {
    145       type: "MELT";
    146 
    147       // Offset of this entry in the reserve history.
    148       // Useful to request incremental histories via
    149       // the "start" query parameter.
    150       history_offset: Integer;
    151 
    152       // The total amount of the coin's value absorbed by this transaction.
    153       // Note that for melt this means the amount given includes
    154       // the melt fee. The current coin value can thus be computed by
    155       // subtracting the amounts.
    156       amount: Amount;
    157 
    158       // Melt fee.
    159       melt_fee: Amount;
    160 
    161       // Commitment from the melt operation, see `TALER_RefreshCommitmentP`
    162       rc: HashCode;
    163 
    164       // Hash of the public denomination key used to sign the old coin.
    165       // Needed because 'coin_sig' signs over this, and
    166       // that is important to fix the coin's denomination.
    167       old_denom_pub_h: HashCode;
    168 
    169       // Hash over the age commitment of the coin. Optional.
    170       old_age_commitment_h?: AgeCommitmentHash;
    171 
    172       // @since **v32**
    173       // This value is opaque to the exchange.  It was provided by the client
    174       // as part of the original refresh request, and was therefore verified
    175       // with the confirm_sig below.
    176       // If the reveal step was not performed yet by the old coin owner,
    177       // they can use this value and the old coin's private key to derive
    178       // all indivual seeds for the n*κ coin candidates for the original
    179       // refresh request and replay it
    180       refresh_seed: HashCode;
    181 
    182       // @since **v32**
    183       // The kappa*n list of transfer public keys that were provided by the
    184       // old coin owner during the melt request.
    185       transfer_pubs: EddsaPublicKey[kappa][];
    186 
    187       // @since **v32**
    188       // The n denomination public keys for the fresh coins
    189       // that the coin owner had requested.
    190       denoms_h: HashCode[];
    191 
    192       // @since **v32**
    193       // The ``noreveal_index`` value that was returned by the exchange as response
    194       // to the melt request.
    195       noreveal_index: Integer;
    196 
    197       // @since **v32**
    198       // If the reveal step was successfully peformed by the coin owner,
    199       // this field contains the blind coin signatures that were returned
    200       // by the exchange for the chosen batch of coins.
    201       ev_sigs?: BlindedDenominationSignature[];
    202 
    203       // Master seed for the Clause-Schnorr R-value
    204       // Present if one of the fresh coin's
    205       // denominations is of type Clause-Schnorr.
    206       blinding_seed?: BlindingMasterSeed;
    207 
    208       // Signature by the coin over a
    209       // `TALER_RefreshMeltCoinAffirmationPS` of
    210       // purpose ``TALER_SIGNATURE_WALLET_COIN_MELT``.
    211       confirm_sig: EddsaSignature;
    212 
    213     }
    214 
    215   .. ts:def:: CoinRefundTransaction
    216 
    217     interface CoinRefundTransaction {
    218       type: "REFUND";
    219 
    220       // Offset of this entry in the reserve history.
    221       // Useful to request incremental histories via
    222       // the "start" query parameter.
    223       history_offset: Integer;
    224 
    225       // The total amount of the coin's value restored
    226       // by this transaction.
    227       // The amount given excludes the transaction fee.
    228       // The current coin value can thus be computed by
    229       // adding the amounts to the coin's denomination value.
    230       amount: Amount;
    231 
    232       // Refund fee.
    233       refund_fee: Amount;
    234 
    235       // Hash over the proposal data of the contract that
    236       // is being refunded.
    237       h_contract_terms: HashCode;
    238 
    239       // Public key of the merchant.
    240       merchant_pub: EddsaPublicKey;
    241 
    242       // Refund transaction ID.
    243       rtransaction_id: Integer;
    244 
    245       // `EdDSA Signature <eddsa-sig>` authorizing the REFUND over a
    246       // `TALER_MerchantRefundConfirmationPS` with
    247       // purpose ``TALER_SIGNATURE_MERCHANT_REFUND_OK``. Made with
    248       // the `public key of the merchant <merchant-pub>`.
    249       merchant_sig: EddsaSignature;
    250 
    251     }
    252 
    253 
    254   .. ts:def:: CoinRecoupWithdrawTransaction
    255 
    256     // This represents a transaction of a call to /recoup-withdraw
    257     // where the coin's residual value has been credited to the
    258     // original reserve, from which this coin was withdrawn.
    259     // @since **vRECOUP**
    260     interface CoinRecoupWithdrawTransaction {
    261       type: "RECOUP-WITHDRAW";
    262 
    263       // Offset of this entry in the coin history.
    264       // Useful to request incremental histories via
    265       // the "start" query parameter.
    266       history_offset: Integer;
    267 
    268       // The total amount of the coin's value absorbed
    269       // by this transaction.
    270       // The current coin value can thus be computed by
    271       // subtracting the amount from
    272       // the coin's denomination value.
    273       amount: Amount;
    274 
    275       // Signature by the exchange over a
    276       // `TALER_RecoupConfirmationPS`, must be
    277       // of purpose ``TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP``.
    278       exchange_sig: EddsaSignature;
    279 
    280       // Public key of the private key used to create 'exchange_sig'.
    281       exchange_pub: EddsaPublicKey;
    282 
    283       // Signature by the coin over a
    284       // `TALER_RecoupRequestPS` with purpose
    285       // ``TALER_SIGNATURE_WALLET_COIN_RECOUP``.
    286       coin_sig: EddsaSignature;
    287 
    288       // Hash of the public denomination key used to sign the coin.
    289       // Needed because 'coin_sig' signs over this, and
    290       // that is important to fix the coin's denomination.
    291       h_denom_pub: HashCode;
    292 
    293       // Coin blinding secret that was used in the original withdraw
    294       // request and disclosed in the recoup request.
    295       coin_blinding_secret: DenominationBlindingKeySecret;
    296 
    297       // The commitment ``planchets_h`` of the original withdraw
    298       // request that this coin was part of, see `RecoupWithdrawRequest`.
    299       planchets_h: HashCode;
    300 
    301       // Index of this coin in the batch of coins the exchange signed
    302       // in the original withdraw request, starting at 0.
    303       coin_index: Integer;
    304 
    305       // Reserve receiving the recoup.
    306       reserve_pub: EddsaPublicKey;
    307 
    308       // Date when the operation was made.
    309       timestamp: Timestamp;
    310 
    311     }
    312 
    313   .. ts:def:: CoinRecoupRefreshTransaction
    314 
    315     // This represents a transaction of a call to /recoup-refresh
    316     // where this coin was _part_ of the batch of coins whose
    317     // residual values were credited to the original coin, from
    318     // which also this coin was refreshed from.
    319     // @since **vRECOUP**
    320     interface CoinRecoupRefreshTransaction {
    321       type: "RECOUP-REFRESH";
    322 
    323       // Offset of this entry in the coin history.
    324       // Useful to request incremental histories via
    325       // the "start" query parameter.
    326       history_offset: Integer;
    327 
    328       // The total amount of the coin's value absorbed
    329       // by this transaction.
    330       // The current coin value can thus be computed by
    331       // subtracting the amount from
    332       // the coin's denomination value.
    333       amount: Amount;
    334 
    335       // Signature by the exchange over a
    336       // `TALER_RecoupRefreshConfirmationPS`
    337       // of purpose ``TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP_REFRESH``.
    338       exchange_sig: EddsaSignature;
    339 
    340       // Public key used to sign 'exchange_sig'.
    341       exchange_pub: EddsaPublicKey;
    342 
    343       // The original coin, from which this coin was derived from
    344       // in a call to /melt, and which was then credited with
    345       // the residual value of this coin in a call to /recoup-refresh.
    346       old_coin_pub: EddsaPublicKey;
    347 
    348       // Signature by the coin over a `TALER_RecoupRequestPS`
    349       // with purpose ``TALER_SIGNATURE_WALLET_COIN_RECOUP_REFRESH``.
    350       coin_sig: EddsaSignature;
    351 
    352       // Hash of the public denomination key used to sign the coin.
    353       // Needed because 'coin_sig' signs over this, and
    354       // that is important to fix the coin's denomination.
    355       h_denom_pub: HashCode;
    356 
    357       // Coin blinding secret that was used in the original melt
    358       // request and disclosed in the recoup request.
    359       coin_blinding_secret: DenominationBlindingKeySecret;
    360 
    361       // The refresh commitment ``rc`` of the original melt request
    362       // that this coin was derived from, see `RecoupRefreshRequest`.
    363       rc: HashCode;
    364 
    365       // Index of this coin in the batch of coins the exchange signed
    366       // in the original refresh operation, starting at 0.
    367       coin_index: Integer;
    368 
    369       // Date when the operation was made.
    370       timestamp: Timestamp;
    371 
    372     }
    373 
    374   .. ts:def:: CoinRecoupRefreshReceiverTransaction
    375 
    376     // This represents a transaction of a call to /recoup-refresh
    377     // where this coin was the _receiver_ of the residual value
    378     // of a coin that originated from a call to /melt of this coin.
    379     // There is one such entry per recouped coin.
    380     // @since **vRECOUP**
    381     interface CoinRecoupRefreshReceiverTransaction {
    382       type: "RECOUP-REFRESH-RECEIVER";
    383 
    384       // Offset of this entry in the coin history.
    385       // Useful to request incremental histories via
    386       // the "start" query parameter.
    387       history_offset: Integer;
    388 
    389       // The total amount of the coin's value restored
    390       // by this transaction.
    391       // The current coin value can thus be computed by
    392       // adding the amount to the coin's denomination value.
    393       amount: Amount;
    394 
    395       // Date when the operation was made.
    396       timestamp: Timestamp;
    397 
    398       // Signature by the exchange over a
    399       // `TALER_RecoupRefreshConfirmationPS`
    400       // of purpose ``TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP_REFRESH``.
    401       exchange_sig: EddsaSignature;
    402 
    403       // Public key of the private key used to create 'exchange_sig'.
    404       exchange_pub: EddsaPublicKey;
    405 
    406       // Public key of the coin that was recouped, that is the coin
    407       // derived from this coin whose residual value was credited.
    408       coin_pub: CoinPublicKey;
    409 
    410       // The refresh commitment ``rc`` of the melt request of this
    411       // coin from which the recouped coin was derived.
    412       rc: HashCode;
    413 
    414     }
    415 
    416   .. ts:def:: CoinPurseDepositTransaction
    417 
    418     interface CoinPurseDepositTransaction {
    419       type: "PURSE-DEPOSIT";
    420 
    421       // Offset of this entry in the reserve history.
    422       // Useful to request incremental histories via
    423       // the "start" query parameter.
    424       history_offset: Integer;
    425 
    426       // The total amount of the coin's value absorbed
    427       // by this transaction.
    428       // Note that this means the amount given includes
    429       // the deposit fee. The current coin value can thus be computed by
    430       // subtracting the amount from
    431       // the coin's denomination value.
    432       amount: Amount;
    433 
    434       // Base URL of the exchange the purse lives at.
    435       exchange_base_url: WebURL;
    436 
    437       // The hash of the age-commitment for the coin. Only present
    438       // if the denomination has support for age restriction.
    439       h_age_commitment?: AgeCommitmentHash;
    440 
    441       // Deposit fee.
    442       deposit_fee: Amount;
    443 
    444       // Public key of the purse.
    445       purse_pub: EddsaPublicKey;
    446 
    447       // True if the deposit was refunded for any reason.
    448       refunded: boolean;
    449 
    450       // Signature by the coin over a
    451       // `TALER_PurseDepositSignaturePS` of
    452       // purpose ``TALER_SIGNATURE_PURSE_DEPOSIT``.
    453       coin_sig: EddsaSignature;
    454 
    455       // Hash of the public denomination key used to sign the coin.
    456       // Needed because 'coin_sig' signs over this, and
    457       // that is important to fix the coin's denomination.
    458       h_denom_pub: HashCode;
    459 
    460     }
    461 
    462   .. ts:def:: CoinPurseRefundTransaction
    463 
    464     interface CoinPurseRefundTransaction {
    465       type: "PURSE-REFUND";
    466 
    467       // Offset of this entry in the reserve history.
    468       // Useful to request incremental histories via
    469       // the "start" query parameter.
    470       history_offset: Integer;
    471 
    472       // The total amount of the coin's value restored
    473       // by this transaction.
    474       // The amount given excludes the refund fee.
    475       // The current coin value can thus be computed by
    476       // adding the amount to the coin's denomination value.
    477       amount: Amount;
    478 
    479       // Refund fee (of the coin's denomination). The deposit
    480       // fee will be waived.
    481       refund_fee: Amount;
    482 
    483       // Signature by the exchange over a
    484       // ``TALER_CoinPurseRefundConfirmationPS``
    485       // of purpose ``TALER_SIGNATURE_EXCHANGE_CONFIRM_PURSE_REFUND``.
    486       exchange_sig: EddsaSignature;
    487 
    488       // Public key used to sign 'exchange_sig'.
    489       exchange_pub: EddsaPublicKey;
    490 
    491       // Public key of the purse that expired.
    492       purse_pub: EddsaPublicKey;
    493 
    494     }
    495 
    496   .. ts:def:: CoinReserveOpenDepositTransaction
    497 
    498     interface CoinReserveOpenDepositTransaction {
    499       type: "RESERVE-OPEN-DEPOSIT";
    500 
    501       // Offset of this entry in the reserve history.
    502       // Useful to request incremental histories via
    503       // the "start" query parameter.
    504       history_offset: Integer;
    505 
    506       // The total amount of the coin's value absorbed
    507       // by this transaction.
    508       // Note that this means the amount given includes
    509       // the deposit fee.
    510       coin_contribution: Amount;
    511 
    512       // Hash over the age commitment of the coin. Optional.
    513       // Since **v35**.
    514       h_age_commitment?: HashCode;
    515 
    516       // Signature of the reserve open operation being paid for.
    517       reserve_sig: EddsaSignature;
    518 
    519       // Signature by the coin over a
    520       // `TALER_ReserveOpenDepositSignaturePS` of
    521       // purpose ``TALER_SIGNATURE_RESERVE_OPEN_DEPOSIT``.
    522       coin_sig: EddsaSignature;
    523 
    524     }