A simple json-rpc case for bitcoin blockchains
#!/usr/bin/env python
import json
import jsonrpc
import requests
#url = "http://user:password@ip:port/
#you can find user and password in multichain.conf file in path ~/.multichain/chain2
url = "http://multichainrpc:H4MvpnyZix9ynkJ3T8om8PtKziF7CtVtAH7WkZ3eRK1u@localhost:4352/"
headers = {'content-type': 'application/json'}
helpload = {
"jsonrpc":"1.0",
"method": "getinfo",
}
print "------ test begin --------"
response = requests.post(url, data=json.dumps(helpload), headers=headers).json()
print response

浙公网安备 33010602011771号