<p>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 <code>getblock</code> 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.</p>

<p>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.</p>

CC BY-SA 4.0
2019-06-06T12:40:14.787Z
2019-06-06T12:40:14.787Z
Ava Chow
<p>I'm trying to figure out how to use <code>bitcoin-cli</code> effectively to request a list of 50 blocks.</p>

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

<json-rpc><bitcoin-cli>
How to request a list of blocks using bitcoin-cli?
will.i.am
# How to request a list of blocks using bitcoin-cli?

(Asked by: username_0 on 2019-06-05)

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.

**Tags:** json-rpc, bitcoin-cli


---

## 1 answers

### Answer by username_1 on 2019-06-06. Score: 2

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.


---

