1

How can i use cleos to get all rows from a table?

It seems that cleos always only return 10 records?

{
"rows": [{
  "buyer": "1111111111oo",
  "keys": 70,
  "award": 198185,
  "share_award": 0,
  "sharer": ""
},{
  "buyer": "1111513tmall",
  "keys": 0,
  "award": 0,
  "share_award": 0,
  "sharer": "biancewallet"
},{
  "buyer": "1111cczk1111",
  "keys": 506,
  "award": 283701,
  "share_award": 0,
  "sharer": "fuckyourobot"
},{
  "buyer": "111222333111",
  "keys": 4,
  "award": 411,
  "share_award": 0,
  "sharer": "gtgatekeeper"
},{
  "buyer": "11xuyantao11",
  "keys": 0,
  "award": 0,
  "share_award": 0,
  "sharer": "wujie1234512"
},{
  "buyer": "131413145252",
  "keys": 2280,
  "award": 142261293,
  "share_award": 34500000,
  "sharer": "eos121dacsky"
},{
  "buyer": "1314baiyanwu",
  "keys": 0,
  "award": 0,
  "share_award": 0,
  "sharer": "blockone1111"
},{
  "buyer": "135111222333",
  "keys": 940,
  "award": 1460633683,
  "share_award": 166810000,
  "sharer": "hys123321hys"
},{
  "buyer": "1eosramcreat",
  "keys": 1000,
  "award": 417410680,
  "share_award": 367300000,
  "sharer": "kejingyk1211"
},{
  "buyer": "1grgeosdac11",
  "keys": 0,
  "award": 0,
  "share_award": 0,
  "sharer": "amazingeosio"
}
],
"more": true
}

Where can i get the real usage of ram? through website or i have to iterate all users' data, calc together?

How can i get all account information? loop all blocks, get names, then use get account name?

1 Answer 1

2

Your post seems to have several questions, so I'll just answer them individually:

how can i know if a name is account or contract?

A contract uses the name of an account that uploaded (set) it. If you are asking how you know an action comes directly from an account or via a smart contract, you can check for eosio.code permission. (example)

How can i use cleos to get all rows from a table?

There is a --limit UINT flag to go beyond the default 10 results

$ cleos get table
   ...
  -l,--limit UINT             The maximum number of rows to return
  ...
  -L,--lower TEXT             JSON representation of lower bound value of key, defaults to first

or you can select the key of the last result displayed, and use the --lower flag to get the new page as long as "more":true

Where can i get the real usage of ram? through website or i have to iterate all users' data, calc together?

You can use $ cleos get table eosio eosio global for some general information, including ram info, but for the highest granularity, you'd need to go through the entire ledger.

How can i get all account information? loop all blocks, get names, then use get account name?

Yes, if you want to get individual accounts, you'd need to check the ledger history. If you use eosio::mongo_db_plugin, it saves a collections for accounts that's very handy.

2
  • 1
    You can use cleos get code friedgermuef to check whether friedgermuef is an account or has a contract associated. If there is no contract the code hash is 0.
    – friedger
    Commented Jul 27, 2018 at 9:22
  • so many questions,haha
    – Jimmy Guo
    Commented Jul 27, 2018 at 11:40

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.