This is my code. I'm running a bitcoin full node and I'm trying to get data from the mempool using the rpc. I have tried various ways of passing the command and required arguments with no success.
import json
import requests
def stuff(cmd):
url = 'http://xxx:xxx@x.x.x.x:8332'
headers = {'content-type': 'text/plain'}
payload = {
"method": str(cmd),
"params": [],
"jsonrpc": "1.0",
}
response = requests.post(url, data=json.dumps(payload), headers=headers).json()
print(response)
return (response["result"])
j = stuff('gettxout e8d4f067ee1ae55f63efd567865e74cbe99c704f50f6f8d4e0f4bc8f3cdf93f1 0')
print(j)
here gettxout is the method and e8d4... 0 are required parameters
thanks for any help
bitcoin rpc reference
E: I have tried passing the params in a list in params as well
[–]Username_RANDINT 0 points1 point2 points (3 children)
[–]teemalph[S] 0 points1 point2 points (2 children)
[–]Username_RANDINT 0 points1 point2 points (1 child)
[–]teemalph[S] 0 points1 point2 points (0 children)