1

I'm trying to figure out how to use bitcoin-cli effectively to request a list of 50 blocks.

As far as I am aware, bitcoin-cli getblock list does not work. Also how to best extract information out of the getblock output.

1

You cannot as there currently no way in Bitcoin Core's RPC to get multiple blocks with one command. You will have to issue multiple getblock commands. If you use a JSON-RPC client programmatically, you can use JSON-RPC's batched requests in order to have to only send one JSON-RPC request to execute multiple RPCs and get the results back in one response.

As for how to extract the information, you will need a JSON parser to extract the information. You can use verbosity level 2 in order to get the transactions decoded as well instead of just their txids.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.