search_for_transactions
Searches the wallet's transfer history and returns the matching incoming, outgoing and unconfirmed transfers, optionally narrowed down to a single transaction id or to a range of block heights.
Request
{
"jsonrpc": "2.0",
"id": 0,
"method": "search_for_transactions",
"params": {
"tx_id": "",
"in": true,
"out": true,
"pool": true,
"filter_by_height": false,
"min_height": 1,
"max_height": 1
}
}
Request parameters
- tx_id - string; hex-encoded hash of a transaction. If specified, only that transaction will be returned (and only if it also passes the other filters). Pass an empty string to search the whole history.
- in - if true then incoming transactions will be taken into account
- out - if true then outgoing transactions will be taken into account
- pool - if true, unconfirmed transactions from the pool will be taken into account as well
- filter_by_height - if true, transactions will be filtered by block height using min_height and max_height
- min_height - minimum block height (including)
- max_height - maximum block height (including)
ㅤ
The example below has been shortened: a real response typically contains many more entries in each array.
Response
{
"id": 0,
"jsonrpc": "2.0",
"result": {
"in": [
{
"amount": 100000000000000,
"comment": "twitter thread contest kekz",
"fee": 0,
"height": 2108980,
"is_income": true,
"is_mining": false,
"is_mixing": false,
"is_service": false,
"payment_id": "",
"remote_addresses": [
"NiRDbSpgDzyaMecaMUi6orsLimz3M8ptCzYzEuboTdYmwai8xhyATWnkHCt26Ts2kT75ajPGgmDAWR6xdpVBto8Vz1dmQJp8AJ"
],
"show_sender": false,
"td": {
"rcv": [
100000000000000
]
},
"timestamp": 1684249681,
"transfer_internal_index": 0,
"tx_blob_size": 608,
"tx_hash": "41ec870cb4d03e62193f7b57cd4485c579441d009a9e44a31abc5b392a5991e3",
"tx_type": 0,
"unlock_time": 0
}
],
"out": [
{
"amount": 20000000000000,
"comment": "payout",
"fee": 10000000000,
"height": 2109455,
"is_income": false,
"is_mining": false,
"is_mixing": true,
"is_service": false,
"payment_id": "1dfe5a88ff9effb3",
"remote_addresses": [
"NiRCn8fKmvenQRNdoFFsDinWMfucfC5H9Abb71HjUFbPcEgaCk1fdjqSe4ZDskYgLQtRUFYDH1AqUAWDHjmu84hSG394mceDgb"
],
"show_sender": true,
"td": {
"rcv": [
79990000000000
],
"spn": [
100000000000000
]
},
"timestamp": 1684278104,
"transfer_internal_index": 1,
"tx_blob_size": 4327,
"tx_hash": "b329cce92a23fdaf89a5ad907ca9c4c1fbd052b79ec8414438533c83b39afc2b",
"tx_type": 0,
"unlock_time": 0
}
],
"pool": [
{
"amount": 5000000000000,
"comment": "",
"fee": 10000000000,
"height": 0,
"is_income": true,
"is_mining": false,
"is_mixing": true,
"is_service": false,
"payment_id": "",
"remote_addresses": [],
"show_sender": false,
"td": {
"rcv": [
5000000000000
]
},
"timestamp": 1684278461,
"transfer_internal_index": 2,
"tx_blob_size": 992,
"tx_hash": "7c1a5be0d4f39b27c86e0a1d5f3b940e2c6d81a70f4b39e5c2a8d106f7b34e29",
"tx_type": 0,
"unlock_time": 0
}
]
}
}
Response information
The result contains up to three arrays, each holding objects of the same shape. An array is only filled in when the corresponding request flag was set, and is omitted or returned empty otherwise.
- in - array of objects; confirmed transfers that brought coins into this wallet. Returned when
inwastrue. - out - array of objects; confirmed transfers that sent coins out of this wallet. Returned when
outwastrue. - pool - array of objects; transfers whose transactions are still unconfirmed and sit in the tx pool. Returned when
poolwastrue. Entries here always haveheightequal to0.
The fields of every entry, in all three arrays, are:
- amount - integer; amount of coins in atomic units;
- comment - string; an optional comment set by the sender;
- fee - integer; transaction fee in atomic units;
- height - integer; height of the block containing corresponding transaction;
- is_income - Boolean; true if this is incoming transfer;
- is_mining - Boolean; true if this is a miner (i.e. coinbase) tx;
- is_mixing - Boolean; true if this tx is using mixins;
- is_service - Boolean; true if this is a special service tx, not a normal one;
- payment_id - string; (optional) hex-encoded payment identifier;
- remote_addresses - list of strings; (optional) sender address(es);
- show_sender - Boolean; true if sender address info is present;
- td - a wallet_transfer_info_details object;
- rcv - list of integers; received amounts in atomic units;
- spn - list of integers; spent amounts in atomic units, i.e. the amounts of this wallet's outputs that were consumed as inputs of the transaction. Empty for purely incoming transfers.
- timestamp - integer; Unix timestamp when the tx was received;
- transfer_internal_index - integer; zero-based position of this entry in the wallet's own transfer history. It is stable for a given wallet and is what the history-paging methods use as a cursor, but it carries no meaning outside this wallet.
- tx_blob_size - integer; size of the serialized transaction, in bytes.
- tx_hash - string; transaction’s hash.
- tx_type - integer; what kind of operation the transaction performs, using the same enumeration as the
tx_typefield of get_recent_txs_and_info:GUI_TX_TYPE_NORMAL= 0,GUI_TX_TYPE_PUSH_OFFER= 1,GUI_TX_TYPE_UPDATE_OFFER= 2,GUI_TX_TYPE_CANCEL_OFFER= 3,GUI_TX_TYPE_NEW_ALIAS= 4,GUI_TX_TYPE_UPDATE_ALIAS= 5,GUI_TX_TYPE_COIN_BASE= 6,GUI_TX_TYPE_ESCROW_PROPOSAL= 7,GUI_TX_TYPE_ESCROW_TRANSFER= 8,GUI_TX_TYPE_ESCROW_RELEASE_NORMAL= 9,GUI_TX_TYPE_ESCROW_RELEASE_BURN= 10,GUI_TX_TYPE_ESCROW_CANCEL_PROPOSAL= 11,GUI_TX_TYPE_ESCROW_RELEASE_CANCEL= 12,GUI_TX_TYPE_HTLC_DEPOSIT= 13,GUI_TX_TYPE_HTLC_REDEEM= 14. - unlock_time - unlock_time — unsigned int; if nonzero — unix timestamp since then this transfer’s coins can be spent. If it is less than 500000000, the value is treated as a minimum block height at which this transfer’s coin can be spent.