getblockchaininfo returning excessive "soft fork" info

2

The blockchaininfo command is now returning a lot of "softfork" information.

Is there a way I can get other fields without the softfork blob?

Tyler Durden

Posted 2017-08-15T03:44:17.093

Reputation: 828

2Don't look at them? Or if you're using bitcoin-cli, use jq or even grep to filter them out?Pieter Wuille 2017-08-15T04:07:08.800

@PieterWuille You know, Pieter, blockchaininfo is a very commonly used command. It makes sense to return a single screen of the most useful information. For most users, the key thing is to make sure that they are synced, which means comparing the block count to the headers. Scrolling this critical information off the screen with a lot of softfork verbiage is a nuisance. There should either be a switch to remove that information altogether or at least it should be distilled to a synopsis so that the printout stays on one page.Tyler Durden 2017-08-15T12:07:45.013

RPC calls are more intended to be machine readable than human readable.Pieter Wuille 2017-08-15T17:15:08.450

Answers

1

You can use the jq shell command to filter out the unwanted keys.

$ ./bitcoin-cli getblockchaininfo | jq 'del (.softforks)' | jq 'del (.bip9_softforks)'

with as output:

{
  "chain": "main",
  "blocks": 485623,
  "headers": 485623,
  "bestblockhash": "000000000000000000772fa60c075c57b8ba2db277a84454e1f8e27c3c307b10",
  "difficulty": 922724699725.9628,
  "mediantime": 1505593445,
  "verificationprogress": 0.9999959396017668,
  "chainwork": "0000000000000000000000000000000000000000008aeb8bb8310a6b50e24bb0",
  "pruned": false
}

Pieter Wuille

Posted 2017-08-15T03:44:17.093

Reputation: 54 032