Hi,
MultiChain version: MultiChain Core Daemon build 1.0 alpha 21 protocol 10005
I'm trying to connect to the JSON-RPC API. For that, I use a Python script. default-rpc-port is set to 8346 in params.dat
config = file2dic(".multichain/icsv-chain/multichain.conf")
url = "http://" + config["rpcuser"] + ":" + config["rpcpassword"] + "@127.0.0.1:8346/"
headers = {
'content-type': 'content-type: application/json'
}
payload = {
"jsonrpc": "1.0",
"id": 0,
"method": "getinfo",
"params": []
}
response = requests.post(url, data=json.dumps(payload), headers=headers)
Response is 403. Any ideas?
Edit1: The generated URL: http://multichainrpc:AXsiEahZe19QgpCwZwFJRL327SqcKrFaVv1FfpeQGij3@127.0.0.1:8346/
Edit2: Also tried:
{
"jsonrpc": "1.0",
"id": 0,
"method": "icsv-chain getinfo",
"params": []
}
Edit3: Also tried:
{
"jsonrpc": "1.0",
"id": "1",
"method": "getinfo",
"chain_name": "icsv-chain",
"params": []
}
Edit4: I have isolated the problem. I am actually using Docker to run multichaind on my Mac. Inside of the container, this works:
curl -X POST -H "Content-Type: text/plain" -H "Authorization: Basic bXVsdGljaGFpbnJwYzpBWHNpRWFoWmUxOVFncEN3WndGSlJMMzI3U3FjS3JGYVZ2MUZmcGVRR2lqMw==" -H "Cache-Control: no-cache" -H "Postman-Token: 1ac4e084-e8c8-10a2-f290-fd24fd13d1e0" -d '{
"jsonrpc": "1.0",
"id": "1",
"method": "getinfo",
"chain_name": "icsv-chain",
"params": []
}' "http://127.0.0.1:8346/"
Outside of the container, this does not work. I did my port mapping like this:
docker run \
--name=multichain-node \
-p 8346:8346 \
-p 8347:8347 \
-v $(pwd)/.multichain:/root/.multichain \
-it multichain-node multichaind $PEER -rpcallowip=0.0.0.0
But is still does not work. Any ideas?