Author Topic: How to use get_asset_holders?  (Read 396 times)

0 Members and 1 Guest are viewing this topic.

Offline tandris

How to use get_asset_holders?
« on: March 05, 2018, 02:32:47 pm »
I would like call the get_asset_holders asset api method to list the holders of my UIA, but I have some issues with it. At first I've tried it on the test network which worked:
Code: [Select]
> bash-3.2$ wscat -c wss://node.testnet.bitshares.eu/ws
> {"id":2,"method":"call","params":[1,"login",["",""]]}
< {"id":2,"jsonrpc":"2.0","result":true}
> {"id":2,"method":"call","params":[1,"asset",[]]}
< {"id":2,"jsonrpc":"2.0","result":2}
> {"id":1, "method":"call", "params":[2,"get_asset_holders",["1.3.15", 0, 100]]}
< {"id":1,"jsonrpc":"2.0","result":[{"name":"testz","account_id":"1.2.35","amount":10000}]}

After that I tried it on some live public full nodes, but I think the public nodes does not have the asset API enabled because the 'asset' call failed with an assertion error.
So I tried to start a full node according to the docs on bitshares-core github page with the memory reduction settings enabled. On my private node the ws calls are working but only for a few assets like BTS, USD etc. and not for my UIA. I think this could be a configuration issue on my private node, because when I call the lookup_asset_symbols method with the of my UIA it returns with an empty array while it works on every other public node.

Could you help me how to configure my private node to list all the UAI assets? Is there a public node where the asset API is accessible?

Offline abit

  • Committee member
  • Hero Member
  • *
  • Posts: 3482
    • View Profile
    • Steemit Blog
  • BitShares: abit
  • GitHub: abitmore
Re: How to use get_asset_holders?
« Reply #1 on: March 06, 2018, 11:39:12 am »
Perhaps you need to wait until your node is fully in sync?
BTS account: abit
BTS committee member: abit
BTS witness: in.abit

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12722
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
Re: How to use get_asset_holders?
« Reply #2 on: March 12, 2018, 02:41:27 pm »
works here:

Code: [Select]
2018-03-12 15:41:09,196 - grapheneapi.graphenehttprpc - DEBUG - {"method": "call", "params": [0, "get_chain_properties", []], "jsonrpc": "2.0", "id": 1}
2018-03-12 15:41:09,244 - grapheneapi.graphenehttprpc - DEBUG - "{\"id\":1,\"jsonrpc\":\"2.0\",\"result\":{\"id\":\"2.11.0\",\"chain_id\":\"39f5e2ede1f8bc1a3a54a7914414e3779e33193f1f5693510e73cb7a87617447\",\"immutable_parameters\":{\"min_committee_member_count\":11,\"min_witness_count\":11,\"num_special_accounts\":0,\"num_special_assets\":0}}}"
2018-03-12 15:41:09,244 - grapheneapi.graphenehttprpc - DEBUG - {"method": "call", "params": ["asset", "get_asset_holders", ["1.3.0", "0", "10"]], "jsonrpc": "2.0", "id": 2}
2018-03-12 15:41:10,447 - grapheneapi.graphenehttprpc - DEBUG - "{\"id\":2,\"jsonrpc\":\"2.0\",\"result\":[{\"name\":\"faucet\",\"account_id\":\"1.2.17\",\"amount\":\"664998526582542\"},{\"name\":\"svk-firefox\",\"account_id\":\"1.2.780\",\"amount\":\"30100687995802\"},{\"name\":\"f0x\",\"account_id\":\"1.2.792\",\"amount\":\"30098444449652\"},{\"name\":\"xeroc\",\"account_id\":\"1.2.29\",\"amount\":\"28004114538350\"},{\"name\":\"market-maker\",\"account_id\":\"1.2.30\",\"amount\":\"10000002000020\"},{\"name\":\"testnet-a\",\"account_id\":\"1.2.1227\",\"amount\":\"3739647293923\"},{\"name\":\"init0\",\"account_id\":\"1.2.6\",\"amount\":\"2976759392060\"},{\"name\":\"maker\",\"account_id\":\"1.2.104\",\"amount\":\"1051490159462\"},{\"name\":\"heroku-bot\",\"account_id\":\"1.2.654\",\"amount\":\"1000001999430\"},{\"name\":\"testz3\",\"account_id\":\"1.2.820\",\"amount\":\"989001994059\"}]}"
[{'account_id': '1.2.17', 'amount': '664998526582542', 'name': 'faucet'},
 {'account_id': '1.2.780', 'amount': '30100687995802', 'name': 'svk-firefox'},
 {'account_id': '1.2.792', 'amount': '30098444449652', 'name': 'f0x'},
 {'account_id': '1.2.29', 'amount': '28004114538350', 'name': 'xeroc'},
 {'account_id': '1.2.30', 'amount': '10000002000020', 'name': 'market-maker'},
 {'account_id': '1.2.1227', 'amount': '3739647293923', 'name': 'testnet-a'},
 {'account_id': '1.2.6', 'amount': '2976759392060', 'name': 'init0'},
 {'account_id': '1.2.104', 'amount': '1051490159462', 'name': 'maker'},
 {'account_id': '1.2.654', 'amount': '1000001999430', 'name': 'heroku-bot'},
 {'account_id': '1.2.820', 'amount': '989001994059', 'name': 'testz3'}]
Give BitShares a try! Use the http://testnet.bitshares.eu provided by http://bitshares.eu powered by ChainSquad GmbH