3

I have set up a Network of two Nodes in a local Network, but I cannot get the Polkadot Block explorer (polkadot.js.org) or the substrate-Front-End-Template to connect to it.

the polkadot app recognizes my custom end point somehow, but i am unable to connect.

Screenshot of polkadot.js.org while trying to connect to the custom End Point

How i got here:

1.) i am running my the substrate node template with the tutorial: add-trusted-nodes

2.) i got to the points where i get the nodes connected and producing blocks Screenshot of nodes connected

3.) now i want to connect the Nodes to the Front-end but i cannot establish connection.

4.) when starting the second Node it gives me this info about the descovered first node:

2023-05-05 12:45:29 discovered: 12D3KooWSY3YykHtFbyYsMZGgrpYnupVFwstz6GnGQ21wUJH3BUH /ip4/172.20.94.123/tcp/30333
2023-05-05 12:45:30 🙌 Starting consensus session on top of parent 0x2343075c3dc49c60abf79f40bcb2bbefbb83e413f016ac42e1aebc537dea5d19
2023-05-05 12:45:30 🎁 Prepared block for proposing at 472 (0 ms) [hash: 0x20e9259ca869ceefaaa28cc002157f5d3e0508a2b0c1f9a9845328fb1aa9959f; parent_hash: 0x2343…5d19; extrinsics (1): [0xe8e5…f0cd]]
2023-05-05 12:45:30 🔖 Pre-sealed block for proposal at 472. Hash now 0xf9837311863e70f651e5c476ef77deff55be78202def9d2f

can someone give me advice how to connect to the front-end again? THANK YOU IN ADVANCE

3
  • Could you post the full logs for one of the nodes? May 5 at 12:18
  • Looks like the error is connecting to ws://127.20.94.12 - this may be a network issue. Try replicating this issue with your nodes and your frontend all running on the same machine and use 127.0.0.1
    – Bruno
    May 6 at 22:30
  • --ws-external --rpc-external --rpc-cors all have you enabled these flags in your command? or you try to connect with the local host. May 7 at 5:11

1 Answer 1

2

In your step 1) you say you followed the add-trusted-node tutorial. In that tutorial the section entitled "View information about node operations" says that "After you start the local node, information about the operations performed is displayed in the terminal shell. In that terminal, verify that you see output similar to the following". In the tutorial the output shows Listening for new connections on 127.0.0.1:9945. and it says "The output specifies the IP address used for the node is the local host 127.0.0.1."

Important Note: Usually for the first node you could just use the default Web Sockets (WS) port, which is 9944, but for some reason in that tutorial in the "Start first node" section they unnecessarily decided to specify a custom Web Sockets port of 9945.

In your step 2) you don't share the start of your node logs so we can't verify whether you followed the tutorial precisely, but we could assume that you're listening for connections on a local machine with IP address 127.0.0.1, but it is not clear what its Node ID is (which you'd specify to connect other nodes to it as a bootnode) or what the public IP address is of that local machine.

In your step 3) where you try to connect your first node to the Polkadot.js Apps front-end but cannot establish connection, as shown in your first screenshot, it shows you've tried to connect to IP address 127.20.94.123 by going to https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.20.94.123%3A9944#/accounts, but if you were following that tutorial then the first node would be listening on WS port 9945 instead of 9944, so if your IP address was really 127.20.94.123, then you should be connecting to it at https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.20.94.123%3A9945#/accounts

If you're trying to connect to your first node using a web browser that is also running on the same machine as the first node, then you should be able to connect to it by going to https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9945#/accounts to connect to the local IP address 127.0.0.1 on WS port 9945.

Based on the terminal log outputs from your step 4), it looks like your first node was discovered with public IP address 172.20.94.123, so you should be able to connect to it at https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F172.20.94.123%3A9945#/accounts (assuming you started the first node with --ws-port 9945), but if the first node is running on a remote machine then you may need to check that you started that first node with additional flags to allow remote connections such as --ws-external --rpc-external --rpc-cors=all (as @AmitKumarYadav mentioned in the comments), which you may find by running node-template --help as mentioned here.

In your step 4) you also don't share the command you used the start of your node logs so we can't verify whether you followed the tutorial precisely or what the public IP address is of that second node that is listening for connections, as it might be running on a remote machine. In the logs of your second node it says it discovered IP address **172**.20.94.123 with /ip4/172.20.94.123/tcp/30333, which I assume is your first node running on IP address 172.20.94.123 (not to be confused with 127.20.94.123). The first node uses port 30333 by default, or you may have followed the tutorial and specified it explicitly with --port 30333.

When you started the second node did you specify the first node as a bootnode? For example, if the first node was running on local machine with IP address 127.0.0.1 and the second node was running on the same machine you'd use --bootnodes /ip4/127.0.0.1/tcp/30333/p2p/12D3KooWSY3YykHtFbyYsMZGgrpYnupVFwstz6GnGQ21wUJH3BUH, where 30333 corresponds to the first node being started using CLI option --port 30333 and the 12D3KooWSY3YykHtFbyYsMZGgrpYnupVFwstz6GnGQ21wUJH3BUH is the Node ID value that is shown in the logs when you started your first node, but if they were running on different machines then you'd specify the public IP address of the first node, which I assume is 172.20.94.123, so --bootnodes /ip4/172.20.94.123/tcp/30333/p2p/12D3KooWSY3YykHtFbyYsMZGgrpYnupVFwstz6GnGQ21wUJH3BUH, and you'd need to ensure that the remote machine had ports that it uses like 30333 open.

Connect to Polkadot.js Apps:

It's likely the reason why you can't connect the first node to the Polkadot.js Apps front-end in your step 3) is because you've accidentally used the wrong first byte in the IP address. If your first node is running on IP address 172.20.94.123, then you should be able to connect to it at https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F172.20.94.123%3A9945#/accounts (assuming you started the first node with --ws-port 9945), or at https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9945#/accounts (assuming you started the first node with --ws-port 9945) if you're connecting to it using a web browser running on the same local machine as the first node. But instead it appears you may have entered the wrong first byte for your IP address and tried to connect with unsuccessfully with 127.20.94.123 instead.

Connect to Substrate-front-end-template:

If your first node is running on public IP address 172.20.94.123 and you're running the substrate-front-end-template on a different machine then to connect to it you would need to change the default PROVIDER_SOCKET value here to "ws://172.20.94.123:9945" (assuming you started the first node with --ws-port 9945) and open the relevant ports.

If they are both running on the same machine then even the default value "ws://127.0.0.1:9944" used by the substrate-front-end-template will not work, because assuming you followed the add-trusted-node tutorial you would have started the first node with --ws-port 9945 and you would have specified --ws-port 9946 as the exposed WS port of the second node, so none of the nodes would be running on the default WS port of 9944 that is usually used by Substrate nodes, so you'd need to change it to a custom value of "ws://127.0.0.1:9945".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.