I would like to know how i can set up multiple bootnodes that share the same state. Would doing this require the bootnodes to share the same database? I know this is basic substrate staff but it would be helpful for a beginner like me to understand how the networking in substrate works. A detailed answer with some examples is highly appreciated.
1 Answer
- Generate the key (two ways)
- Use subkey, and put the key into
<DATA-DIR>/chains/<CHAIN-NAME>/network/<KEY>
- Run the node and stop it, the key will be created and it can be found under
<DATA-DIR>/chains/<CHAIN-NAME>/network/<KEY>
- Use subkey, and put the key into
- Read the your bootnode address
- Run the node
- Search the output like this
[Parachain] 🔍 Discovered new external address for our node: /ip4/<IP>/tcp/<PORT>/ws/<KEY>
- Replace the
<IP>
with your ip.
- Note:
<IP>
might be a private address, that you read from the log directly, you need figure out your public ip address and make sure you have a public address- if you are running a parachain, only focus on the
[Parachain]
log, not[Relaychain]
<PORT>
must be opened, without the firewall
- Finally, configure the bootnodes like this: https://github.com/darwinia-network/darwinia/blob/b2f5f4bb8937028d57bb8ebb5b0cafec6a37bba4/node/src/chain_spec/crab.rs#L270
Tips: backup your key, once you delete the <DATA-DIR>
the key will be lost, this happens a lot...