Having issues with Multichain web demo

+4 votes
I get this when I open the browser .........

Choose an available node to get started:

$rpc) if (isset($rpc['rpchost'])) echo '

'.html($rpc['name']).'
'; ?>

Is the problem configuration file ?

n the demo website directory, enter chain details in config.txt e.g.:

default.name=Default                # name to display in the web interface
default.rpchost=127.0.0.1           # IP address of MultiChain node
default.rpcport=12345               # see rpc-port from chain parameters
default.rpcuser=multichainrpc       # username for RPC from multichain.conf
default.rpcpassword=mnBh8aHp4mun... # password for RPC from multichain.conf

I changed it to ,

default.name=Default                # name to display in the web interface
default.rpchost= 64.137.166.130   # IP address of MultiChain node
default.rpcport=8338               # see rpc-port from chain parameters
default.rpcuser=multichainrpc       # username for RPC from multichain.conf
default.rpcpassword=( put my password)  ... # password for RPC from multichain.conf

 

What am I doing wrong ?

 

I think you can see it at ? http://64.137.166.130/

Cheers

 

Rad
asked Dec 1, 2016 by anonymous

2 Answers

+1 vote

This is probably because the code assumes you have the short_open_tag PHP option switched on. We'll fix this soon, but in the meantime perhaps you can change that in your configuration.

answered Dec 2, 2016 by MultiChain
The error vanished but still it is not working.  I see only a page with "My Node" displayed with no details below. The links also do not display anything when I click on it. What could be wrong ?

The  link shows > http://64.137.166.130/?chain=default
Please take a look at your web server's error_log file.
Checked the php5  error logs. This is what I found ,

[Sat Dec 03 06:52:58.439844 2016] [:error] [pid 946] [client 173.206.42.32:61840] PHP Fatal error:  Call to undefined function curl_init() in /var/www/html/functions.php on line 38, referer: http://64.137.166.130/

http://64.137.166.130/ is the nodes address and 173.206.42.32 is my pcs address.  

Line 38 is  in the function function json_rpc_send which > $ch=curl_init($url);

see below.

function json_rpc_send($host, $port, $user, $password, $method, $params=array())
    {
        $url='http://'.$host.':'.$port.'/';
               
        $payload=json_encode(array(
            'id' => time(),
            'method' => $method,
            'params' => $params,
        ));
       
    //    echo '<PRE>'; print_r($payload); echo '</PRE>';
       
        $ch=curl_init($url);
        curl_setopt($ch, CURLOPT_POST, true);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_USERPWD, $user.':'.$password);
        curl_setopt($ch, CURLOPT_HTTPHEADER, array(
            'Content-Type: application/json',
            'Content-Length: '.strlen($payload)
        ));
       
        $response=curl_exec($ch);
       
    //    echo '<PRE>'; print_r($response); echo '</PRE>';
       
        $result=json_decode($response, true);
       
        if (!is_array($result)) {
            $info=curl_getinfo($ch);
            $result=array('error' => array(
                'code' => 'HTTP '.$info['http_code'],
                'message' => strip_tags($response).' '.$url
            ));
        }
       
        return $result;
    }

Can you help me ?
The problem is that your PHP installation does not have the curl module installed. This is a fairly standard extension - perhaps you can add it?
Thank you. Okay I added it. But still not pulling up the details.

The page displayed ,

My Node
Error: HTTP 0
http://64.137.166.130:8338/
Connected Nodes
Error: HTTP 0
http://64.137.166.130:8338/
My Addresses
Error: HTTP 0
http://64.137.166.130:8338/
Get new address
I checked the error in the log and found none . Then I clicked on "get permissions" . Now I get ,

Current Permissions
Error: HTTP 0
http://64.137.166.130:8338/


But when I check the log I see the error ,

[Sat Dec 03 15:07:33.349000 2016] [:error] [pid 1051] [client 173.206.42.32:56145] PHP Notice:  Undefined index: address in /var/www/html/page-permissions.php on line 34, referer: http://64.137.166.130/?chain=default

Must be something silly , but still beyond me ....
Your node is probably not configured to accept API requests from your web server. Please review the installation instructions: https://github.com/MultiChain/multichain-web-demo
Thanks.  I was able to get it running. The mistake I was making was that web server is running in the same machine as the node. But I put the actual address instead of default.rpchost=127.0.0.1  . So I had to put rpcallowip=[IP address of your web server] in the config file which I had overlooked.
Great - glad you got it fixed.
this command install the curl php extension for me and it's up and running now. thanks

sudo apt-get install php-curl
Can be php5-curl  or php7.0-curl etc depending on your php version.
+1 vote
I did what was mentioned in the answer, but it didn't work.

 

It seems that this demo require PHP7, so what I did is the following:

sudo apt-get install php php-mysql

Then I refreshed the page, and the problem resolved.
answered Mar 18, 2018 by bkhashfeh80
...