5

I've done the Start a private network tutorial. However, in this tutorial, they run two-nodes on the same computer with different ports. Now I want to run a private network with different computers but I'm not quite sure how to do that.

2 Answers 2

6

I've not tried it on a local network - my nodes are all either on a single machine or in the cloud - but there are a couple of options that suggest it'll probably just work on the same private IP address subnet, if you're using --dev.

        --allow-private-ipv4               
            Always accept connecting to private IPv4 addresses (as specified in
            [RFC1918](https://tools.ietf.org/html/rfc1918)). Enabled by default for chains marked as "local" in their
            chain specifications, or when `--dev` is passed

        --discover-local                   
            Enable peer discovery on local networks.
            
            By default this option is `true` for `--dev` or when the chain type is `Local`/`Development` and false
            otherwise.

If it doesn't work without encouragement, you could give the two nodes the other node as a bootnode (technically only one needs to be able to find the other for it to work). Bootnodes either in the chainspec or on the command line.

        --bootnodes <ADDR>...                                        
            Specify a list of bootnodes

The format for bootnodes is:

 --bootnodes /ip4/<ip_address>/tcp/<p2p_port>/p2p/12D3KooWC1RbgqfcM219TvGoNfU3ZRQcBxWDiy9TGZDH6AjmVhP
(edit the node address too)

And don't forget to check that your p2p port isn't blocked by the firewall.

Note, that's just one option for bootnode definition, there are ipv6 and DNS methods too, but this is the simplest option for your needs.

1

There is a very easy way to set a private netwrok on two computers. on your first computer generate a customSpec.json file of your project and insert address of validators,session keys and all in your customSpec.json then generate a customSpecRaw and run the private network commanad.. Then on your second computer send your project binary,customSpecRawfile and your first node local identity with your ip address now you are ready to run second node on your computer using your private netwrok command.

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.