I have set up my blockchain with 5 validator nodes. Node01 is bootnode and Nodes 2,3,4,5 are working as validator nodes connected with bootnode. Now I have to expose WSS URL for my chain. I have read on Polkadot docs that validators should not be exposed in any case. Only sync nodes can be used as a backend for dApps. How can I connect the sync node to validator nodes to sync all data and can expose WSS port. or is there any best way to expose block chain wss port.
I think you should run your sync node without the
--validator flag, and if you have some sort of access control (like the
nodeAuthorization pallet) you should allow the new node in the network.
Just run the new node the same way you are running nodes 2, 3, 4 or 5, but avoid enabling the
--validator flag. Once the node starts, you should see it peers with other nodes and starts to import blocks, but you won't see it authoring blocks or starting consensus over any block.
This new node, although it won't author blocks, it can receive transactions and gossip them (I think), so you can connect your DApp to this node, and any transaction submitted to this node will eventually reach the other nodes.
I'm not 100% sure, but maybe someone can provide a more detailed answer.
UPDATE: I tested this so I could also confirm that it works as expected. If you run a new node without the
--validator flag it will sync blocks correctly and gossip any transaction it receives, so I think this is what you want. Make sure you are using an unknown account, i.e not using flags like
Oh and another thing, if your nodes are in the same network then you should not worry about anything else, but if they are on a different network, you should at least have a boot node that will bridge validators and your new node.