eos icon indicating copy to clipboard operation
eos copied to clipboard

[HELP]Cannot get all detail of account from mongodb

Open axaysingh opened this issue 8 years ago • 6 comments

when i run the following command from command its shows me the full detail of the account

yudiz@blockchain:~$ cleos get account tester --json
{
  "account_name": "tester",
  "head_block_num": 7865,
  "head_block_time": "2018-07-11T07:41:31.000",
  "privileged": false,
  "last_code_update": "1970-01-01T00:00:00.000",
  "created": "2018-07-11T07:32:45.000",
  "ram_quota": -1,
  "net_weight": -1,
  "cpu_weight": -1,
  "net_limit": {
    "used": -1,
    "available": -1,
    "max": -1
  },
  "cpu_limit": {
    "used": -1,
    "available": -1,
    "max": -1
  },
  "ram_usage": 2724,
  "permissions": [{
      "perm_name": "active",
      "parent": "owner",
      "required_auth": {
        "threshold": 1,
        "keys": [{
            "key": "EOS7cxG86SJcvszWXv8Fqf2axVo6GABk1iiaeWMUDoYNLVMqNV8GC",
            "weight": 1
          }
        ],
        "accounts": [],
        "waits": []
      }
    },{
      "perm_name": "owner",
      "parent": "",
      "required_auth": {
        "threshold": 1,
        "keys": [{
            "key": "EOS7cxG86SJcvszWXv8Fqf2axVo6GABk1iiaeWMUDoYNLVMqNV8GC",
            "weight": 1
          }
        ],
        "accounts": [],
        "waits": []
      }
    }
  ],
  "total_resources": null,
  "self_delegated_bandwidth": null,
  "refund_request": null,
  "voter_info": null
}

but when i see my mongodb to it only show me few details for the account

> db.accounts.find()
{ "_id" : ObjectId("5b435b6e5510a8578a692cb2"), "name" : "eosio", "createdAt" : ISODate("2018-07-09T12:56:14.500Z") }
{ "_id" : ObjectId("5b435c045510a8578a69327e"), "name" : "eosio.token", "createdAt" : ISODate("2018-07-09T12:58:44.684Z") }
{ "_id" : ObjectId("5b435c135510a8578a693313"), "name" : "faucet", "createdAt" : ISODate("2018-07-09T12:58:59.224Z") }
{ "_id" : ObjectId("5b45b29c5510a82ddd02af6c"), "name" : "tester", "createdAt" : ISODate("2018-07-11T07:32:44.982Z") }

i am on eos v1.0.8 whats I am doing wrong dont know. How can i get all data in mongodb so i can fetch easily.

ANY HELP!!

axaysingh avatar Jul 11 '18 07:07 axaysingh

Yes, there's nothing wrong that you did :)

If you check mongo_db_plugin implementation of, the only information stored inside mongodb for an account is name, abi, createdAt, updatedAt.

andriantolie avatar Jul 11 '18 08:07 andriantolie

thanks for response! but is there any way to get all the detail to the front end using mongodb or any other?

actually i am create a website like eostracker.io and in the account section they where displaying all the details but i don't know how to implement it

axaysingh avatar Jul 11 '18 08:07 axaysingh

Hmm, there's many ways to achieve it depending on your need. Some of them that I can think of is either by calling RPC API get account/ modify mongodb plugin to be able to parse more actions/ keep polling get block and populate your own database for every block

andriantolie avatar Jul 11 '18 08:07 andriantolie

sorry for noob question :( but what modification i have to do in mongodb plugin and how it will be done?

axaysingh avatar Jul 11 '18 08:07 axaysingh

Not noob at all :) Btw, just realized that you said you are on 1.0.8, I thought 1.0.8 mongodb plugin is not working? I remember the PR for mongodb got merge to 1.1

What I mean is you can develop your own plugin that behaves similarly like mongodb plugin. However, instead of just parsing newaccount and setabi action, it also parses actions that you are interested in and export that to your mongodb. This won't be a simple solution though, especially the fact that accepted_block, irreversible_block, accepted_transaction, applied_transaction signal emitted by the controller is not guaranteed to be still available in the future. :(

If you are referring to eostracker.io, it seems like the information it displays can be retrieved using get_account RPC API.

andriantolie avatar Jul 11 '18 09:07 andriantolie

Thanks for explanation @andriantolie :+1:

previously i am using RPC API but now i am trying mongodb, but no worry.

Thanks

axaysingh avatar Jul 11 '18 09:07 axaysingh