Getting history
Getting the transaction history.
Parameters
- x-wallet-id: Wallet identifier.
Request
curl -H "X-Wallet-Id: {wallet-id}" http://localhost:8000/wallet/tx-history
Response
{
"0000340349f9342c4e5eda6f818697f6c1748a81e2ff4b67bc2211d7f8761b11": {
"tx_id": "0000340349f9342c4e5eda6f818697f6c1748a81e2ff4b67bc2211d7f8761b11",
"version": 1,
"timestamp": 1578430704,
"is_voided": false,
"inputs": [
{
"value": 1,
"token_data": 0,
"script": "dqkU98E1NAiRn3fV4nBm1S3e5pPssF+IrA==",
"decoded": {
"type": "P2PKH",
"address": "HV78k3MkUmt6no59cV1kCJzo2CfPXGNmRv",
"timelock": null
},
"token": "00",
"tx_id": "00000a6d244e17e22969f2c2ef339a557bc96540bbbef1350c26c445291e5430",
"index": 1
},
{
"value": 2,
"token_data": 0,
"script": "dqkUje1HF10tIOWS36q73Rpbud3BcAyIrA==",
"decoded": {
"type": "P2PKH",
"address": "HKTZujeJEBeM22UmRWkuKJaDnzbAfFzwRe",
"timelock": null
},
"token": "00",
"tx_id": "0000276ec988df605b56072065f1b9f2395966a3c7c17c692078b2bca43fad8c",
"index": 1
}
],
"outputs": [
{
"value": 3,
"token_data": 0,
"script": "dqkUJdUWQm2UfnCXkwoSj7/2SNmjt5+IrA==",
"decoded": {
"type": "P2PKH",
"address": "H9yAeyxwA7zbpovZZTkpqWJZYsE4hHnvmP",
"timelock": null
},
"token": "00",
"spent_by": "000008d7e62d394be9b07c0fe9c69b289e44dbe1350e2100c169fc030ac936ff"
}
],
"parents": [
"0000276ec988df605b56072065f1b9f2395966a3c7c17c692078b2bca43fad8c",
"00000a6d244e17e22969f2c2ef339a557bc96540bbbef1350c26c445291e5430"
]
},
"0000276ec988df605b56072065f1b9f2395966a3c7c17c692078b2bca43fad8c": {
"tx_id": "0000276ec988df605b56072065f1b9f2395966a3c7c17c692078b2bca43fad8c",
"version": 1,
"timestamp": 1578430668,
"is_voided": false,
"inputs": [
{
"value": 4398,
"token_data": 0,
"script": "dqkUfZRahPx5JF7l8qFzwVjiV1tmhweIrA==",
"decoded": {
"type": "P2PKH",
"address": "HHy8a7QvQmj727beKFuiYziGb7mi7CdrG3",
"timelock": null
},
"token": "00",
"tx_id": "00000a6d244e17e22969f2c2ef339a557bc96540bbbef1350c26c445291e5430",
"index": 0
}
],
"outputs": [
{
"value": 4396,
"token_data": 0,
"script": "dqkUJdUWQm2UfnCXkwoSj7/2SNmjt5+IrA==",
"decoded": {
"type": "P2PKH",
"address": "H9yAeyxwA7zbpovZZTkpqWJZYsE4hHnvmP",
"timelock": null
},
"token": "00",
"spent_by": "00000174753194de2affba45874ef36c92e0ae270442f2410207cf2ee3d06950"
},
{
"value": 2,
"token_data": 0,
"script": "dqkUje1HF10tIOWS36q73Rpbud3BcAyIrA==",
"decoded": {
"type": "P2PKH",
"address": "HKTZujeJEBeM22UmRWkuKJaDnzbAfFzwRe",
"timelock": null
},
"token": "00",
"spent_by": "0000340349f9342c4e5eda6f818697f6c1748a81e2ff4b67bc2211d7f8761b11"
}
],
"parents": [
"00000a6d244e17e22969f2c2ef339a557bc96540bbbef1350c26c445291e5430",
"000009fe61f75076b0c1abde1ee1881e4886bad80a09e699cb599b538934ce33"
]
}
}
Limiting the History Length
The limit query parameter limit can be used to restrict the history length. The following request limits the history to the latest 3 transactions.
curl -H "X-Wallet-Id: {wallet-id}" \
http://localhost:8000/wallet/tx-history?limit=3
By default, the transactions list that the /tx-history endpoint gets is not sorted. However, using the limit query parameter, the returned list is sorted by timestamp in descending order. In the next example response, the values of the input, output, and parent attributes have been replaced by the + symbol to make it easier to check the timestamp of each transaction.
[
{
"tx_id":"0094a48fa955c0a77927616414ff40665b040ec0823a471e35259dfe3b399e75",
"version":1,
"weight":8.000001,
"timestamp":1649870614,
"is_voided":false,
"inputs":[+],
"outputs":[+],
"parents":[+]
},
{
"tx_id":"00a72f9e3e2d23a831f3dfb26a2480364ee78111f9b2a9722806e32268b8e545",
"version":1,
"weight":8.000001,
"timestamp":1649870471,
"is_voided":false,
"inputs":[+],
"outputs":[+],
"parents":[+]
},
{
"tx_id":"0068c5830d56a4b05537a247f2ab25a684f5b3f7aa2c8a29e33c4380dda7cdfc",
"version":2,
"weight":8.000001,
"timestamp":1649764853,
"is_voided":false,
"inputs":[+],
"outputs":[+],
"parents":[+],
"token_name":"Aardvark NFT Token",
"token_symbol":"AVK",
"tokens":[
]
}
]
The sort order of the returned transactions list can be better visualized by converting the timestamps to readable dates.
| Timestamp | Date |
|---|---|
| 1649870614 | 4/13/2022, 2:23:34 PM |
| 1649870471 | 4/13/2022, 2:21:11 PM |
| 1649764853 | 4/12/2022, 9:00:53 AM |