get-coins-COIN_PUB-history.rst (18187B)
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 .. note:: 255 256 The `CoinRecoupWithdrawTransaction` interface defintion is WIP. 257 It will be fully specified and implemented with **vRECOUP**. 258 259 .. ts:def:: CoinRecoupWithdrawTransaction 260 261 // This represents a transaction of a call to /recoup-withdraw 262 // where the coin's residual value has been credited to the 263 // original reserve, from which this coin was withdrawn. 264 interface CoinRecoupWithdrawTransaction { 265 type: "RECOUP-WITHDRAW"; 266 267 // Offset of this entry in the reserve history. 268 // Useful to request incremental histories via 269 // the "start" query parameter. 270 history_offset: Integer; 271 272 // The total amount of the coin's value absorbed 273 // by this transaction. 274 // The current coin value can thus be computed by 275 // subtracting the amount from 276 // the coin's denomination value. 277 amount: Amount; 278 279 // Signature by the exchange over a 280 // `TALER_RecoupConfirmationPS`, must be 281 // of purpose ``TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP``. 282 exchange_sig: EddsaSignature; 283 284 // Public key of the private key used to create 'exchange_sig'. 285 exchange_pub: EddsaPublicKey; 286 287 // Signature by the coin over a 288 // `TALER_RecoupRequestPS` with purpose 289 // ``TALER_SIGNATURE_WALLET_COIN_RECOUP``. 290 coin_sig: EddsaSignature; 291 292 // Hash of the public denomination key used to sign the coin. 293 // Needed because 'coin_sig' signs over this, and 294 // that is important to fix the coin's denomination. 295 h_denom_pub: HashCode; 296 297 // Coin blinding key that was used in the original withdraw request. 298 coin_blind: DenominationBlindingKeyP; 299 300 // The hash of the withdraw commitment of the original withdraw 301 // request that this coin was part of 302 h_commitment: HashCode; 303 304 // Coin's index in the original withdraw request, starting at 0 305 coin_index: Integer; 306 307 // Reserve receiving the recoup. 308 reserve_pub: EddsaPublicKey; 309 310 // Date when the operation was made. 311 timestamp: Timestamp; 312 313 } 314 315 316 .. note:: 317 318 The `CoinRecoupRefreshTransaction` interface defintion is WIP. 319 It will be fully specified and implemented with **vRECOUP**. 320 321 .. ts:def:: CoinRecoupRefreshTransaction 322 323 // This represents a transaction of a call to /recoup-refresh 324 // where this coin was _part_ of the batch of coins whose 325 // residual values were credited to the original coin, from 326 // which also this coin was refresh from. 327 interface CoinRecoupRefreshTransaction { 328 type: "RECOUP-REFRESH"; 329 330 // Offset of this entry in the reserve history. 331 // Useful to request incremental histories via 332 // the "start" query parameter. 333 history_offset: Integer; 334 335 // The total amount of the coin's value absorbed 336 // by this transaction. 337 // The current coin value can thus be computed by 338 // subtracting this amounts from 339 // the coin's denomination value. 340 amount: Amount; 341 342 // Signature by the exchange over a 343 // `TALER_RecoupRefreshConfirmationPS` 344 // of purpose ``TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP_REFRESH``. 345 exchange_sig: EddsaSignature; 346 347 // Public key used to sign 'exchange_sig'. 348 exchange_pub: EddsaPublicKey; 349 350 // The original coin, from which this coin was derived from 351 // in a call to /refresh, and which was then credited with 352 // the residual value of this coin in a call to /recoup-refresh. 353 old_coin_pub: EddsaPublicKey; 354 355 // Signature by the coin over a `TALER_RecoupRequestPS` 356 // with purpose ``TALER_SIGNATURE_WALLET_COIN_RECOUP``. 357 coin_sig: EddsaSignature; 358 359 // Hash of the public denomination key used to sign the coin. 360 // Needed because 'coin_sig' signs over this, and 361 // that is important to fix the coin's denomination. 362 h_denom_pub: HashCode; 363 364 // Coin blinding key that was used in the original refresh request. 365 coin_blind: DenominationBlindingKeyP; 366 367 // The hash of the refresh commitment of the original refresh 368 // request that this coin was derived from. 369 h_commitment: HashCode; 370 371 // Coin's index in the original refresh request, starting at 0 372 coin_index: Integer; 373 374 // Blinding factor of the revoked new coin. 375 new_coin_blinding_secret: DenominationBlindingKeySecret; 376 377 // Blinded public key of the revoked new coin. 378 new_coin_ev: DenominationBlindingKeySecret; 379 380 // Date when the operation was made. 381 timestamp: Timestamp; 382 383 } 384 385 386 .. note:: 387 388 The `CoinRecoupRefreshReceiverTransaction` interface defintion is WIP. 389 It will be fully specified and implemented with **vRECOUP**. 390 391 .. ts:def:: CoinRecoupRefreshReceiverTransaction 392 393 // This represents a transaction of a call to /recoup-refresh 394 // where this coin was the _receiver_ of the residual values 395 // from coins, that originated from a call to /refresh of this coin. 396 interface CoinRecoupRefreshReceiverTransaction { 397 type: "RECOUP-REFRESH-RECEIVER"; 398 399 // Offset of this entry in the reserve history. 400 // Useful to request incremental histories via 401 // the "start" query parameter. 402 history_offset: Integer; 403 404 // The total amount of the coin's value restored 405 // by this transaction. 406 // The current coin value can thus be computed by 407 // adding the amount to the coin's denomination value. 408 amount: Amount; 409 410 // Date when the operation was made. 411 timestamp: Timestamp; 412 413 // Signature by the exchange over a 414 // `TALER_RecoupRefreshConfirmationPS` 415 // of purpose ``TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP_REFRESH``. 416 exchange_sig: EddsaSignature; 417 418 // Public key of the private key used to create 'exchange_sig'. 419 exchange_pub: EddsaPublicKey; 420 421 } 422 423 .. ts:def:: CoinPurseDepositTransaction 424 425 interface CoinPurseDepositTransaction { 426 type: "PURSE-DEPOSIT"; 427 428 // Offset of this entry in the reserve history. 429 // Useful to request incremental histories via 430 // the "start" query parameter. 431 history_offset: Integer; 432 433 // The total amount of the coin's value absorbed 434 // by this transaction. 435 // Note that this means the amount given includes 436 // the deposit fee. The current coin value can thus be computed by 437 // subtracting the amount from 438 // the coin's denomination value. 439 amount: Amount; 440 441 // Base URL of the exchange the purse lives at. 442 exchange_base_url: string; 443 444 // The hash of the age-commitment for the coin. Only present 445 // if the denomination has support for age restriction. 446 h_age_commitment?: AgeCommitmentHash; 447 448 // Deposit fee. 449 deposit_fee: Amount; 450 451 // Public key of the purse. 452 purse_pub: EddsaPublicKey; 453 454 // True if the deposit was refunded for any reason. 455 refunded: boolean; 456 457 // Signature by the coin over a 458 // `TALER_PurseDepositSignaturePS` of 459 // purpose ``TALER_SIGNATURE_PURSE_DEPOSIT``. 460 coin_sig: EddsaSignature; 461 462 // Hash of the public denomination key used to sign the coin. 463 // Needed because 'coin_sig' signs over this, and 464 // that is important to fix the coin's denomination. 465 h_denom_pub: HashCode; 466 467 } 468 469 .. ts:def:: CoinPurseRefundTransaction 470 471 interface CoinPurseRefundTransaction { 472 type: "PURSE-REFUND"; 473 474 // Offset of this entry in the reserve history. 475 // Useful to request incremental histories via 476 // the "start" query parameter. 477 history_offset: Integer; 478 479 // The total amount of the coin's value restored 480 // by this transaction. 481 // The amount given excludes the refund fee. 482 // The current coin value can thus be computed by 483 // adding the amount to the coin's denomination value. 484 amount: Amount; 485 486 // Refund fee (of the coin's denomination). The deposit 487 // fee will be waived. 488 refund_fee: Amount; 489 490 // Signature by the exchange over a 491 // ``TALER_CoinPurseRefundConfirmationPS`` 492 // of purpose ``TALER_SIGNATURE_EXCHANGE_CONFIRM_PURSE_REFUND``. 493 exchange_sig: EddsaSignature; 494 495 // Public key used to sign 'exchange_sig'. 496 exchange_pub: EddsaPublicKey; 497 498 // Public key of the purse that expired. 499 purse_pub: EddsaPublicKey; 500 501 } 502 503 .. ts:def:: CoinReserveOpenDepositTransaction 504 505 interface CoinReserveOpenDepositTransaction { 506 type: "RESERVE-OPEN-DEPOSIT"; 507 508 // Offset of this entry in the reserve history. 509 // Useful to request incremental histories via 510 // the "start" query parameter. 511 history_offset: Integer; 512 513 // The total amount of the coin's value absorbed 514 // by this transaction. 515 // Note that this means the amount given includes 516 // the deposit fee. 517 coin_contribution: Amount; 518 519 // Hash over the age commitment of the coin. Optional. 520 // Since **v35**. 521 h_age_commitment?: HashCode; 522 523 // Signature of the reserve open operation being paid for. 524 reserve_sig: EddsaSignature; 525 526 // Signature by the coin over a 527 // `TALER_ReserveOpenDepositSignaturePS` of 528 // purpose ``TALER_SIGNATURE_RESERVE_OPEN_DEPOSIT``. 529 coin_sig: EddsaSignature; 530 531 }