1

I know there are some related questions in the stackExchange, however, not my wanted answer.

In eosnetworkmonitor, we can get all the actions of all accounts, how can they do that?

There's another way, we can start a node and add the history plugin, user --filter-on to get the actions we need, I don't know if that's a common solution for a dapp or a token exchange?

I hope to get a complete answer or best practice of monitoring an account actions -- for a dapp monitor.

2
  • Could you reference the related questions here?
    – friedger
    Commented Jul 14, 2018 at 10:18
  • cleos -u api.eosnewyork.io get actions xxx, it will return all your actions, but this I think(they may use --filter-on = *) will cost a lot of ram in the machine.
    – Jimmy Guo
    Commented Jul 14, 2018 at 13:49

1 Answer 1

4

I don't know if they are doing that, but what you could do is create a program that reads all blocks from start_block var:

  1. Read block start_block
  2. Check if this block has transactions
  3. If yes, save the transactions in your database
  4. Increment start_block
  5. Go back to step 1 and keep doing that till you are in the head block

Or, I already did it for you, just use the "eos-node-watcher" program that I created: https://github.com/EOSEssentials/eos-node-watcher

What you want to do in your dapp is to listen to only relevant actions. For my dapps I'm using my eos-node-watcher and you can setup the filters like this:

"accounts": {
  "monstereosio": [],   # leave an empty array to listen to all the actions
  "eosio.token": [      # here you can filter all the actions
    {
      "name": "transfer",
      "data": { "to": "monstereosio" } # (optional) if you set the data, it
    }                                  # will filter the actions parameters
  ]
},

Above I'm filtering everything from my contract monstereosio actions and also all the eosio.token::transfer that goes to monstereosio.

Now with the transactions in your database you can play and keep the log of all the accounts that you need to, also free for doing your queries.

You could use your own EOS node with filter-on = * if you have enough memory to. If you do that you are still tied to EOSRPC API limitations, it's better if you save it in your own database and play with it, maybe you will like to create your own tables/views and have more freedom to architect your data layer.

6
  • I'd like to know what's the performance to parse all the blocks and store in database?
    – Jimmy Guo
    Commented Jul 14, 2018 at 14:29
  • I got a rate of 500 blocks per second with nodejs and mongodb Commented Jul 14, 2018 at 14:36
  • A problem, you can get all the actions from all the blocks, but you can't get the inline actions, for example, I send an action to a contract, then the contract transfer some token to me inline, you can't monitor this.
    – Jimmy Guo
    Commented Jul 16, 2018 at 10:36
  • just call get_transaction for the relevant ones to your dapp. that's exactly what eos-node-watcher does. Commented Jul 16, 2018 at 10:55
  • hello, the get_transaction is also a history api, right?
    – Jimmy Guo
    Commented Jul 16, 2018 at 11:01

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.