API Calls to remote node

+2 votes

Hello,

I have setup a multichain node on a remote server. I am trying to make API calls using the javascript API (https://github.com/scoin/multichain-node), but I get ECONNREFUSED and socket hang up errors.

I am testing the first commands provided in test.js : 

 

let multichain = require("multichain-node")({
    port: 6282,
    host: '127.0.0.1',
    user: "multichainrpc",
    pass: "somepass"
});

multichain.getInfo((err, info) => {
    if(err){
        throw err;
    }
    console.log(info);
})
 
with the connexion parameters of my remote server, as follow
Port : default-rpc
Host : ip address of remote server
And the username/password provided in the multichain.conf file of my chain.
 
What have I missed ?
 
Thanks ! :)
asked Nov 23, 2016 by anonymous

2 Answers

+2 votes

Search this Q&A for rpcallowip – you need to instruct MultiChain to accept API calls from remote hosts.

answered Nov 23, 2016 by MultiChain
To expand on the answer for others:

check the port for the API found in the params.dat - this is generated.
Ensure your firewall is open.

edit multichain.conf in your blockchain directory, found in  ~/.multichain/ or on windows  %APPDATA%\MultiChain\Yourchain

The 3 important settings would be
rpcuser=username
rpcpassword=password
rpcallowip=ipaddress


Remember to restart - multichaind yourchain
0 votes

you can start your sever using this line 

"multichind chain_name --rpcuser=multichainrpc --rpcpassword=somepass --rpcport=6282 --sendfreetransaction"

if it's not work you can change the host filed like "host:localhost"

answered Aug 29, 2017 by Darwin
...