1

Is there a way to get block meta data only. For example:

cleos get block 12345

returns all transactions within that block. All I am interested in is the metadata. Is there a way to return without transaction data, for example:

"timestamp": "2018-11-26T18:52:45.500"

"producer": "eosio"

"confirmed": 0

"previous": "00083482841cd88ca17ff610158ea48cc9c281aaca6a0c51e5c2bd4c9ef94ccd"

"id": "00083483ebdf2141ae15cd69208f7cc6dbae250f234cf38bf8e1ecb0a0398f33"

"block_num": 537731

"ref_block_prefix": 1775048110

Specifically, I only want:

  • block_num
  • timestamp
  • confirmed

1 Answer 1

1

You can specify how many of the first lines you want in terminal with | head -n 11 then for the last 5 you can add | tail -n 5. This will effectively skip the transaction section.

./cleos -u https://nodes.get-scatter.com:443 get block 29000000 | head -n 11

{
  "timestamp": "2018-07-09T15:41:24.000",
  "producer": "eosswedenorg",
  "confirmed": 240,
  "previous": "004c4b3ff0edbaaf4f3ab1149a9baaf0b8edb97b02e41975f9e2489a6907ff6a",
  "transaction_mroot": "0000000000000000000000000000000000000000000000000000000000000000",
  "action_mroot": "9138d8cf0ab9efcbb40198e8ed6e6db000ee136d04d073419d2fe1fd924a04cf",
  "schedule_version": 127,
  "new_producers": null,
  "header_extensions": [],
  "producer_signature": "SIG_K1_KAAyWLHbsA3RSvKVX9vYAKx9ZmgbtPKHXkcv5qNBigXfD5SqNG5zQNAxDURbjs6ovbsMnYDeosYTZvBauETi2zfMn4oRMV",

./cleos -u https://nodes.get-scatter.com:443 get block 29000000 | tail -n 5

  "block_extensions": [],
  "id": "004c4b40582900dbe8d4592922d24a128120883c555491359e0adc9f6eb91fe0",
  "block_num": 5000000,
  "ref_block_prefix": 693753064
}
3
  • This is good to know, however, I'm assuming because it is the same http request that it would still return the full result (just filtered on the console). I'm more interested to know if there is a way I can only request those properties without the entire block of transactions. Commented Nov 26, 2018 at 23:25
  • 1
    Fair enough. I checked the docs and there are no additional flags for the get info method and no API calls that support what you're looking for, so unless you're going through someone else's custom API provider like say dfuse.io/en, then you may have to run a full node for that.
    – Nat
    Commented Nov 26, 2018 at 23:41
  • I thought that might be the case. Thank you for confirming. Commented Nov 27, 2018 at 1:32

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.