Does bitcoind accept batch RPC calls?

6

2

Am currently sending RPC calls to bitcoind in Python3 in series using JSON:

import json, requests

def pull(command, foo):
    headers = {'content-type': 'application/json'}
    payload = json.dumps({"method": command, "params": [foo], "jsonrpc": "2.0"})
    response = requests.get(serverURL, headers=headers, data=payload)

    return(response.json()['result'])

Ex:

pull('getblock', BLOCKHASH)

and hope to improve call speeds by doing batch RPC calls.

Is this possible and how so?

SLee

Posted 2015-07-09T10:42:40.517

Reputation: 113

Answers

8

Yes, this is supported. As specified by JSON-RPC 2.0, you can send in an array of requests, and receive an array of solutions.

Pieter Wuille

Posted 2015-07-09T10:42:40.517

Reputation: 54 032