From eef7450288b106ec8c699b291fd38f419fae0dd5 Mon Sep 17 00:00:00 2001 From: Chris Chinchilla Date: Tue, 7 Jan 2020 11:17:44 +0100 Subject: [PATCH] Add private networking with puppeth draft --- .../creating-private-network-puppeth.md | 50 +++++++++++++++++++ docs/_getting-started/pup.md | 13 ----- 2 files changed, 50 insertions(+), 13 deletions(-) create mode 100644 docs/_getting-started/creating-private-network-puppeth.md delete mode 100644 docs/_getting-started/pup.md diff --git a/docs/_getting-started/creating-private-network-puppeth.md b/docs/_getting-started/creating-private-network-puppeth.md new file mode 100644 index 0000000000..84b15d5574 --- /dev/null +++ b/docs/_getting-started/creating-private-network-puppeth.md @@ -0,0 +1,50 @@ +--- +title: Creating a Private Network with Puppeth +sort_key: B +--- + +A private Ethereum network is useful for dapp testing, privacy, starting a local network for a hackathon, and many other purposes. An Ethereum network is private if the nodes are not connected to a main network. + +Setting up a private network can be a complex task; you need to configure a genesis block, different node types, miners, monitoring, and more. To help get you started, `puppeth` is a CLI tool that leads you through the steps to create a private network, building it with Docker containers, and in creating a new Ethereum network down to the genesis, bootnodes, signers, ethstats, faucet, dashboard and more, without the hassle that it normally takes to configure all these services one by one. Puppeth uses ssh to connect into remote servers and builds its network components out of docker containers using docker-compose. The user is guided through the process via a command-line wizard that does the heavy lifting and topology configuration automatically behind the scenes. + +## Prerequisites + +Any node you want to connect to the private network has some prerequisites: + +- The ethereum toolchain +- Docker +- A running instance of Geth + +You may have these already, but for ease of testing, [we have a vagrant file](https://github.com/ChrisChinchilla/Puppeth-Vagrant) you can use to create a two-node test cluster. + +With your nodes and geth running, run the following command: + +```shell +puppeth +``` + +Puppeth guides you through adding nodes to a private network, and this tutorial assumes you use the two-node cluster generated by the vagrant file above, if not, adjust your settings. + +First, create a name for your network, for example, `vagrantnet`. + +Puppeth then gives you four choices. Before any other steps, you need to add the instances. The IP addresses for the Vagrant nodes are "192.168.56.101" and "192.168.56.102". Select option `3` again, and then `2`, and add the IP address for one instance in the format `vagrant@192.168.56.101`, the password is "vagrant". Select option `3` again for adding the second node. + +You should now see a table listing the two nodes. + +Next, create a new genesis by selecting option `2`. Pick the default choices for the first three questions. For the fourth question that asks "Which accounts are allowed to seal?" and for the fifth question that asks "Which accounts should be pre-funded?", add one or more of the account addresses displayed in the Geth output from the `Vagrant up` process. When you have finished adding addresses for each question, enter a blank value to finish the step. + +Question six asks if you want the pre-compiled contracts pre-funded, type `yes`. These are a set of contracts that are used for computationally intensive operations that would cost too much gas to implement. + +Question seven asks if you want to specify a chain ID, take the default option, which is to create a random ID. + +With the genesis created, select option `4` from the main menu to deploy network components in a variety of Docker containers. + +Start by selecting option `1` to deploy [Ethstats](https://github.com/Alethio) to either instance to monitor statistics across the cluster. You can accept the defaults for all of the following questions except the "API password", which you can set as you want. Once setup is finished, you can now see ethstats listed in the instance table, and opening \_{IP_ADDRESS:PORT} in your browser should display the ethstats dashboard. + +Next, you need to deploy a bootnode component by selecting option `4` from the main menu, then `3` to deploy a new component, and then `2`. Pick the same instance you deployed ethstats to. Pick the default options for all the remaining questions, except the data location (set to `/home/vagrant/bootdata`), and the name of the node (`bootnode`). You should now see `bootnode` listed in the instances table, and the ethstats dashboard. + +Next, deploy a sealer component, a node which serves as the miner of new blocks. From the main menu, select `4` to manage network components, then `4`, and then `3`. Choose the same instance as every other component so far. Again pick default options for all the remaining questions, except the data location (set to `/home/vagrant/sealerdata`), and the name of the node (`sealernode`). For the question that asks for the "signer's key JSON", you can find this file in the data directory specified for the node during geth initialization. If you're using the Vagrant file above, this file is in `/home/vagrant/node1/keystore`. Copy and paste the value of this field as the answer to the question, the "unlock password" is `password`. As mining operations typically need more than one node, also add the sealer component to the other node, using the same values as for the other node, except that you need to specify a different port (when running both nodes on the same machine), a different name, and paste the signers key from the second node. You should now see `sealernode's listed in the instances table, and in the ethstats dashboard. + +Finally, add a dashboard component to view and manage the nodes and components. From the main menu, select `4` to manage network components, then `6`, and then `7`. Choose the same instance as every other component so far. Pick the default options for all the questions, and select the main node you installed each service on, or not to lost the service if you never installed it. You should now see the dashboard listed in the instances table, and at `192.168.56.101:{PORT}`. + +_This tutorial was heavily influenced and helped by [Bruno Skvorc's post](https://www.sitepoint.com/puppeth-introduction/)_. diff --git a/docs/_getting-started/pup.md b/docs/_getting-started/pup.md deleted file mode 100644 index 57741b0ff6..0000000000 --- a/docs/_getting-started/pup.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: Private Network -sort_key: B ---- - -A private Ethereum network is useful for dapp testing, privacy, starting a local network for a hackathon, and many other purposes. An Ethereum network is private if the nodes are not connected to a main network. - -Setting up your own private network can be a complex task, you need to configure a genesis block, different node types, miners, monitoring, and much more. To help get you started, `puppeth` is a CLI tool that leads you though the steps to create a private network, building it with Docker containers - - -aids in creating a new Ethereum network down to the genesis, bootnodes, signers, ethstats, faucet, dashboard and more, without the hassle that it would normally take to configure all these services one by one. Puppeth uses ssh to dial into remote servers, and builds its network components out of docker containers using docker-compose. The user is guided through the process via a command line wizard that does the heavy lifting and topology configuration automatically behind the scenes. - -Puppeth is not a magic bullet. If you have large in-house Ethereum deployments based on your own orchestration tools, it’s always better to use existing infrastructure. However, if you need to create your own Ethereum network without the fuss, Puppeth might actually help you do that… fast. Everything is deployed into containers, so it will not litter your system with weird packages. That said, it’s Puppeth’s first release, so tread with caution and try not to deploy onto critical systems.