Unauthorized Error with multichain-node and ssh port forwarding

+1 vote

Hello,

I am using the multichain-node package to connect to a blockchain which is running on a remote server. For testing my code, I forwarded the remote port to a port on my machine, because the multichain is only accepting requests from localhost. Now I get an Unauthorized Error, and I don't know why. I also set up a rpcuser and rpcpassword in multichain.conf.

Here the connection object:

const connection = {
    port: 7194,
    host: '127.0.0.1',
    user: 'multichainrpc',
    pass: 'MyPass'
};

let multichain = require("multichain-node")(connection);

Do you have any ideas to fix my problem?

Regards,

Andreas K.

asked May 22, 2017 by andreas

1 Answer

+1 vote

I'm not sure what the problem is with the Node library or your port forwarding, but you can also use the rpcallowip setting in MultiChain to allow RPC connections from remote addresses. Perhaps that would be a simpler solution?

answered May 23, 2017 by MultiChain
I added the param rpcallowip=0.0.0.0/0 to the multichain.conf file and restarted the node, but I get just the same 401 Unauthorized Error. Any other ideas? Have I forgot something?

edit: the multichain is running from a specific user on a ubuntu machine. This user doesn't have root access. Could this be the problem?
There's no need to run under root. Please start debugging by trying to run multichain-cli on the same node as the server, and seeing if it can access it. If so, you're probably using the wrong username and password on the other server.
...