unable to view web demo from other user

+1 vote
Is it possible to make different user to view their own chain on the web demo??

So far only the host on the server can view the chain? i have created a login page to gain user credential such as chain name , rpc port number and rpcpassword, but i am not able to view the chain in the web demo.
asked Feb 5, 2017 by lee1010

1 Answer

0 votes

By default multichaind only accepts incoming API requests from the same computer it is running on. If you want something different you need to change the multichain.conf configuration. Please search this Q&A for rpcallowip to see some examples.

answered Feb 5, 2017 by MultiChain
below is one of the function in the webdemo, i have slightly modified it using php session.

function multichain($method) // other params read from func_get_args()
    {
        #global $multichain_chain;
       
        $args=func_get_args();

        return json_rpc_send($_SESSION['userChainInfo'][$_SESSION['userChainName']]['rpchost'], $_SESSION['userChainInfo'][$_SESSION['userChainName']]['rpcport'], $_SESSION['userChainInfo'][$_SESSION['userChainName']]['rpcuser'], $_SESSION['userChainInfo'][$_SESSION['userChainName']]['rpcpassword'], $method, array_slice($args, 1));

    }

Basically i have deployed webdemo on server A and i'm able to view the webdemo on the server itself, but when i try to access the webdemo from the other computer, it does not work, error http 0. i have enabled rpcallowip= 0.0.0.0/0 for testing purpose, i also run multichaind <chainname> on my that other computer, and visit the webdemo page and entered it own rpchost, username, password etc.

Do you have any idea what went wrong? the above process is tested on vm environment with 192.168.56.102 (server IP) and my other computer IP 192.168.56.101
It could also be a firewall issue, that one computer is not accepting incoming connections from another computer on the rpcport that MultiChain is using. You can test this using multichain-cli on one, to connect to MultiChain on the other. Or even start by trying to telnet to the rpcport from the other computer.
I have managed to connect to web demo from different server, is because i entered the wrong port, sorry about that. BTW, if i want other user to connect to my web demo, which mean each of them need to edit their multichain.conf file?

Then add this to ~/.multichain/chain1/multichain.conf:

rpcallowip=[IP address of your web server]

Is there other alternative way without them editing their multichain.conf file because i want to make my web demo to be as automated and user friendly.
...