1

I'm struggling to find the answer to that issue and thought maybe the collective knowledge might be helpful ;-)

I'm trying to get the balance of a certain token for a specific account from the mongo_db_plugin. As there isn't much documentation about that I've looked around a bit and although I think it's probably somewhere in the "accounts" collection, I'm not entirely sure what it is I should be looking for?

Any ideas?

Sub-question => Is it actually possible to get the balance of an account at a specific block?

3 Answers 3

0

In my mind, mongo_db_plugin is a replacement for history_plugin and history_api_plugin. This means it provides information about what has happened, instead of current status. If you want to get currency balance, you should probably use the RPC API instead of mongo_db_plugin, as the RPC API will be able to access the current state.

1
  • Thanks for your answer, you're both right, I don't why I went head down into trying to make that work with the mongo_db_plugin as the RPC API or eosjscan do that much more easily and in a straightforward way.
    – Linda
    Commented Nov 25, 2018 at 15:50
0

I think usage of cleos get currency balance eosio.token <query-account> will directly give you balance of that account no mongodb interection needed if you are looking for eosio.token's balance, and you can use eosjs or RPC API also for getting balance.

0

Modify mongo_db_plugin to output the transfer action. When the action is received, update the balances corresponding to the from and to accounts respectively, and store them in the newly created record table

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.