2

I want to start my own blockchain. I try to start substrate-node-template and substrate-front-end-template remotely, but there is guide instructions only for local machine. I installed and compiled node and frontend on linux dedicated server. The question is:

  1. How to start node remotely and make it run even when I close the ssh panel.
  2. How to make frontend find the node? Because when I open the link somesite.com - it tries to connect the node all the time? and all the time gets an errors with no connections.
    Frontend error:
        Error Connecting to Substrate
        Connection to websocket 'wss://127.0.0.1:9944/' failed.

    Log from my node-template:
    2023-07-19 13:38:51 Accepting new connection 1/100
    2023-07-19 13:38:51 HTTP serve connection failed hyper::Error(Parse(Method))
    2023-07-19 13:38:54 ✨ Imported #140 (0xfca2…389f)


    Commands I use:
    ./target/release/node-template
    --base-path /tmp/alice
    --chain local
    --alice
    --port 30333
    --ws-port 9944
    --rpc-port 9933
    --node-key 0000000000000000000000000000000000000000000000000000000000000001
    --telemetry-url "wss://telemetry.polkadot.io/submit/ 0"
    --validator
    --unsafe-ws-external
    --unsafe-rpc-external
    --rpc-cors=all
    --rpc-methods=Unsafe
1
  • I found decision - in production/development.json need to specify ws://server_ip_address instead of wss://server_ip_address . And in browser it should run without https (only http). Now I'm looking how to fix it to run over https server (not http) Jul 25, 2023 at 9:39

2 Answers 2

0
  1. How to start node remotely and make it run even when I close the ssh panel.

To start the node remotely then assuming you've already built the substrate-node-template in the folder /opt/substrate-node-template and assuming your username and IP address is [email protected] and that you've setup public key authentication for ssh (passwordless login) as described in here then you could run the following, which uses the steps mentioned here or to remotely run a shell script with executable permissions.

ssh [email protected] "cd /opt/substrate-node-template && ./target/release/node-template --dev"

To make substrate-node-template run even when you close the ssh panel, run it as a Systemd process like they mention here under the "Linux servers" heading. The following guides are provided reference:

  • Use a Systemd service to run a Polkadot validator node by following this guide
  • Use a Systemd service to run a Moonbeam collator node by following this guide.

If you do not want to use a Systemd process then you could use the tmux program or the screen program to run and detach from multiple sessions so they keep running.

How to make frontend find the node? Because when I open the link somesite.com - it tries to connect the node all the time? and all the time gets an errors with no connections

  • Check that the substrate-node-template is actually running and configure the CLI options to securely expose it using the default ports or explicitly configure the port numbers to use with CLI options --port, --rpc-port, and --ws-port. Also check that you are running other CLI options like the following in a development environment only to expose it --unsafe-ws-external, --unsafe-rpc-external, --rpc-cors=all, --rpc-methods=Unsafe.
  • Configure your linux dedicated server firewall to accept connections on those ports
  • Check that you have updated your browser to the latest version and that you have disabled any browser plugins like this that may interfere with the connection
  • Check that your substrate-front-end-template is configured to try to connect to the substrate-node-template using the default or custom ports that you are using it with
  • Take a screenshot or copy/paste the error shown in the web browser console and share it with us here
8
  • Error from my node like this: HTTP serve connection failed hyper::Error(Parse(Method)) And error from frontend like this: Error Connecting to Substrate Connection to websocket 'wss://127.0.0.1:9944/' failed. Jul 19, 2023 at 11:34
  • Try running it with --ws-port 9944 instead of --ws-port 9945. If you followed an official substrate-node-template guides like docs.substrate.io/tutorials/build-a-blockchain/simulate-network, they use all default ports, but they explicitly ask you to use port 9945 with --ws-port 9945 ` (instead of the default port 9944`). By doing that it presents an hidden challenge for newcomers as they don't mention it's a non-default port. It's not the first time I've seen someone encounter this issue, so I'd recommend updating the docs to mention when an example uses a non-default port. Jul 20, 2023 at 1:26
  • Since those official examples use non-default port 9945 instead of default port 9944, users get stumped and can't automatically connect their node when they go to polkadot.js.org/apps, where if you choose to connect to your Local Node it is pre-populated with the default port 9944 (i.e. polkadot.js.org/apps/?rpc=ws://127.0.0.1:9944). It's also why the substrate-front-end-template by default connects to port 9944 github.com/substrate-developer-hub/substrate-front-end-template/… Jul 20, 2023 at 1:30
  • It is still not working. I change the port, so now there is no error in node terminal. But it is still an error in frontend. The same error: Error Connecting to Substrate Connection to websocket 'ws://127.0.0.1:9944/' failed.. And browser console shows me this: **logger.js:56 2023-07-20 12:48:41 API-WS: disconnected from ws://127.0.0.1:9944: 1006:: Abnormal Closure overrideMethod @ console.js:213 Gs @ logger.js:56 error @ logger.js:115 Sc.__internal__onSocketClose @ index.js:71 Show 1 more frame index.js:307 WebSocket connection to 'ws://127.0.0.1:9944/' failed: ** Jul 20, 2023 at 9:51
  • can you help me, if I give you all access? I study substrate almost 2 months and still cannot run even this simple project. Jul 20, 2023 at 10:46
0

I opened browser with http://somedomen.com (not https:// like earlier) and now it works fine with -ws-port. Too bad that substrate doesn't support --wss-port, becouse I still dont know how to make it work with ssl

Your Answer

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

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