Cannot connect to multichain running in compose from host machine multichain-cli. Urgent

+1 vote
I know this question has been asked a several times but I have looked everywhere but I cant find a proper solution to it.

So I have a multichain which is running in my docker compose:

version: '2.1'

services:
    # basenode:
    #     build: ./base
    #     stdin_open: true
    #     tty: true
    masternode:
        build: ./master
        stdin_open: true
        tty: true
        ports:
            - "7557:7557"
            - "8002:8002"
        expose:
            - 7557
            - 8002        
        environment:
            CHAINNAME: MyChain
            NETWORK_PORT: 7557
            RPC_PORT: 8002
            RPC_USER: multichainrpc
            RPC_PASSWORD: mypassword
            RPC_ALLOW_IP: 0.0.0.0/0.0.0.0
            PARAM_TARGET_BLOCK_SIZE: target-block-time|30
            PARAM_ANYONE_CAN_RECEIVE: anyone-can-receive|true
            PARAM_ANYONE_CAN_SEND: anyone-can-send|true
            PARAM_ANYONE_CAN_ISSUE: anyone-can-issue|true
            PARAM_ANYONE_CAN_CONNECT: anyone-can-connect|true
            PARAM_ANYONE_CAN_MINE: anyone-can-mine|true
    slavenode:
        build: ./node
        stdin_open: true
        tty: true
        expose:
            - 7557
            - 8002
        environment:
            CHAINNAME: MyChain
            NETWORK_PORT: 7557
            RPC_PORT: 8002
            RPC_USER: multichainrpc
            RPC_PASSWORD: mypassword
            RPC_ALLOW_IP: 0.0.0.0/0.0.0.0
            MASTER_NODE: masternode
        links:
            - masternode
        depends_on:
            - masternode
    explorernode:
        build: ./explorer
        stdin_open: true
        tty: true
        expose:
            - 2750
            - 7557
            - 8002
        environment:
            CHAINNAME: MyChain
            NETWORK_PORT: 7557
            RPC_PORT: 8002
            RPC_USER: multichainrpc
            RPC_PASSWORD: mypassword
            RPC_ALLOW_IP: 0.0.0.0/0.0.0.0
            MASTER_NODE: masternode
        links:
            - masternode
        depends_on:
            - masternode

 

when i run my compose, it can see my chain running because it gives txn id, generating blocks, etc.

 

But now I have an app in my host machine, which is a windows 10 Azure VM. I want it to connect to my multichain which is running in my docker. (Mind it i have my ports mapped for my master node if u see the compose file above)

According to my understanding if I can connect to this chain from my  host machine using multichain-cli, then I can use all those ip addresses and ports for my app too.

But I cannot connect to my multichain from the multichain-cli which im running from the command promt of my host machine. Where am I going wrong?

 

PS: If you need any other info. please feel free to ask.
asked Aug 3 by Sunaina

1 Answer

0 votes
 
Best answer

Did you pass all the appropriate parameters to multichain-cli, including rpcconnect (to map to the internal IP address of your Docker instance), rpcport, rpcuser and rpcpassword?

answered Aug 5 by MultiChain
I used the below command:

multichain-cli MyChain -rpcconnect <tries> -rpcport 8002 getinfo

For <tries> I tried with all the below options:

localhost

0.0.0.0

127.0.4.2 - that’s the internal ip which multichain shows saying use this chain address for other nodes to connect to this: MyChain@127.0.4.2:7557

I also tried creating a network using the compose for my master node and assigning a static ipv4 for that.

But nothing seems to work. :(

So even if I have missed the username and password, could u tell me which of the above options is correct?
The format for command-line parameters is:

multichain-cli MyChain -rpcconnect=[ip address] -rpcport=8002

i.e. you need the = sign in there.
What is the ip address that I should be using? A static ipv4 address? Or the internal 127.0.4.2 address?
It keeps saying please set the password and user name. Which I think it’s giving because it can’t find the chain
You should be using whichever IP address the Docker instance exposes to the host system. And you need to pass the username and password in the rpcusername and rpcpassword parameters respectively.
...