peer-connection procedure for open network

+1 vote

Dear technical team,

I setup an open multichain network, that is with the following parameter in param.dat file:

anyone-can-connect = true

in order to let the nodes connect and syncronyze with the network, I'm using the following procedure:

> /usr/local/bin/multichaind testchain@<seed ip address>:<port> -daemon

This command gets the params.dat from the seed node BUT mc server is not started.

find multichain PID with:

> ps -ax | grep multichaind

> kill PID

The killing command is needed in order to avoid the following error I can find in the log file:

> ERROR: Calling address lookup for <seed ip> from secondary thread, please report this

launch again:

> /usr/local/bin/multichaind testchain@<seed ip address>:<port> -daemon

Now the node up and running and syncronized with the network. This procedures works but I'm wondering if it is the right one and I could skip the killing PID command.

asked Dec 6, 2021 by Fabio
Thanks, which version of MultiChain are you using?
At the moment I'm developing on community edition 2.2 but I got the same behaviour with 2.1 and 2.0 version.
Thanks, can you please confirm that the seed IP address is expressed as an IP address and not a domain name that needs resolving?
At the moment I used domain name but I will test immediately both of them and let you know. Please hold on.

1 Answer

+1 vote

I tried to connect to seed node using ip address directly:

/usr/local/bin/multichaind testchain_01@<ip address>:<port> -daemon

from the debug.log file everything seems ok but if I try to connect to the blockchain I have the following:

MultiChain 2.2 RPC client


Interactive mode

testchain_01: getinfo
error: couldn't connect to server
testchain_01: exit
Bye

 

So basically nothing changes.
Now I have to kill the process and launch again and everything is fine.

In order to understand better I notice that in the log file I have the following line:
2021-12-06 22:02:04 ERROR: Read : Failed to open file /home/nodo/.multichain/testchain_01/peers.dat

 

So the procedure to reproduce is the following:

- launch the first call (use ip address or name of the seed node doesn't matter):
/usr/local/bin/multichaind testchain_01@<ip address>:<port> -daemon

server is not started and in the log file I have:
ERROR: Read : Failed to open file /home/nodo/.multichain/testchain_01/peers.dat

- kill multichaind process.

- launch again:
/usr/local/bin/multichaind testchain_01@<ip address>:<port> -daemon

What do you think about?
It is not a real issue but I'd like to have a more clean install procedure avoiding killing the process.



 

 

answered Dec 6, 2021 by fabio
Were you able to reproduce the point ?
Could you please help me?

Thanks
I've discuss with the developer team. First you should not worry about this issue, it is quite normal when starting a chain:

Failed to open file /home/nodo/.multichain/testchain_01/peers.dat

So if multichaind is exiting after it is starting, it's worth seeing what else is in the debug.log which might explain it. You can send the entire file to us at multichain dot debug at gmail dot com and we'll take a look.
I found something interesting.
I started from a clean setup removing a previuous setup and stopping multichain server, than i typed the following:

>> /usr/local/bin/multichaind <chain_name>@$(dig +short <seed server by name>):5333 -daemon -debug

the folder is created and I type

>> netstat -natp
tcp        0      0 0.0.0.0:5333            0.0.0.0:*               LISTEN      3708/multichaind
tcp        0      0 127.0.0.1:8570          0.0.0.0:*               LISTEN      3708/multichaind

I found that the server process is binded to 2 socket.
5333 is the port specified in the params.dat file
8570 is NOT the rpc port specified in the params.dat (the actul one is 5332)

default-network-port = 5333             # Default TCP/IP port for peer-to-peer connection with other nodes.
default-rpc-port = 5332                 # Default TCP/IP port for incoming JSON-RPC API requests.

In the debug.log file I found the following:
2021-12-27 17:52:15 Default data directory /home/fabio/.multichain/testrail_01
2021-12-27 17:52:15 Using data directory /home/fabio/.multichain/testrail_01
2021-12-27 17:52:15 Using config file /home/fabio/.multichain/testrail_01/testrail_01.conf

  [-- Fabio rem --]: this file doesn't exist at the moment of connection

2021-12-27 17:52:15 Using at most 125 connections (1024 file descriptors available)
2021-12-27 17:52:15 Using 2 threads for script verification
2021-12-27 17:52:15 Using wallet wallet.dat
2021-12-27 17:52:15 init message: Verifying wallet...
2021-12-27 17:52:15 Wallet file doesn't exist. New file will be created with version 3.
2021-12-27 17:52:15 Allowing RPC connections from: 127.0.0.0/255.0.0.0 ::1/ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff
2021-12-27 17:52:15 Binding RPC on address ::1 port 8570 (IPv4+IPv6 bind any: 0)
2021-12-27 17:52:15 Binding RPC on address 127.0.0.1 port 8570 (IPv4+IPv6 bind any: 0)
  [-- Fabio rem --]: here is the wrong binding

so now if I type:
>>  multichain-cli testrail_01
I CANNOT talk to the server beacuse in multichain.conf the specified port is 5332.

>>  multichain-cli testrail_01 -rpcport=8570
I can talk to the server and then stop and start again

>> multichaind testrail_01 -daemon

Now the server is listening on the right port
tcp        0      0 0.0.0.0:5332            0.0.0.0:*               LISTEN      6976/multichaind

So it seems that in case of open MC network the rpc port is binded to the defaul value.
I tried then to init the server by adding rpcport params:
/usr/local/bin/multichaind testrail_01@$(dig +short <seed node by name>):5333 -rpcport=5332 -daemon

and everything is fine:

tcp        0      0 127.0.0.1:5332          0.0.0.0:*               LISTEN      1915/multichaind

What do you think about?
...