Our wallet client wants to check if a transaction issued by some an account is confirmed or not. I know history_api_plugin provides API for query actions related to the account. But if the filter for that plugin is *, there would be a lot of information saved to the memory mapped file which might break nodeos. Is there any solution to handle this common requirement? or do I need to implement a plugin to handle such requests?
1 Answer
Assuming you have the the transaction ID, you can query a nodeos
instance to check in which block the transaction was included, if any, and if the block is before or after the latest irreversible block.
$ cleos get transaction <trx_id>
should return the block if it was submitted in any block.
If you don't have the transaction ID, and you want to store transcation, without storing everything (*
), the filter flag allows you to specify conditions:
Config Options for eosio::history_plugin:
-f [ --filter-on ] arg Track actions which match
receiver:action:actor. Actor may be
blank to include all. Action and Actor
both blank allows all from Recieiver.
Receiver may not be blank.
-f [ --filter-out ] arg Do not track actions which match
receiver:action:actor. Action and Actor
both blank excludes all from Reciever.
Actor blank excludes all from
reciever:action. Receiver may not be
blank.
Similar options exist if you use mongo_db_plugin
:
--mongodb-filter-on arg Mongodb: Track actions which match
receiver:action:actor. Actor may be
blank to include all. Receiver and
Action may not be blank. Default is *
include everything.
--mongodb-filter-out arg Mongodb: Do not track actions which
match receiver:action:actor. Action and
Actor both blank excludes all from
reciever. Actor blank excludes all from
reciever:action. Receiver may not be
blank.