gxchain / gxb-core

GXChain Blockchain implementation
https://www.gxchain.org
GNU General Public License v3.0
226 stars 78 forks source link

Cannot get account history #205

Closed oggy95 closed 4 years ago

oggy95 commented 4 years ago

Describe the bug I setup witness_node and wallet from this manual: https://github.com/gxchain/gxb-core/wiki/for_exchanges, but when I am trying to use wallet API like get_irreversible_account_history, get_account_history_by_operations or methods from elastic search (from this manual https://docs.gxchain.org/advanced/plugin_fullnode.html#_3-2-query-transaction-history-by-account-id) I've got an empty reply.

my witness started: nohup ./programs/witness_node/witness_node --data-dir=/data --rpc-endpoint=0.0.0.0:8090 --partial-operations=true --p2p-endpoint=0.0.0.0:6789 --data-transaction-lifetime=1 --track-account="\"ID_ACCOUNT\"" --plugins witness elastic_search data_transaction query_txid --log-file --resync-blockchain >> witness.out 2>&1 &

wallet started: nohup ./programs/cli_wallet/cli_wallet -D /data --enable-rpc-log -r 0.0.0.0:8091 -w wallet.json -d >> wallet.out 2> 1

From this issue (https://github.com/gxchain/gxb-core/issues/62) I'm trying to use key "--max-ops-per-account=-1", but still no effect

Screenshots of replies: image

image

image

witness_node -v Version: v1.0.190321-1-g61fa8ce SHA: 61fa8ce75cf62554502cbf22e24479757e1d4230 Timestamp: 49 weeks ago SSL: OpenSSL 1.0.2g 1 Mar 2016 Boost: 1.67 Websocket++: 0.7.0

lanhaoxiang commented 4 years ago

Some notice for using es plugin:

  1. With elastic search plugin, you don't have to use --track-account params
  2. If you want track only one account's full history, then you don't need elastic search plugin
  3. Elastic search plugin is used to track all account history, very useful for block explorer

For you case:

  1. Make sure you have installed elastic search properly
  2. Make sure witness_node has sync to latest status by checking witness.log, only after that, you could have your wallet started, and use all apis

You can post your witness.log here for more details

oggy95 commented 4 years ago

Oh, understand. Witness node is fully synced:

2020-02-28T14:18:33 th_a:invoke handle_block handle_block ] Got block: #28081036 time: 2020-02-28T14:18:33 transaction(s): 0 latency: 296 ms from: gbac-gxc irreversible: 28081018 (-18) application.cpp:508 2020-02-28T14:18:36 th_a:invoke handle_block handle_block ] Got block: #28081037 time: 2020-02-28T14:18:36 transaction(s): 0 latency: 347 ms from: chainclub-bp irreversible: 28081018 (-19) application.cpp:508 2020-02-28T14:18:39 th_a:invoke handle_block handle_block ] Got block: #28081038 time: 2020-02-28T14:18:39 transaction(s): 0 latency: 143 ms from: gxbean irreversible: 28081018 (-20) application.cpp:508 2020-02-28T14:18:42 th_a:invoke handle_block handle_block ] Got block: #28081039 time: 2020-02-28T14:18:42 transaction(s): 0 latency: 313 ms from: lendchain irreversible: 28081018 (-21) application.cpp:508 2020-02-28T14:18:45 th_a:invoke handle_block handle_block ] Got block: #28081040 time: 2020-02-28T14:18:45 transaction(s): 0 latency: 323 ms from: gxcpacific irreversible: 28081018 (-22) application.cpp:508 2020-02-28T14:18:48 th_a:invoke handle_block handle_block ] Got block: #28081041 time: 2020-02-28T14:18:48 transaction(s): 0 latency: 312 ms from: lucia-committee irreversible: 28081020 (-21) application.cpp:508 2020-02-28T14:18:51 th_a:invoke handle_block handle_block ] Got block: #28081042 time: 2020-02-28T14:18:51 transaction(s): 0 latency: 783 ms from: damo-witness irreversible: 28081020 (-22) application.cpp:508 2020-02-28T14:18:54 th_a:invoke handle_block handle_block ] Got block: #28081043 time: 2020-02-28T14:18:54 transaction(s): 0 latency: 303 ms from: gxc-prophet irreversible: 28081020 (-23) application.cpp:508 2020-02-28T14:18:57 th_a:invoke handle_block handle_block ] Got block: #28081044 time: 2020-02-28T14:18:57 transaction(s): 0 latency: 375 ms from: bigone-pool irreversible: 28081020 (-24) application.cpp:508 2020-02-28T14:19:00 th_a:invoke handle_block handle_block ] Got block: #28081045 time: 2020-02-28T14:19:00 transaction(s): 0 latency: 307 ms from: bepal irreversible: 28081020 (-25) application.cpp:508 2020-02-28T14:19:03 th_a:invoke handle_block handle_block ] Got block: #28081046 time: 2020-02-28T14:19:03 transaction(s): 0 latency: 269 ms from: certik-gxc irreversible: 28081020 (-26) application.cpp:508 2020-02-28T14:19:06 th_a:invoke handle_block handle_block ] Got block: #28081047 time: 2020-02-28T14:19:06 transaction(s): 0 latency: 364 ms from: gxcmoon irreversible: 28081022 (-25) application.cpp:508 2020-02-28T14:19:09 th_a:invoke handle_block handle_block ] Got block: #28081048 time: 2020-02-28T14:19:09 transaction(s): 0 latency: 297 ms from: xinlai-bp irreversible: 28081033 (-15) application.cpp:508

Maybe I should restart node without ES plugin?

lanhaoxiang commented 4 years ago

Yes, but remember to remove --resync-blockchain since it will cause fully re sync

RootkitKiller commented 4 years ago

You do not need to start the ES plugin. You can try the following command:

nohup ./programs/witness_node/witness_node --data-dir=/data --rpc-endpoint=0.0.0.0:8090 --partial-operations=true --p2p-endpoint=0.0.0.0:6789 --data-transaction-lifetime=1 --track-account=""ID_ACCOUNT"" _max_ops_per_account=20000 --log-file  >> witness.out 2>&1 &

And from now on, the track account's new transaction will be saved , and then use get_account_history to get the account history

oggy95 commented 4 years ago

@lanhaoxiang @RootkitKiller ok, I've got. I will wait when the node is fully started and give a status of queries.

oggy95 commented 4 years ago

All good! Close the issue.