From 9a0ada450317d7cb4e15b5a27846e3b0573f2a36 Mon Sep 17 00:00:00 2001 From: Nils-Erik Frantzell Date: Mon, 1 Apr 2019 21:08:29 -0700 Subject: [PATCH 01/12] Rename existing private network documentation --- doc/index.rst | 2 +- doc/{private_net.rst => private_net_remix.rst} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename doc/{private_net.rst => private_net_remix.rst} (100%) diff --git a/doc/index.rst b/doc/index.rst index f15e303df69..74278a99d52 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -5,4 +5,4 @@ Internal documentation 2. `Database Layout `_ 3. `Generating Consensus Tests `_ 4. `Using snapshot sync `_ -5. `Creating a private network and deploying a contract with Remix `_ +5. `Creating a private network and deploying a contract with Remix `_ diff --git a/doc/private_net.rst b/doc/private_net_remix.rst similarity index 100% rename from doc/private_net.rst rename to doc/private_net_remix.rst From 98409f3a81aaa4cf9298ca854616404c9644c529 Mon Sep 17 00:00:00 2001 From: Nils-Erik Frantzell Date: Mon, 1 Apr 2019 22:02:58 -0700 Subject: [PATCH 02/12] Initial (extremely rough) version of new private docs --- doc/index.rst | 3 +- doc/private_net_sync.rst | 185 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 187 insertions(+), 1 deletion(-) create mode 100644 doc/private_net_sync.rst diff --git a/doc/index.rst b/doc/index.rst index 74278a99d52..0a058405131 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -5,4 +5,5 @@ Internal documentation 2. `Database Layout `_ 3. `Generating Consensus Tests `_ 4. `Using snapshot sync `_ -5. `Creating a private network and deploying a contract with Remix `_ +5. `Creating a single-node private network and deploying a contract with Remix `_ +6. `Creating a private network with 2 syncing nodes `_ diff --git a/doc/private_net_sync.rst b/doc/private_net_sync.rst new file mode 100644 index 00000000000..6dae4e0bc48 --- /dev/null +++ b/doc/private_net_sync.rst @@ -0,0 +1,185 @@ +Creating a private network with 2 syncing nodes +=============================================== +These instructions cover creating an Ethereum private network consisting of 2 nodes - 1 node will mine blocks and the other node will connect to the first node and sync the mined blocks to its own block database. + +Before we start +=============== + +What is a private network? +========================= +TODO + +What is a private chain? +======================== +TODO: + +Other notes +=========== +* Mining will be done using a CPU miner (Aleth doesn't include a GPU miner for various reasons, the main one being the extremely high cost of end-user support - e.g. drivers, TODO: Look @ Pawel's notes in email) +* Only 1 node will be mining because both nodes are running on the same physical system, so having multiple CPU miners will significantly impact system responsiveness - TODO: will running 2 miners be worse than 1 miner since mining is configured by default to use as many threads as possible? + * TODO: If you'd like to have both nodes mine (or system responsiveness is impacted by 1 miner), you can reduce the number of threads used by each CPU miner via the -t flag. + * TODO: CPU miner is configured by default to use as many threads as possible - TODO: Does it just use 1 thread per CPU core? It presumably doesn't just create UINT_MAX threads? +* You typically run a private network using a specialized chain configuration (though this isn't strictly required) in the form of a json file. TODO: more information? +* Since the json file is used to create the private chain's genesis state, both clients must use the same chain configuration file otherwise they won't be able to connect with each other. TODO:? + +Instructions +============ +1. Create a key pair for each node +Execute the following command: + +aleth.exe account new + +Enter the desired password when prompted + +2. Add each address (these are the public keys generated in the previous step) that you wish to send transactions with into the "accounts" section of your chain configuration json file (we'll just call this config.json) along with the desired balance (in TODO:?). For example: +TODO: + +3. Start the first node by executing the following command (each of the options are explained below): + + Aleth -m on --config -a --no-discovery --unsafe-transactions --listen --db-path + +○ -m on: Enables CPU mining +○ --config: Path to chain configuration file +○ -a: Sets recipient of mining block reward +○ --no-discovery: Disables the devp2p discovery protocol (it's unnecessary in a 2-node configuration, we'll be adding a peer manually) +○ --unsafe-transactions: Don't prompt before sending each transaction (unnecessary in a testing environment) +* --listen: TCP port to listen for incoming peer connections. Required so that Aleth will start its devp2p protocol implementation - TODO? +* --db-path: Path to save blocks to. You don't technically need to supply this, but if you've run other syncing nodes on your machine you'll want to make sure you save the private network blocks to a different location (otherwise you can run into TODO) + +Make note of the node's enode URL since you'll need to reference it when launching the second node. The enode URL should be logged within the first few lines. For example: + + aleth, a C++ Ethereum client + INFO 04-01 20:34:38 main net Id: ##fb867844… + aleth 1.6.0-alpha.1-28+commit.32bb833e.dirty + Mining Beneficiary: 84258fde-b0d9-747e-b70f-f55e14831192 - 00fd4aaf9713f5bb664c20a462acc4ebc363d1a6 + INFO 04-01 20:34:40 p2p info UPnP device not found. + WARN 04-01 20:34:40 p2p warn "_enabled" parameter is false, discovery is disabled + Node ID: enode://fb867844056920bbf0dd0945faff8a7a249d33726786ec367461a6c023cae62d7b2bb725a07e2f9832eb05be89e71cf81acf22022215b51a561929c37419531a@0.0.0.0:0 + INFO 04-01 20:34:40 main rpc JSON-RPC socket path: \\.\pipe\\geth.ipc + JSONRPC Admin Session Key: 7BPb1cysJuQ= + INFO 04-01 20:34:40 main client Mining Beneficiary: @00fd4aaf… + +If everything goes smoothly you should see the node start mining (empty) blocks after a minute or two: + + C:\Users\nilse\Documents\Code\aleth\build\aleth\Debug>aleth -m on --config %CODE%\config.json -a 00fd4aaf9713f5bb664c20a462acc4ebc363d1a6 --no-discovery --unsafe-transactions --listen 30303 --db-path %APPDATA%\EthereumPrivate_00 + aleth, a C++ Ethereum client + INFO 04-01 20:38:58 main net Id: ##5def5843… + aleth 1.6.0-alpha.1-28+commit.32bb833e.dirty + Mining Beneficiary: 84258fde-b0d9-747e-b70f-f55e14831192 - 00fd4aaf9713f5bb664c20a462acc4ebc363d1a6 + INFO 04-01 20:38:59 p2p info UPnP device not found. + WARN 04-01 20:38:59 p2p warn "_enabled" parameter is false, discovery is disabled + Node ID: enode://5def584369536c059df3cd86280200beb51829319e4bd1a8bb19df885babe215db30eafa548861b558ae4ac65d546a2d96a5664fade83ba3605c45b6bd88cc51@0.0.0.0:0 + INFO 04-01 20:38:59 main rpc JSON-RPC socket path: \\.\pipe\\geth.ipc + JSONRPC Admin Session Key: 2C/gbvE/pxQ= + INFO 04-01 20:38:59 main client Mining Beneficiary: @00fd4aaf… + INFO 04-01 20:40:36 miner2 client Block sealed #1 + INFO 04-01 20:40:36 eth client Tried to seal sealed block... + INFO 04-01 20:40:36 eth client 1 blocks imported in 1 ms (515.198 blocks/s) in #1 + INFO 04-01 20:40:37 miner0 client Block sealed #2 + INFO 04-01 20:40:37 eth client 1 blocks imported in 3 ms (316.056 blocks/s) in #2 + INFO 04-01 20:40:39 miner1 client Block sealed #3 + INFO 04-01 20:40:39 eth client 1 blocks imported in 3 ms (300.842 blocks/s) in #3 + + 4. Start the second node: + + Aleth --config --no-discovery --unsafe-transactions --listen --peerset required: --db-path + + ○ Notes: + § You need to use the same config.json file + § --listen: Be sure to specify a different port + § --peerset: Be sure to update the IP address in the enode URL to 127.0.0.1: + § We've omitted the mining options since this node will purely be a peer node and will not mine new blocks. Feel free to include the mining options if you would like this node to mine as well, though note that this will likely affect system responsiveness + § You'll need to specify a different --db-path than node 1 since 2 nodes can't share the same block database. + + So if we want to connect to node 1 we'd execute the following: + + C:\Users\nilse\Documents\Code\aleth\build\aleth\Debug>aleth --config %CODE%\config.json --no-discovery --unsafe-transactions --listen 30305 --db-path %APPDATA%\EthereumPrivate_01 --peerset required:enode://5def584369536c059df3cd86280200beb51829319e4bd1a8bb19df885babe215db30eafa548861b558ae4ac65d546a2d96a5664fade83ba3605c45b6bd88cc51@127.0.0.1:30303 + + 5. If all goes well the second node will connect to the first node and start syncing blocks: + + 5. The second node will connect to the first node and start syncing blocks: + + C:\Users\nilse\Documents\Code\aleth\build\aleth\Debug>aleth --config %CODE%\config.json --no-discovery --unsafe-transactions --listen 30305 --db-path %APPDATA%\EthereumPrivate_01 --peerset required:enode://5def584369536c059df3cd86280200beb51829319e4bd1a8bb19df885babe215db30eafa548861b558ae4ac65d546a2d96a5664fade83ba3605c45b6bd88cc51@127.0.0.1:30303 + aleth, a C++ Ethereum client + INFO 04-01 20:47:55 main net Id: ##d4a0335d… + aleth 1.6.0-alpha.1-28+commit.32bb833e.dirty + Mining Beneficiary: 84258fde-b0d9-747e-b70f-f55e14831192 - 00fd4aaf9713f5bb664c20a462acc4ebc363d1a6 + INFO 04-01 20:47:59 p2p info UPnP device not found. + WARN 04-01 20:47:59 p2p warn "_enabled" parameter is false, discovery is disabled + Node ID: enode://d4a0335d481fe816a7d580a298870066c3c24af60cd1c2875bd2598befedfbd5a43942f41e04f6e92d1081de72843f15ff5fb9c8f65cb31bdce1357514f02491@0.0.0.0:0 + INFO 04-01 20:47:59 main rpc JSON-RPC socket path: \\.\pipe\\geth.ipc + JSONRPC Admin Session Key: rtsy5ehS1JA= + INFO 04-01 20:47:59 p2p sync 5def5843…|aleth/1.6.0-alpha.1-28+commit.32bb833e.dirty/windows/msvc19.0.24215.1/debug Starting full sync + INFO 04-01 20:48:01 eth client 26 blocks imported in 177 ms (146.424 blocks/s) in #26 + INFO 04-01 20:48:02 eth client 50 blocks imported in 262 ms (190.531 blocks/s) in #76 + INFO 04-01 20:48:02 eth client 56 blocks imported in 300 ms (186.602 blocks/s) in #132 + INFO 04-01 20:48:02 eth client 59 blocks imported in 265 ms (222.067 blocks/s) in #191 + + +Common Problems +* Unrecognized peerset +Unrecognized peerset: required:enode://5def584369536c059df3cd86280200beb51829319e4bd1a8bb19df885babe215db30eafa548861b558ae4ac65d546a2d96a5664fade83ba3605c45b6bd88cc51@0.0.0.0:0 + +You need to update the IP address in the enode URL to 127.0.0.1: where is the port number you supplied to node 1 via --listen + +* Database already open +aleth, a C++ Ethereum client +INFO 04-01 20:50:31 main net Id: ##a7dbe409… +WARN 04-01 20:50:31 main warn Database "C:\Users\nilse\AppData\Roaming\EthereumPrivate_00\ddce0f53\blocks"or "C:\Users\nilse\AppData\Roaming\EthereumPrivate_00\ddce0f53\12041\extras"already open. You appear to have another instance of ethereum running. Bailing. + +Both of your Aleth nodes are using the same database. You need to set one of your nodes' database path to a different location. + +* Node 2 doesn't sync with node 1 +This means that node 2 couldn't successfully peer with node 1, typically because you used a different config file for each node. You can get helpful debugging information by enabling verobse logging on node 1 (-v4) - be sure to also filter the log channels to net and sync (--log-channels net sync) otherwise it will be hard to pick out useful information in the logs. + +For example, here's what node 1 logs when the nodes use different config files: TODO: + + TRACE 04-01 20:57:53 p2p net p2p.connect.ingress receiving auth from 127.0.0.1:61309 + TRACE 04-01 20:57:53 p2p net Listening on local port 30303 + TRACE 04-01 20:57:53 p2p net p2p.connect.ingress sending ack to 127.0.0.1:61309 + TRACE 04-01 20:57:53 p2p net p2p.connect.ingress sending capabilities handshake + TRACE 04-01 20:57:53 p2p net p2p.connect.ingress recvd hello header + TRACE 04-01 20:57:53 p2p net p2p.connect.ingress hello frame: success. starting session. + DEBUG 04-01 20:57:53 p2p net Hello: aleth/1.6.0-alpha.1-28+commit.32bb833e.dirty/windows/msvc19.0.24215.1/debug V[4] ##8b7b78e1… (eth,63) 30305 + DEBUG 04-01 20:57:53 p2p net New session for capability eth; idOffset: 16 + TRACE 04-01 20:57:53 p2p net <- [ 0x3F, 0x42, 0x179D6F06, 0x9A610A1C26FFF584E79421406D77ABF46E9FDE72E11D2F6E8B880D3F5E84EDE8, 0xDDCE0F53ABB8348FDF758C4DABBD9C0A7BBD359CBE6E74AC60A2F12F6B9BAA74 ] + TRACE 04-01 20:57:53 p2p net <- [ ] + DEBUG 04-01 20:57:53 p2p net p2p.host.peer.register ##8b7b78e1… + TRACE 04-01 20:57:53 p2p net 8b7b78e1…|aleth/1.6.0-alpha.1-28+commit.32bb833e.dirty/windows/msvc19.0.24215.1/debug Error reading: An established connection was aborted by the software in your host machine + TRACE 04-01 20:57:53 p2p net 8b7b78e1…|aleth/1.6.0-alpha.1-28+commit.32bb833e.dirty/windows/msvc19.0.24215.1/debug Closing 127.0.0.1:61309 (Low-level TCP communication error.) + DEBUG 04-01 20:57:53 p2p net 8b7b78e1…|aleth/1.6.0-alpha.1-28+commit.32bb833e.dirty/windows/msvc19.0.24215.1/debug Closing peer session :-( + TRACE 04-01 20:57:58 p2p net p2p.connect.ingress receiving auth from 127.0.0.1:61323 + TRACE 04-01 20:57:58 p2p net Listening on local port 30303 + TRACE 04-01 20:57:58 p2p net p2p.connect.ingress sending ack to 127.0.0.1:61323 + TRACE 04-01 20:57:58 p2p net p2p.connect.ingress sending capabilities handshake + TRACE 04-01 20:57:58 p2p net p2p.connect.ingress recvd hello header + TRACE 04-01 20:57:58 p2p net p2p.connect.ingress hello frame: success. starting session. + DEBUG 04-01 20:57:58 p2p net Hello: aleth/1.6.0-alpha.1-28+commit.32bb833e.dirty/windows/msvc19.0.24215.1/debug V[4] ##8b7b78e1… (eth,63) 30305 + DEBUG 04-01 20:57:58 p2p net New session for capability eth; idOffset: 16 + TRACE 04-01 20:57:58 p2p net <- [ 0x3F, 0x42, 0x179D6F06, 0x9A610A1C26FFF584E79421406D77ABF46E9FDE72E11D2F6E8B880D3F5E84EDE8, 0xDDCE0F53ABB8348FDF758C4DABBD9C0A7BBD359CBE6E74AC60A2F12F6B9BAA74 ] + TRACE 04-01 20:57:58 p2p net <- [ ] + DEBUG 04-01 20:57:58 p2p net p2p.host.peer.register ##8b7b78e1… + TRACE 04-01 20:57:58 p2p net 8b7b78e1…|aleth/1.6.0-alpha.1-28+commit.32bb833e.dirty/windows/msvc19.0.24215.1/debug -> 16 [ 0x3F, 0x42, 0x100000, 0xD8600904A41043A4E81D23863F178E7DC8B3C2CBAFA94EB4BBF5DC46BCCCE176, 0xD8600904A41043A4E81D23863F178E7DC8B3C2CBAFA94EB4BBF5DC46BCCCE176 ] + DEBUG 04-01 20:57:58 p2p sync 8b7b78e1…|aleth/1.6.0-alpha.1-28+commit.32bb833e.dirty/windows/msvc19.0.24215.1/debug Peer not suitable for sync: Invalid genesis hash. + TRACE 04-01 20:57:58 p2p net 8b7b78e1…|aleth/1.6.0-alpha.1-28+commit.32bb833e.dirty/windows/msvc19.0.24215.1/debug Disconnecting (our reason: Subprotocol reason.) + TRACE 04-01 20:57:58 p2p net 8b7b78e1…|aleth/1.6.0-alpha.1-28+commit.32bb833e.dirty/windows/msvc19.0.24215.1/debug <- [ 0x10 ] + TRACE 04-01 20:57:58 p2p net 8b7b78e1…|aleth/1.6.0-alpha.1-28+commit.32bb833e.dirty/windows/msvc19.0.24215.1/debug Closing 127.0.0.1:61323 (Subprotocol reason.) + DEBUG 04-01 20:57:58 p2p net 8b7b78e1…|aleth/1.6.0-alpha.1-28+commit.32bb833e.dirty/windows/msvc19.0.24215.1/debug Closing peer session :-( + +* Error: Couldn't start accepting connections on host. Failed to accept socket on + +This means that you're running both nodes on the same listen port. Be sure to specify different ports via --listen. + +Full error text: + + aleth, a C++ Ethereum client + INFO 04-01 21:01:18 main net Id: ##ac459be1… + aleth 1.6.0-alpha.1-28+commit.32bb833e.dirty + Mining Beneficiary: 84258fde-b0d9-747e-b70f-f55e14831192 - 00fd4aaf9713f5bb664c20a462acc4ebc363d1a6 + WARN 04-01 21:01:20 p2p warn Couldn't start accepting connections on host. Failed to accept socket on 0.0.0.0:30303. + Throw location unknown (consider using BOOST_THROW_EXCEPTION) + Dynamic exception type: class boost::exception_detail::clone_impl > + std::exception::what: bind: Only one usage of each socket address (protocol/network address/port) is normally permitted + + INFO 04-01 21:01:20 p2p info UPnP device not found. + WARN 04-01 21:01:20 p2p warn "_enabled" parameter is false, discovery is disabled From 0d1ea3772f7dffc38778ab2266a6c410859bb3c3 Mon Sep 17 00:00:00 2001 From: Nils-Erik Frantzell Date: Tue, 2 Apr 2019 20:15:27 -0700 Subject: [PATCH 03/12] Lots of revisions. Still need to add proper formatting --- doc/private_net_sync.rst | 232 +++++++++++++++++++++++---------------- 1 file changed, 135 insertions(+), 97 deletions(-) diff --git a/doc/private_net_sync.rst b/doc/private_net_sync.rst index 6dae4e0bc48..a5662839bb1 100644 --- a/doc/private_net_sync.rst +++ b/doc/private_net_sync.rst @@ -4,49 +4,92 @@ These instructions cover creating an Ethereum private network consisting of 2 no Before we start =============== +TODO? What is a private network? ========================= -TODO +"Private network" is a little bit of an ambiguous term since there's no official definition. It's often used to refer to a network of computers which have restricted access. For the purposes of this documentation, the term "private network" can be thought of as a network of Ethereum nodes only accessible on your physical machine. What is a private chain? ======================== -TODO: +An Ethereum chain can be thought of as a set of rules used to govern interaction with an Ethereum blockchain. For the purposes of this documentation, a private chain is one whose configuration is only known on your local machine. -Other notes +Mining =========== -* Mining will be done using a CPU miner (Aleth doesn't include a GPU miner for various reasons, the main one being the extremely high cost of end-user support - e.g. drivers, TODO: Look @ Pawel's notes in email) -* Only 1 node will be mining because both nodes are running on the same physical system, so having multiple CPU miners will significantly impact system responsiveness - TODO: will running 2 miners be worse than 1 miner since mining is configured by default to use as many threads as possible? - * TODO: If you'd like to have both nodes mine (or system responsiveness is impacted by 1 miner), you can reduce the number of threads used by each CPU miner via the -t flag. - * TODO: CPU miner is configured by default to use as many threads as possible - TODO: Does it just use 1 thread per CPU core? It presumably doesn't just create UINT_MAX threads? -* You typically run a private network using a specialized chain configuration (though this isn't strictly required) in the form of a json file. TODO: more information? -* Since the json file is used to create the private chain's genesis state, both clients must use the same chain configuration file otherwise they won't be able to connect with each other. TODO:? +* Mining will be done using the Aleth CPU miner (Aleth doesn't include a GPU miner because of high support costs - TODO: verify with Pawel's mail) +* Only 1 node will be mining to keep the system responsive - since both nodes are running on the same physical system, having both nodes mine will significantly slow system responsiveness. + * You can tune the number of mining threads if you feel mining is slowing down your system too much or if you want to run more than 1 mining node. The Aleth CPU miner is configured by default to use as many threads as possible (TODO: How many?)- see the -t flag + +Chain configuration +=================== +* You typically run a private network using a chain configuration json file - this isn't strictly required, but it makes testing a lot easier since you can do things like lower the difficulty rate and pre-fund addresses with Ether. + * The chain configuration json file format is defined here: TODO + * Here's an example file: TODO: +* Since the chain configuration is used to create the chain's genesis state, both clients must use the same chain configuration file otherwise they won't be able to peer with each other. An example of this error is shown in the TODO section. Instructions ============ +Note: The examples in this section were generated on Windows 10 running aleth 1.6.0-alpha.1-31+commit.ad7204c9 + 1. Create a key pair for each node -Execute the following command: +Execute the following command and enter the desired password when prompted aleth.exe account new Enter the desired password when prompted -2. Add each address (these are the public keys generated in the previous step) that you wish to send transactions with into the "accounts" section of your chain configuration json file (we'll just call this config.json) along with the desired balance (in TODO:?). For example: -TODO: - -3. Start the first node by executing the following command (each of the options are explained below): - - Aleth -m on --config -a --no-discovery --unsafe-transactions --listen --db-path + C:\Users\nilse\Documents\Code\aleth_ref\build\aleth\Debug>aleth account new + [2019-04-02 19:59:42.515684] [0x000041f0] [info] ReadingC:\Users\nilse\AppData\Roaming\Web3\keys\4f04a5ed-87e4-1e4d-4367-604db42bdcff.json + [2019-04-02 19:59:42.520265] [0x000041f0] [info] ReadingC:\Users\nilse\AppData\Roaming\Web3\keys\84258fde-b0d9-747e-b70f-f55e14831192.json + [2019-04-02 19:59:42.520265] [0x000041f0] [info] ReadingC:\Users\nilse\AppData\Roaming\Web3\keys\9067d973-1c8d-fa86-a312-14c90188f610.json + Enter a passphrase with which to secure this account:Please confirm the passphrase by entering it again: Created key 623b80dd-d008-4cd4-dd06-c36f0f64296c + Address: 007e13502a8b226b0f19e7412db75352dc1d0760 + + C:\Users\nilse\Documents\Code\aleth_ref\build\aleth\Debug>aleth account new + [2019-04-02 19:59:53.847216] [0x000011b4] [info] ReadingC:\Users\nilse\AppData\Roaming\Web3\keys\4f04a5ed-87e4-1e4d-4367-604db42bdcff.json + [2019-04-02 19:59:53.849343] [0x000011b4] [info] ReadingC:\Users\nilse\AppData\Roaming\Web3\keys\623b80dd-d008-4cd4-dd06-c36f0f64296c.json + [2019-04-02 19:59:53.850400] [0x000011b4] [info] ReadingC:\Users\nilse\AppData\Roaming\Web3\keys\84258fde-b0d9-747e-b70f-f55e14831192.json + [2019-04-02 19:59:53.850400] [0x000011b4] [info] ReadingC:\Users\nilse\AppData\Roaming\Web3\keys\9067d973-1c8d-fa86-a312-14c90188f610.json + Enter a passphrase with which to secure this account:Please confirm the passphrase by entering it again: Created key ab921356-8c9e-54ff-e3e7-da5c2f7aa685 + Address: 002c73acd4bc217998966964d27f0ee79a47befb + +2. Add each address (these are the public keys generated in the previous step) into the "accounts" section of your chain configuration json file (we'll refer to this as config.json from now on) along with the desired balance in wei. + + For example, the following initializes each account created in step 1 with 2 ether: + + "accounts": { + "0000000000000000000000000000000000000001": { "precompiled": { "name": "ecrecover", "linear": { "base": 3000, "word": 0 } }, "balance": "0x01" }, + "0000000000000000000000000000000000000002": { "precompiled": { "name": "sha256", "linear": { "base": 60, "word": 12 } }, "balance": "0x01" }, + "0000000000000000000000000000000000000003": { "precompiled": { "name": "ripemd160", "linear": { "base": 600, "word": 120 } }, "balance": "0x01" }, + "0000000000000000000000000000000000000004": { "precompiled": { "name": "identity", "linear": { "base": 15, "word": 3 } }, "balance": "0x01" }, + "0000000000000000000000000000000000000005": { "precompiled": { "name": "modexp" }, "balance": "0x01" }, + "0000000000000000000000000000000000000006": { "precompiled": { "name": "alt_bn128_G1_add", "linear": { "base": 500, "word": 0 } }, "balance": "0x01" }, + "0000000000000000000000000000000000000007": { "precompiled": { "name": "alt_bn128_G1_mul", "linear": { "base": 40000, "word": 0 } }, "balance": "0x01" }, + "0000000000000000000000000000000000000008": { "precompiled": { "name": "alt_bn128_pairing_product" }, "balance": "0x01" }, + "007e13502a8b226b0f19e7412db75352dc1d0760": { + "balance" : "0x2000000000000000000" + }, + "002c73acd4bc217998966964d27f0ee79a47befb": { + "balance" : "0x2000000000000000000" + } + } + +3. Start the first node (each of the command-line options are explained below): + + Aleth -m on --config -a --no-discovery --unsafe-transactions --listen ○ -m on: Enables CPU mining -○ --config: Path to chain configuration file +○ --config: Path to chain configuration json file ○ -a: Sets recipient of mining block reward ○ --no-discovery: Disables the devp2p discovery protocol (it's unnecessary in a 2-node configuration, we'll be adding a peer manually) -○ --unsafe-transactions: Don't prompt before sending each transaction (unnecessary in a testing environment) -* --listen: TCP port to listen for incoming peer connections. Required so that Aleth will start its devp2p protocol implementation - TODO? -* --db-path: Path to save blocks to. You don't technically need to supply this, but if you've run other syncing nodes on your machine you'll want to make sure you save the private network blocks to a different location (otherwise you can run into TODO) +○ --unsafe-transactions: Don't require approval before sending each transaction (unnecessary for testing purposes) +* --listen: TCP port to listen for incoming peer connections + + Example: -Make note of the node's enode URL since you'll need to reference it when launching the second node. The enode URL should be logged within the first few lines. For example: + aleth -m on --config %CODE%\config.json -a 00fd4aaf9713f5bb664c20a462acc4ebc363d1a6 --no-discovery --unsafe-transactions --listen 30303 + +Make note of the node's enode URL since you'll need to reference it when launching the second node. The enode URL should be logged within the first few lines of log output. For example: aleth, a C++ Ethereum client INFO 04-01 20:34:38 main net Id: ##fb867844… @@ -61,45 +104,34 @@ Make note of the node's enode URL since you'll need to reference it when launchi If everything goes smoothly you should see the node start mining (empty) blocks after a minute or two: - C:\Users\nilse\Documents\Code\aleth\build\aleth\Debug>aleth -m on --config %CODE%\config.json -a 00fd4aaf9713f5bb664c20a462acc4ebc363d1a6 --no-discovery --unsafe-transactions --listen 30303 --db-path %APPDATA%\EthereumPrivate_00 - aleth, a C++ Ethereum client - INFO 04-01 20:38:58 main net Id: ##5def5843… - aleth 1.6.0-alpha.1-28+commit.32bb833e.dirty - Mining Beneficiary: 84258fde-b0d9-747e-b70f-f55e14831192 - 00fd4aaf9713f5bb664c20a462acc4ebc363d1a6 - INFO 04-01 20:38:59 p2p info UPnP device not found. - WARN 04-01 20:38:59 p2p warn "_enabled" parameter is false, discovery is disabled - Node ID: enode://5def584369536c059df3cd86280200beb51829319e4bd1a8bb19df885babe215db30eafa548861b558ae4ac65d546a2d96a5664fade83ba3605c45b6bd88cc51@0.0.0.0:0 - INFO 04-01 20:38:59 main rpc JSON-RPC socket path: \\.\pipe\\geth.ipc - JSONRPC Admin Session Key: 2C/gbvE/pxQ= - INFO 04-01 20:38:59 main client Mining Beneficiary: @00fd4aaf… - INFO 04-01 20:40:36 miner2 client Block sealed #1 - INFO 04-01 20:40:36 eth client Tried to seal sealed block... - INFO 04-01 20:40:36 eth client 1 blocks imported in 1 ms (515.198 blocks/s) in #1 - INFO 04-01 20:40:37 miner0 client Block sealed #2 - INFO 04-01 20:40:37 eth client 1 blocks imported in 3 ms (316.056 blocks/s) in #2 - INFO 04-01 20:40:39 miner1 client Block sealed #3 - INFO 04-01 20:40:39 eth client 1 blocks imported in 3 ms (300.842 blocks/s) in #3 + INFO 04-01 20:38:59 main rpc JSON-RPC socket path: \\.\pipe\\geth.ipc + JSONRPC Admin Session Key: 2C/gbvE/pxQ= + INFO 04-01 20:38:59 main client Mining Beneficiary: @00fd4aaf… + INFO 04-01 20:40:36 miner2 client Block sealed #1 + INFO 04-01 20:40:36 eth client Tried to seal sealed block... + INFO 04-01 20:40:36 eth client 1 blocks imported in 1 ms (515.198 blocks/s) in #1 + INFO 04-01 20:40:37 miner0 client Block sealed #2 + INFO 04-01 20:40:37 eth client 1 blocks imported in 3 ms (316.056 blocks/s) in #2 + INFO 04-01 20:40:39 miner1 client Block sealed #3 + INFO 04-01 20:40:39 eth client 1 blocks imported in 3 ms (300.842 blocks/s) in #3 4. Start the second node: - Aleth --config --no-discovery --unsafe-transactions --listen --peerset required: --db-path + Aleth --config --no-discovery --unsafe-transactions --listen --peerset required: --db-path - ○ Notes: - § You need to use the same config.json file - § --listen: Be sure to specify a different port - § --peerset: Be sure to update the IP address in the enode URL to 127.0.0.1: - § We've omitted the mining options since this node will purely be a peer node and will not mine new blocks. Feel free to include the mining options if you would like this node to mine as well, though note that this will likely affect system responsiveness - § You'll need to specify a different --db-path than node 1 since 2 nodes can't share the same block database. + Notes: + * --config: You need to specify the same chain config file + § --listen: You need to specify a different port + § --peerset: Be sure to update the IP address in the enode URL to 127.0.0.1: + * This node won't mine so there's no mining options. + * --db-path: Path to save sync'd blocks. Aleth saves blocks by default to %APPDATA%\Ethereum on Windows and TODO on Linux. You need to specify a different path for your second node otherwise you'll run into database concurrency issues. An example of this error is in the TODO section. - So if we want to connect to node 1 we'd execute the following: + For example: - C:\Users\nilse\Documents\Code\aleth\build\aleth\Debug>aleth --config %CODE%\config.json --no-discovery --unsafe-transactions --listen 30305 --db-path %APPDATA%\EthereumPrivate_01 --peerset required:enode://5def584369536c059df3cd86280200beb51829319e4bd1a8bb19df885babe215db30eafa548861b558ae4ac65d546a2d96a5664fade83ba3605c45b6bd88cc51@127.0.0.1:30303 + aleth --config %CODE%\config.json --no-discovery --unsafe-transactions --listen 30305 --db-path %APPDATA%\EthereumPrivate_01 --peerset required:enode://5def584369536c059df3cd86280200beb51829319e4bd1a8bb19df885babe215db30eafa548861b558ae4ac65d546a2d96a5664fade83ba3605c45b6bd88cc51@127.0.0.1:30303 5. If all goes well the second node will connect to the first node and start syncing blocks: - - 5. The second node will connect to the first node and start syncing blocks: - C:\Users\nilse\Documents\Code\aleth\build\aleth\Debug>aleth --config %CODE%\config.json --no-discovery --unsafe-transactions --listen 30305 --db-path %APPDATA%\EthereumPrivate_01 --peerset required:enode://5def584369536c059df3cd86280200beb51829319e4bd1a8bb19df885babe215db30eafa548861b558ae4ac65d546a2d96a5664fade83ba3605c45b6bd88cc51@127.0.0.1:30303 aleth, a C++ Ethereum client INFO 04-01 20:47:55 main net Id: ##d4a0335d… aleth 1.6.0-alpha.1-28+commit.32bb833e.dirty @@ -117,61 +149,64 @@ If everything goes smoothly you should see the node start mining (empty) blocks Common Problems -* Unrecognized peerset +=============== +"Unrecognized peerset" error +Example: Unrecognized peerset: required:enode://5def584369536c059df3cd86280200beb51829319e4bd1a8bb19df885babe215db30eafa548861b558ae4ac65d546a2d96a5664fade83ba3605c45b6bd88cc51@0.0.0.0:0 You need to update the IP address in the enode URL to 127.0.0.1: where is the port number you supplied to node 1 via --listen -* Database already open +"Database already open" error +Example: aleth, a C++ Ethereum client INFO 04-01 20:50:31 main net Id: ##a7dbe409… WARN 04-01 20:50:31 main warn Database "C:\Users\nilse\AppData\Roaming\EthereumPrivate_00\ddce0f53\blocks"or "C:\Users\nilse\AppData\Roaming\EthereumPrivate_00\ddce0f53\12041\extras"already open. You appear to have another instance of ethereum running. Bailing. -Both of your Aleth nodes are using the same database. You need to set one of your nodes' database path to a different location. - -* Node 2 doesn't sync with node 1 -This means that node 2 couldn't successfully peer with node 1, typically because you used a different config file for each node. You can get helpful debugging information by enabling verobse logging on node 1 (-v4) - be sure to also filter the log channels to net and sync (--log-channels net sync) otherwise it will be hard to pick out useful information in the logs. - -For example, here's what node 1 logs when the nodes use different config files: TODO: - - TRACE 04-01 20:57:53 p2p net p2p.connect.ingress receiving auth from 127.0.0.1:61309 - TRACE 04-01 20:57:53 p2p net Listening on local port 30303 - TRACE 04-01 20:57:53 p2p net p2p.connect.ingress sending ack to 127.0.0.1:61309 - TRACE 04-01 20:57:53 p2p net p2p.connect.ingress sending capabilities handshake - TRACE 04-01 20:57:53 p2p net p2p.connect.ingress recvd hello header - TRACE 04-01 20:57:53 p2p net p2p.connect.ingress hello frame: success. starting session. - DEBUG 04-01 20:57:53 p2p net Hello: aleth/1.6.0-alpha.1-28+commit.32bb833e.dirty/windows/msvc19.0.24215.1/debug V[4] ##8b7b78e1… (eth,63) 30305 - DEBUG 04-01 20:57:53 p2p net New session for capability eth; idOffset: 16 - TRACE 04-01 20:57:53 p2p net <- [ 0x3F, 0x42, 0x179D6F06, 0x9A610A1C26FFF584E79421406D77ABF46E9FDE72E11D2F6E8B880D3F5E84EDE8, 0xDDCE0F53ABB8348FDF758C4DABBD9C0A7BBD359CBE6E74AC60A2F12F6B9BAA74 ] - TRACE 04-01 20:57:53 p2p net <- [ ] - DEBUG 04-01 20:57:53 p2p net p2p.host.peer.register ##8b7b78e1… - TRACE 04-01 20:57:53 p2p net 8b7b78e1…|aleth/1.6.0-alpha.1-28+commit.32bb833e.dirty/windows/msvc19.0.24215.1/debug Error reading: An established connection was aborted by the software in your host machine - TRACE 04-01 20:57:53 p2p net 8b7b78e1…|aleth/1.6.0-alpha.1-28+commit.32bb833e.dirty/windows/msvc19.0.24215.1/debug Closing 127.0.0.1:61309 (Low-level TCP communication error.) - DEBUG 04-01 20:57:53 p2p net 8b7b78e1…|aleth/1.6.0-alpha.1-28+commit.32bb833e.dirty/windows/msvc19.0.24215.1/debug Closing peer session :-( - TRACE 04-01 20:57:58 p2p net p2p.connect.ingress receiving auth from 127.0.0.1:61323 - TRACE 04-01 20:57:58 p2p net Listening on local port 30303 - TRACE 04-01 20:57:58 p2p net p2p.connect.ingress sending ack to 127.0.0.1:61323 - TRACE 04-01 20:57:58 p2p net p2p.connect.ingress sending capabilities handshake - TRACE 04-01 20:57:58 p2p net p2p.connect.ingress recvd hello header - TRACE 04-01 20:57:58 p2p net p2p.connect.ingress hello frame: success. starting session. - DEBUG 04-01 20:57:58 p2p net Hello: aleth/1.6.0-alpha.1-28+commit.32bb833e.dirty/windows/msvc19.0.24215.1/debug V[4] ##8b7b78e1… (eth,63) 30305 - DEBUG 04-01 20:57:58 p2p net New session for capability eth; idOffset: 16 - TRACE 04-01 20:57:58 p2p net <- [ 0x3F, 0x42, 0x179D6F06, 0x9A610A1C26FFF584E79421406D77ABF46E9FDE72E11D2F6E8B880D3F5E84EDE8, 0xDDCE0F53ABB8348FDF758C4DABBD9C0A7BBD359CBE6E74AC60A2F12F6B9BAA74 ] - TRACE 04-01 20:57:58 p2p net <- [ ] - DEBUG 04-01 20:57:58 p2p net p2p.host.peer.register ##8b7b78e1… - TRACE 04-01 20:57:58 p2p net 8b7b78e1…|aleth/1.6.0-alpha.1-28+commit.32bb833e.dirty/windows/msvc19.0.24215.1/debug -> 16 [ 0x3F, 0x42, 0x100000, 0xD8600904A41043A4E81D23863F178E7DC8B3C2CBAFA94EB4BBF5DC46BCCCE176, 0xD8600904A41043A4E81D23863F178E7DC8B3C2CBAFA94EB4BBF5DC46BCCCE176 ] - DEBUG 04-01 20:57:58 p2p sync 8b7b78e1…|aleth/1.6.0-alpha.1-28+commit.32bb833e.dirty/windows/msvc19.0.24215.1/debug Peer not suitable for sync: Invalid genesis hash. - TRACE 04-01 20:57:58 p2p net 8b7b78e1…|aleth/1.6.0-alpha.1-28+commit.32bb833e.dirty/windows/msvc19.0.24215.1/debug Disconnecting (our reason: Subprotocol reason.) - TRACE 04-01 20:57:58 p2p net 8b7b78e1…|aleth/1.6.0-alpha.1-28+commit.32bb833e.dirty/windows/msvc19.0.24215.1/debug <- [ 0x10 ] - TRACE 04-01 20:57:58 p2p net 8b7b78e1…|aleth/1.6.0-alpha.1-28+commit.32bb833e.dirty/windows/msvc19.0.24215.1/debug Closing 127.0.0.1:61323 (Subprotocol reason.) - DEBUG 04-01 20:57:58 p2p net 8b7b78e1…|aleth/1.6.0-alpha.1-28+commit.32bb833e.dirty/windows/msvc19.0.24215.1/debug Closing peer session :-( - -* Error: Couldn't start accepting connections on host. Failed to accept socket on - -This means that you're running both nodes on the same listen port. Be sure to specify different ports via --listen. - -Full error text: +Both of your Aleth nodes are trying to use the same database location. You need to set one of your nodes' database path (--db-path) to a different location. +Node 2 doesn't sync with node 1 +Example: +TODO: + +This means that node 2 couldn't successfully peer with node 1. This typically happens because you used a different chain config file for each node. You can enable verbose logging on node 1 (-v4 --log-channels net sync) to get helpful logs for debugging. + +For example, here are the node 1 logs when node 1 and node 2 use different chain configuration files: + + TRACE 04-01 20:57:53 p2p net p2p.connect.ingress receiving auth from 127.0.0.1:61309 + TRACE 04-01 20:57:53 p2p net Listening on local port 30303 + TRACE 04-01 20:57:53 p2p net p2p.connect.ingress sending ack to 127.0.0.1:61309 + TRACE 04-01 20:57:53 p2p net p2p.connect.ingress sending capabilities handshake + TRACE 04-01 20:57:53 p2p net p2p.connect.ingress recvd hello header + TRACE 04-01 20:57:53 p2p net p2p.connect.ingress hello frame: success. starting session. + DEBUG 04-01 20:57:53 p2p net Hello: aleth/1.6.0-alpha.1-28+commit.32bb833e.dirty/windows/msvc19.0.24215.1/debug V[4] ##8b7b78e1… (eth,63) 30305 + DEBUG 04-01 20:57:53 p2p net New session for capability eth; idOffset: 16 + TRACE 04-01 20:57:53 p2p net <- [ 0x3F, 0x42, 0x179D6F06, 0x9A610A1C26FFF584E79421406D77ABF46E9FDE72E11D2F6E8B880D3F5E84EDE8, 0xDDCE0F53ABB8348FDF758C4DABBD9C0A7BBD359CBE6E74AC60A2F12F6B9BAA74 ] + TRACE 04-01 20:57:53 p2p net <- [ ] + DEBUG 04-01 20:57:53 p2p net p2p.host.peer.register ##8b7b78e1… + TRACE 04-01 20:57:53 p2p net 8b7b78e1…|aleth/1.6.0-alpha.1-28+commit.32bb833e.dirty/windows/msvc19.0.24215.1/debug Error reading: An established connection was aborted by the software in your host machine + TRACE 04-01 20:57:53 p2p net 8b7b78e1…|aleth/1.6.0-alpha.1-28+commit.32bb833e.dirty/windows/msvc19.0.24215.1/debug Closing 127.0.0.1:61309 (Low-level TCP communication error.) + DEBUG 04-01 20:57:53 p2p net 8b7b78e1…|aleth/1.6.0-alpha.1-28+commit.32bb833e.dirty/windows/msvc19.0.24215.1/debug Closing peer session :-( + TRACE 04-01 20:57:58 p2p net p2p.connect.ingress receiving auth from 127.0.0.1:61323 + TRACE 04-01 20:57:58 p2p net Listening on local port 30303 + TRACE 04-01 20:57:58 p2p net p2p.connect.ingress sending ack to 127.0.0.1:61323 + TRACE 04-01 20:57:58 p2p net p2p.connect.ingress sending capabilities handshake + TRACE 04-01 20:57:58 p2p net p2p.connect.ingress recvd hello header + TRACE 04-01 20:57:58 p2p net p2p.connect.ingress hello frame: success. starting session. + DEBUG 04-01 20:57:58 p2p net Hello: aleth/1.6.0-alpha.1-28+commit.32bb833e.dirty/windows/msvc19.0.24215.1/debug V[4] ##8b7b78e1… (eth,63) 30305 + DEBUG 04-01 20:57:58 p2p net New session for capability eth; idOffset: 16 + TRACE 04-01 20:57:58 p2p net <- [ 0x3F, 0x42, 0x179D6F06, 0x9A610A1C26FFF584E79421406D77ABF46E9FDE72E11D2F6E8B880D3F5E84EDE8, 0xDDCE0F53ABB8348FDF758C4DABBD9C0A7BBD359CBE6E74AC60A2F12F6B9BAA74 ] + TRACE 04-01 20:57:58 p2p net <- [ ] + DEBUG 04-01 20:57:58 p2p net p2p.host.peer.register ##8b7b78e1… + TRACE 04-01 20:57:58 p2p net 8b7b78e1…|aleth/1.6.0-alpha.1-28+commit.32bb833e.dirty/windows/msvc19.0.24215.1/debug -> 16 [ 0x3F, 0x42, 0x100000, 0xD8600904A41043A4E81D23863F178E7DC8B3C2CBAFA94EB4BBF5DC46BCCCE176, 0xD8600904A41043A4E81D23863F178E7DC8B3C2CBAFA94EB4BBF5DC46BCCCE176 ] + DEBUG 04-01 20:57:58 p2p sync 8b7b78e1…|aleth/1.6.0-alpha.1-28+commit.32bb833e.dirty/windows/msvc19.0.24215.1/debug Peer not suitable for sync: Invalid genesis hash. + TRACE 04-01 20:57:58 p2p net 8b7b78e1…|aleth/1.6.0-alpha.1-28+commit.32bb833e.dirty/windows/msvc19.0.24215.1/debug Disconnecting (our reason: Subprotocol reason.) + TRACE 04-01 20:57:58 p2p net 8b7b78e1…|aleth/1.6.0-alpha.1-28+commit.32bb833e.dirty/windows/msvc19.0.24215.1/debug <- [ 0x10 ] + TRACE 04-01 20:57:58 p2p net 8b7b78e1…|aleth/1.6.0-alpha.1-28+commit.32bb833e.dirty/windows/msvc19.0.24215.1/debug Closing 127.0.0.1:61323 (Subprotocol reason.) + DEBUG 04-01 20:57:58 p2p net 8b7b78e1…|aleth/1.6.0-alpha.1-28+commit.32bb833e.dirty/windows/msvc19.0.24215.1/debug Closing peer session :-( + + +"Couldn't start accepting connections on host. Failed to accept socket on " error +Example: aleth, a C++ Ethereum client INFO 04-01 21:01:18 main net Id: ##ac459be1… aleth 1.6.0-alpha.1-28+commit.32bb833e.dirty @@ -183,3 +218,6 @@ Full error text: INFO 04-01 21:01:20 p2p info UPnP device not found. WARN 04-01 21:01:20 p2p warn "_enabled" parameter is false, discovery is disabled + +This means that you're running both nodes on the same listen port. Be sure to specify different ports via --listen. + From 515cf26cddc52b6c222c0ca8c38ee10127b53383 Mon Sep 17 00:00:00 2001 From: Nils-Erik Frantzell Date: Tue, 2 Apr 2019 20:40:29 -0700 Subject: [PATCH 04/12] More edits --- doc/private_net_sync.rst | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/doc/private_net_sync.rst b/doc/private_net_sync.rst index a5662839bb1..e984321c09c 100644 --- a/doc/private_net_sync.rst +++ b/doc/private_net_sync.rst @@ -1,31 +1,29 @@ Creating a private network with 2 syncing nodes =============================================== -These instructions cover creating an Ethereum private network consisting of 2 nodes - 1 node will mine blocks and the other node will connect to the first node and sync the mined blocks to its own block database. +These instructions cover creating an Ethereum private network consisting of 2 nodes - 1 node will mine blocks and the other node will connect to the first node and sync the mined blocks to its own block database. Both nodes will use (the same) private chain configuration. Before we start =============== -TODO? - What is a private network? ========================= -"Private network" is a little bit of an ambiguous term since there's no official definition. It's often used to refer to a network of computers which have restricted access. For the purposes of this documentation, the term "private network" can be thought of as a network of Ethereum nodes only accessible on your physical machine. +For the purposes of this documentation, a "private network" can be thought of as a network of Ethereum nodes only accessible on your physical machine. What is a private chain? ======================== -An Ethereum chain can be thought of as a set of rules used to govern interaction with an Ethereum blockchain. For the purposes of this documentation, a private chain is one whose configuration is only known on your local machine. +An Ethereum chain is some state (e.g. accounts and balances and/or contract code) and a set of rules a set of rules for interacting with that state. For the purposes of this documentation, a private chain is an Ethereum chain is one whose configuration is only available on your physical machine. Mining =========== -* Mining will be done using the Aleth CPU miner (Aleth doesn't include a GPU miner because of high support costs - TODO: verify with Pawel's mail) -* Only 1 node will be mining to keep the system responsive - since both nodes are running on the same physical system, having both nodes mine will significantly slow system responsiveness. - * You can tune the number of mining threads if you feel mining is slowing down your system too much or if you want to run more than 1 mining node. The Aleth CPU miner is configured by default to use as many threads as possible (TODO: How many?)- see the -t flag +* Mining will be done using the Aleth CPU miner (Aleth doesn't include a GPU miner because of the high support costs) +* Only 1 node will be mining to keep your machine responsive (since both nodes are running on the same physical system, having both mine will slow your system down significantly). +* If you find your system being sluggish or if you'd like to have both nodes mine, you can tune the number of mining threads via the -t flag Chain configuration =================== -* You typically run a private network using a chain configuration json file - this isn't strictly required, but it makes testing a lot easier since you can do things like lower the difficulty rate and pre-fund addresses with Ether. +* You typically run a private chain using a chain configuration json file - this isn't strictly required, but it makes testing a lot easier since you can do things like lower the difficulty rate and pre-fund addresses with Ether. * The chain configuration json file format is defined here: TODO - * Here's an example file: TODO: -* Since the chain configuration is used to create the chain's genesis state, both clients must use the same chain configuration file otherwise they won't be able to peer with each other. An example of this error is shown in the TODO section. + * Here's an example file: +* Since the configuration file is used to create the chain's genesis state, both nodes must use the same configuration file otherwise they will have different genesis states and consequently won't be able to peer with each other. An example of this is shown in the "Common Problems" section (TODO) Instructions ============ From d6722883c196b7ff5419742f042e329cbf5d2c28 Mon Sep 17 00:00:00 2001 From: Nils-Erik Frantzell Date: Wed, 3 Apr 2019 21:24:55 -0700 Subject: [PATCH 05/12] First round of formatting changes --- doc/private_net_sync.rst | 192 ++++++++++++++++++++++++--------------- 1 file changed, 119 insertions(+), 73 deletions(-) diff --git a/doc/private_net_sync.rst b/doc/private_net_sync.rst index e984321c09c..b56ef9de21f 100644 --- a/doc/private_net_sync.rst +++ b/doc/private_net_sync.rst @@ -2,48 +2,53 @@ Creating a private network with 2 syncing nodes =============================================== These instructions cover creating an Ethereum private network consisting of 2 nodes - 1 node will mine blocks and the other node will connect to the first node and sync the mined blocks to its own block database. Both nodes will use (the same) private chain configuration. -Before we start -=============== + What is a private network? -========================= +-------------------------- For the purposes of this documentation, a "private network" can be thought of as a network of Ethereum nodes only accessible on your physical machine. What is a private chain? -======================== +------------------------- An Ethereum chain is some state (e.g. accounts and balances and/or contract code) and a set of rules a set of rules for interacting with that state. For the purposes of this documentation, a private chain is an Ethereum chain is one whose configuration is only available on your physical machine. Mining -=========== -* Mining will be done using the Aleth CPU miner (Aleth doesn't include a GPU miner because of the high support costs) -* Only 1 node will be mining to keep your machine responsive (since both nodes are running on the same physical system, having both mine will slow your system down significantly). -* If you find your system being sluggish or if you'd like to have both nodes mine, you can tune the number of mining threads via the -t flag +------ +- Mining will be done using the Aleth CPU miner (Aleth doesn't include a GPU miner because of the high support costs). +- Only 1 node will be mining to keep your machine responsive (since both nodes are running on the same physical system, having both mine will slow your system down significantly). +- If you find your system being sluggish or if you'd like to have both nodes mine, you can tune the number of mining threads via the ``-t `` flag Chain configuration -=================== -* You typically run a private chain using a chain configuration json file - this isn't strictly required, but it makes testing a lot easier since you can do things like lower the difficulty rate and pre-fund addresses with Ether. - * The chain configuration json file format is defined here: TODO - * Here's an example file: -* Since the configuration file is used to create the chain's genesis state, both nodes must use the same configuration file otherwise they will have different genesis states and consequently won't be able to peer with each other. An example of this is shown in the "Common Problems" section (TODO) +------------------- +- You typically run a private chain using a chain configuration json file - this isn't strictly required, but it makes testing a lot easier since you can do things like lower the difficulty rate and pre-fund addresses with Ether. +- The chain configuration json file format is defined here: https://github.com/ethereum/wiki/wiki/Ethereum-Chain-Spec-Format +- Here's an example file: TODO +- Since the configuration file is used to create the chain's genesis state, both nodes must use the same configuration file otherwise they will have different genesis states and consequently won't be able to peer with each other. An example of this is shown in the "Common Problems" section (TODO) Instructions ============ -Note: The examples in this section were generated on Windows 10 running aleth 1.6.0-alpha.1-31+commit.ad7204c9 +*The examples in this section were generated on Windows 10 running aleth 1.6.0-alpha.1-31+commit.ad7204c9* + +1. Create a key pair for each node: -1. Create a key pair for each node -Execute the following command and enter the desired password when prompted +:: + + aleth.exe account new -aleth.exe account new Enter the desired password when prompted - C:\Users\nilse\Documents\Code\aleth_ref\build\aleth\Debug>aleth account new + +**Example:** +:: + + aleth account new [2019-04-02 19:59:42.515684] [0x000041f0] [info] ReadingC:\Users\nilse\AppData\Roaming\Web3\keys\4f04a5ed-87e4-1e4d-4367-604db42bdcff.json [2019-04-02 19:59:42.520265] [0x000041f0] [info] ReadingC:\Users\nilse\AppData\Roaming\Web3\keys\84258fde-b0d9-747e-b70f-f55e14831192.json [2019-04-02 19:59:42.520265] [0x000041f0] [info] ReadingC:\Users\nilse\AppData\Roaming\Web3\keys\9067d973-1c8d-fa86-a312-14c90188f610.json Enter a passphrase with which to secure this account:Please confirm the passphrase by entering it again: Created key 623b80dd-d008-4cd4-dd06-c36f0f64296c Address: 007e13502a8b226b0f19e7412db75352dc1d0760 - C:\Users\nilse\Documents\Code\aleth_ref\build\aleth\Debug>aleth account new + aleth account new [2019-04-02 19:59:53.847216] [0x000011b4] [info] ReadingC:\Users\nilse\AppData\Roaming\Web3\keys\4f04a5ed-87e4-1e4d-4367-604db42bdcff.json [2019-04-02 19:59:53.849343] [0x000011b4] [info] ReadingC:\Users\nilse\AppData\Roaming\Web3\keys\623b80dd-d008-4cd4-dd06-c36f0f64296c.json [2019-04-02 19:59:53.850400] [0x000011b4] [info] ReadingC:\Users\nilse\AppData\Roaming\Web3\keys\84258fde-b0d9-747e-b70f-f55e14831192.json @@ -51,9 +56,11 @@ Enter the desired password when prompted Enter a passphrase with which to secure this account:Please confirm the passphrase by entering it again: Created key ab921356-8c9e-54ff-e3e7-da5c2f7aa685 Address: 002c73acd4bc217998966964d27f0ee79a47befb -2. Add each address (these are the public keys generated in the previous step) into the "accounts" section of your chain configuration json file (we'll refer to this as config.json from now on) along with the desired balance in wei. - For example, the following initializes each account created in step 1 with 2 ether: + +2. Add each address (these are the public keys generated in the previous step) into the "accounts" section of your chain configuration json file (we'll refer to this as ``config.json`` from now on) along with the desired balance in wei. For example, the following initializes each account created in step 1 with 2 ether: + +:: "accounts": { "0000000000000000000000000000000000000001": { "precompiled": { "name": "ecrecover", "linear": { "base": 3000, "word": 0 } }, "balance": "0x01" }, @@ -72,22 +79,31 @@ Enter the desired password when prompted } } + 3. Start the first node (each of the command-line options are explained below): +:: + Aleth -m on --config -a --no-discovery --unsafe-transactions --listen -○ -m on: Enables CPU mining -○ --config: Path to chain configuration json file -○ -a: Sets recipient of mining block reward -○ --no-discovery: Disables the devp2p discovery protocol (it's unnecessary in a 2-node configuration, we'll be adding a peer manually) -○ --unsafe-transactions: Don't require approval before sending each transaction (unnecessary for testing purposes) -* --listen: TCP port to listen for incoming peer connections +-m on Enables CPU mining +--config Path to chain configuration json file +-a Sets recipient of mining block reward +--no-discovery Disables the devp2p discovery protocol (it's unnecessary in a 2-node configuration, we'll be adding a peer manually) +--unsafe-transactions Don't require approval before sending each transaction (unnecessary for testing purposes) +--listen TCP port to listen for incoming peer connections + +**Example:** + +:: - Example: + aleth -m on --config %CODE%\config.json -a 00fd4aaf9713f5bb664c20a462acc4ebc363d1a6 --no-discovery --unsafe-transactions --listen 30303 - aleth -m on --config %CODE%\config.json -a 00fd4aaf9713f5bb664c20a462acc4ebc363d1a6 --no-discovery --unsafe-transactions --listen 30303 +Make note of the node's enode URL since you'll need to reference it when launching the second node. The enode URL should be logged within the first few lines of log output. -Make note of the node's enode URL since you'll need to reference it when launching the second node. The enode URL should be logged within the first few lines of log output. For example: +**Example:** + +:: aleth, a C++ Ethereum client INFO 04-01 20:34:38 main net Id: ##fb867844… @@ -100,8 +116,11 @@ Make note of the node's enode URL since you'll need to reference it when launchi JSONRPC Admin Session Key: 7BPb1cysJuQ= INFO 04-01 20:34:40 main client Mining Beneficiary: @00fd4aaf… + If everything goes smoothly you should see the node start mining (empty) blocks after a minute or two: +:: + INFO 04-01 20:38:59 main rpc JSON-RPC socket path: \\.\pipe\\geth.ipc JSONRPC Admin Session Key: 2C/gbvE/pxQ= INFO 04-01 20:38:59 main client Mining Beneficiary: @00fd4aaf… @@ -113,63 +132,85 @@ If everything goes smoothly you should see the node start mining (empty) blocks INFO 04-01 20:40:39 miner1 client Block sealed #3 INFO 04-01 20:40:39 eth client 1 blocks imported in 3 ms (300.842 blocks/s) in #3 - 4. Start the second node: - - Aleth --config --no-discovery --unsafe-transactions --listen --peerset required: --db-path - - Notes: - * --config: You need to specify the same chain config file - § --listen: You need to specify a different port - § --peerset: Be sure to update the IP address in the enode URL to 127.0.0.1: - * This node won't mine so there's no mining options. - * --db-path: Path to save sync'd blocks. Aleth saves blocks by default to %APPDATA%\Ethereum on Windows and TODO on Linux. You need to specify a different path for your second node otherwise you'll run into database concurrency issues. An example of this error is in the TODO section. - - For example: - - aleth --config %CODE%\config.json --no-discovery --unsafe-transactions --listen 30305 --db-path %APPDATA%\EthereumPrivate_01 --peerset required:enode://5def584369536c059df3cd86280200beb51829319e4bd1a8bb19df885babe215db30eafa548861b558ae4ac65d546a2d96a5664fade83ba3605c45b6bd88cc51@127.0.0.1:30303 - - 5. If all goes well the second node will connect to the first node and start syncing blocks: - - aleth, a C++ Ethereum client - INFO 04-01 20:47:55 main net Id: ##d4a0335d… - aleth 1.6.0-alpha.1-28+commit.32bb833e.dirty - Mining Beneficiary: 84258fde-b0d9-747e-b70f-f55e14831192 - 00fd4aaf9713f5bb664c20a462acc4ebc363d1a6 - INFO 04-01 20:47:59 p2p info UPnP device not found. - WARN 04-01 20:47:59 p2p warn "_enabled" parameter is false, discovery is disabled - Node ID: enode://d4a0335d481fe816a7d580a298870066c3c24af60cd1c2875bd2598befedfbd5a43942f41e04f6e92d1081de72843f15ff5fb9c8f65cb31bdce1357514f02491@0.0.0.0:0 - INFO 04-01 20:47:59 main rpc JSON-RPC socket path: \\.\pipe\\geth.ipc - JSONRPC Admin Session Key: rtsy5ehS1JA= - INFO 04-01 20:47:59 p2p sync 5def5843…|aleth/1.6.0-alpha.1-28+commit.32bb833e.dirty/windows/msvc19.0.24215.1/debug Starting full sync - INFO 04-01 20:48:01 eth client 26 blocks imported in 177 ms (146.424 blocks/s) in #26 - INFO 04-01 20:48:02 eth client 50 blocks imported in 262 ms (190.531 blocks/s) in #76 - INFO 04-01 20:48:02 eth client 56 blocks imported in 300 ms (186.602 blocks/s) in #132 - INFO 04-01 20:48:02 eth client 59 blocks imported in 265 ms (222.067 blocks/s) in #191 + +4. Start the second node: + +:: + + aleth --config --no-discovery --unsafe-transactions --listen --peerset required: --db-path + + + --config You need to specify the same chain config file + --listen You need to specify a different port + --peerset Be sure to update the IP address in the enode URL to ``127.0.0.1:`` + --db-path Path to save sync'd blocks. Aleth saves blocks by default to ``%APPDATA%\Ethereum`` on Windows and TODO on Linux. You need to specify a different path for your second node otherwise you'll run into database concurrency issues. An example of this error is in the TODO section. + + +**Example:** + +:: + + aleth --config %CODE%\config.json --no-discovery --unsafe-transactions --listen 30305 --db-path %APPDATA%\EthereumPrivate_01 --peerset required:enode://5def584369536c059df3cd86280200beb51829319e4bd1a8bb19df885babe215db30eafa548861b558ae4ac65d546a2d96a5664fade83ba3605c45b6bd88cc51@127.0.0.1:30303 + + +5. If all goes well the second node will connect to the first node and start syncing blocks: + +:: + + aleth, a C++ Ethereum client + INFO 04-01 20:47:55 main net Id: ##d4a0335d… + aleth 1.6.0-alpha.1-28+commit.32bb833e.dirty + Mining Beneficiary: 84258fde-b0d9-747e-b70f-f55e14831192 - 00fd4aaf9713f5bb664c20a462acc4ebc363d1a6 + INFO 04-01 20:47:59 p2p info UPnP device not found. + WARN 04-01 20:47:59 p2p warn "_enabled" parameter is false, discovery is disabled + Node ID: enode://d4a0335d481fe816a7d580a298870066c3c24af60cd1c2875bd2598befedfbd5a43942f41e04f6e92d1081de72843f15ff5fb9c8f65cb31bdce1357514f02491@0.0.0.0:0 + INFO 04-01 20:47:59 main rpc JSON-RPC socket path: \\.\pipe\\geth.ipc + JSONRPC Admin Session Key: rtsy5ehS1JA= + INFO 04-01 20:47:59 p2p sync 5def5843…|aleth/1.6.0-alpha.1-28+commit.32bb833e.dirty/windows/msvc19.0.24215.1/debug Starting full sync + INFO 04-01 20:48:01 eth client 26 blocks imported in 177 ms (146.424 blocks/s) in #26 + INFO 04-01 20:48:02 eth client 50 blocks imported in 262 ms (190.531 blocks/s) in #76 + INFO 04-01 20:48:02 eth client 56 blocks imported in 300 ms (186.602 blocks/s) in #132 + INFO 04-01 20:48:02 eth client 59 blocks imported in 265 ms (222.067 blocks/s) in #191 Common Problems =============== -"Unrecognized peerset" error -Example: -Unrecognized peerset: required:enode://5def584369536c059df3cd86280200beb51829319e4bd1a8bb19df885babe215db30eafa548861b558ae4ac65d546a2d96a5664fade83ba3605c45b6bd88cc51@0.0.0.0:0 +``Unrecognized peerset`` error +--------------------------------- +**Example:** + +:: + + Unrecognized peerset: required:enode://5def584369536c059df3cd86280200beb51829319e4bd1a8bb19df885babe215db30eafa548861b558ae4ac65d546a2d96a5664fade83ba3605c45b6bd88cc51@0.0.0.0:0 + You need to update the IP address in the enode URL to 127.0.0.1: where is the port number you supplied to node 1 via --listen -"Database already open" error -Example: -aleth, a C++ Ethereum client -INFO 04-01 20:50:31 main net Id: ##a7dbe409… -WARN 04-01 20:50:31 main warn Database "C:\Users\nilse\AppData\Roaming\EthereumPrivate_00\ddce0f53\blocks"or "C:\Users\nilse\AppData\Roaming\EthereumPrivate_00\ddce0f53\12041\extras"already open. You appear to have another instance of ethereum running. Bailing. +``Database already open`` error +------------------------------- +**Example:** + +:: + + aleth, a C++ Ethereum client + INFO 04-01 20:50:31 main net Id: ##a7dbe409… + WARN 04-01 20:50:31 main warn Database "C:\Users\nilse\AppData\Roaming\EthereumPrivate_00\ddce0f53\blocks"or "C:\Users\nilse\AppData\Roaming\EthereumPrivate_00\ddce0f53\12041\extras"already open. You appear to have another instance of ethereum running. Bailing. + Both of your Aleth nodes are trying to use the same database location. You need to set one of your nodes' database path (--db-path) to a different location. + Node 2 doesn't sync with node 1 +------------------------------- Example: TODO: -This means that node 2 couldn't successfully peer with node 1. This typically happens because you used a different chain config file for each node. You can enable verbose logging on node 1 (-v4 --log-channels net sync) to get helpful logs for debugging. +This means that node 2 couldn't successfully peer with node 1. This typically happens because you used a different chain config file for each node. You can enable verbose logging on node 1 (``-v4 --log-channels net sync``) to get helpful logs for debugging. For example, here are the node 1 logs when node 1 and node 2 use different chain configuration files: +:: + TRACE 04-01 20:57:53 p2p net p2p.connect.ingress receiving auth from 127.0.0.1:61309 TRACE 04-01 20:57:53 p2p net Listening on local port 30303 TRACE 04-01 20:57:53 p2p net p2p.connect.ingress sending ack to 127.0.0.1:61309 @@ -203,8 +244,12 @@ For example, here are the node 1 logs when node 1 and node 2 use different chain DEBUG 04-01 20:57:58 p2p net 8b7b78e1…|aleth/1.6.0-alpha.1-28+commit.32bb833e.dirty/windows/msvc19.0.24215.1/debug Closing peer session :-( -"Couldn't start accepting connections on host. Failed to accept socket on " error -Example: +``Couldn't start accepting connections on host. Failed to accept socket on `` error +-------------------------------------------------------------------------------------------------- +**Example:** + +:: + aleth, a C++ Ethereum client INFO 04-01 21:01:18 main net Id: ##ac459be1… aleth 1.6.0-alpha.1-28+commit.32bb833e.dirty @@ -217,5 +262,6 @@ Example: INFO 04-01 21:01:20 p2p info UPnP device not found. WARN 04-01 21:01:20 p2p warn "_enabled" parameter is false, discovery is disabled -This means that you're running both nodes on the same listen port. Be sure to specify different ports via --listen. + +You're running both nodes on the same listen port. Be sure to specify different ports via ``--listen``. From 119b71902bd06b55a8f98ceeb883bfde52a96c9e Mon Sep 17 00:00:00 2001 From: Nils-Erik Frantzell Date: Thu, 4 Apr 2019 20:39:10 -0700 Subject: [PATCH 06/12] More formatting changes and minor language tweaks --- doc/private_net_sync.rst | 68 ++++++++++++++++++++++++++++++++++------ 1 file changed, 59 insertions(+), 9 deletions(-) diff --git a/doc/private_net_sync.rst b/doc/private_net_sync.rst index b56ef9de21f..ebb3f0b9029 100644 --- a/doc/private_net_sync.rst +++ b/doc/private_net_sync.rst @@ -1,28 +1,78 @@ Creating a private network with 2 syncing nodes =============================================== -These instructions cover creating an Ethereum private network consisting of 2 nodes - 1 node will mine blocks and the other node will connect to the first node and sync the mined blocks to its own block database. Both nodes will use (the same) private chain configuration. +These instructions cover creating an Ethereum private network consisting of two nodes - one node will mine blocks and the other node will connect to the first node and sync the mined blocks to its own block database. Both nodes will use (the same) private chain configuration. What is a private network? -------------------------- -For the purposes of this documentation, a "private network" can be thought of as a network of Ethereum nodes only accessible on your physical machine. +For the purposes of this documentation, a **private network** can be thought of as a network of Ethereum nodes only accessible on your physical machine. What is a private chain? ------------------------- -An Ethereum chain is some state (e.g. accounts and balances and/or contract code) and a set of rules a set of rules for interacting with that state. For the purposes of this documentation, a private chain is an Ethereum chain is one whose configuration is only available on your physical machine. +An Ethereum chain is some state (e.g. accounts and balances and/or contract code) and a set of rules for interacting with that state. For the purposes of this documentation, a **private chain** is an Ethereum chain whose configuration is only available on your physical machine. Mining ------ -- Mining will be done using the Aleth CPU miner (Aleth doesn't include a GPU miner because of the high support costs). -- Only 1 node will be mining to keep your machine responsive (since both nodes are running on the same physical system, having both mine will slow your system down significantly). -- If you find your system being sluggish or if you'd like to have both nodes mine, you can tune the number of mining threads via the ``-t `` flag +- Mining will be done using the Aleth CPU miner (Aleth doesn't include a GPU miner because of the high maintenance and support costs. Please see `EthMiner `_) for GPU mining support. +- Only one node will be mining to keep your machine responsive (since both nodes are running on the same physical system, having both mine will slow your system down significantly). +- If you find your system being sluggish or if you'd like both nodes to mine, you can tune the number of mining threads via the ``-t `` flag Chain configuration ------------------- -- You typically run a private chain using a chain configuration json file - this isn't strictly required, but it makes testing a lot easier since you can do things like lower the difficulty rate and pre-fund addresses with Ether. +- You typically run a private chain using a chain configuration json file (this isn't strictly required, but it makes testing a lot easier since you can do things like lower the difficulty rate and pre-fund addresses with Ether). - The chain configuration json file format is defined here: https://github.com/ethereum/wiki/wiki/Ethereum-Chain-Spec-Format -- Here's an example file: TODO -- Since the configuration file is used to create the chain's genesis state, both nodes must use the same configuration file otherwise they will have different genesis states and consequently won't be able to peer with each other. An example of this is shown in the "Common Problems" section (TODO) +- Here's an example file: + +:: + + { + "sealEngine": "Ethash", + "params": { + "accountStartNonce": "0x00", + "maximumExtraDataSize": "0x20", + "homesteadForkBlock": "0x00", + "EIP150ForkBlock": "0x00", + "EIP158ForkBlock": "0x00", + "byzantiumForkBlock": "0x00", + "constantinopleForkBlock": "0x00", + "constantinopleFixForkBlock": "0x00", + "minGasLimit": "0x5208", + "maxGasLimit": "0x7fffffffffffffff", + "tieBreakingGas": false, + "gasLimitBoundDivisor": "0x0400", + "minimumDifficulty": "0x100000", + "difficultyBoundDivisor": "0x0800", + "durationLimit": "0x0d", + "blockReward": "0x4563918244F40000", + "networkID" : "0x42", + "chainID": "0x42", + "allowFutureBlocks" : false + }, + "genesis": { + "nonce": "0x0000000000000042", + "difficulty": "0x100000", + "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "author": "0x0000000000000000000000000000000000000000", + "timestamp": "0x5A5B92D7", + "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "extraData": "0x655741534d2074657374206e6574776f726b2030", + "gasLimit": "0x989680" + }, + "accounts": { + "0000000000000000000000000000000000000001": { "precompiled": { "name": "ecrecover", "linear": { "base": 3000, "word": 0 } }, "balance": "0x01" }, + "0000000000000000000000000000000000000002": { "precompiled": { "name": "sha256", "linear": { "base": 60, "word": 12 } }, "balance": "0x01" }, + "0000000000000000000000000000000000000003": { "precompiled": { "name": "ripemd160", "linear": { "base": 600, "word": 120 } }, "balance": "0x01" }, + "0000000000000000000000000000000000000004": { "precompiled": { "name": "identity", "linear": { "base": 15, "word": 3 } }, "balance": "0x01" }, + "0000000000000000000000000000000000000005": { "precompiled": { "name": "modexp" }, "balance": "0x01" }, + "0000000000000000000000000000000000000006": { "precompiled": { "name": "alt_bn128_G1_add", "linear": { "base": 500, "word": 0 } }, "balance": "0x01" }, + "0000000000000000000000000000000000000007": { "precompiled": { "name": "alt_bn128_G1_mul", "linear": { "base": 40000, "word": 0 } }, "balance": "0x01" }, + "0000000000000000000000000000000000000008": { "precompiled": { "name": "alt_bn128_pairing_product" }, "balance": "0x01" }, + "00fd4aaf9713f5bb664c20a462acc4ebc363d1a6": { "balance" : "0x200000000000000000000000000000000000000000000000000000000000000" }, + "004d5baf9ab6a9c29c73725ec35023e330af2bc8": { "balance" : "0x200000000000000000000000000000000000000000000000000000000000000" } + } + } + +- **Both nodes must use the same configuration file!** The configuration file is used to create the chain's genesis state, so using a different configuration file with each node means that each node will be running on a different chain. The nodes will therefore not be able to peer with each other - an example of this is shown in the `Common Problems`_ section. Instructions ============ From ab5694902b1a27c82f463bdc193dab9c689f9cec Mon Sep 17 00:00:00 2001 From: Nils-Erik Frantzell Date: Thu, 4 Apr 2019 20:54:41 -0700 Subject: [PATCH 07/12] More formatting changes/edits --- doc/private_net_sync.rst | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/doc/private_net_sync.rst b/doc/private_net_sync.rst index ebb3f0b9029..854bd491094 100644 --- a/doc/private_net_sync.rst +++ b/doc/private_net_sync.rst @@ -87,7 +87,6 @@ Instructions Enter the desired password when prompted - **Example:** :: @@ -107,8 +106,7 @@ Enter the desired password when prompted Address: 002c73acd4bc217998966964d27f0ee79a47befb - -2. Add each address (these are the public keys generated in the previous step) into the "accounts" section of your chain configuration json file (we'll refer to this as ``config.json`` from now on) along with the desired balance in wei. For example, the following initializes each account created in step 1 with 2 ether: +2. Add each address (the public keys generated in the previous step) to the ``accounts`` section of your chain configuration file (we'll refer to this as ``config.json`` from now on) along with the desired balance in wei. For example, the following initializes each account created in step 1 with 2 ether: :: @@ -141,7 +139,8 @@ Enter the desired password when prompted -a Sets recipient of mining block reward --no-discovery Disables the devp2p discovery protocol (it's unnecessary in a 2-node configuration, we'll be adding a peer manually) --unsafe-transactions Don't require approval before sending each transaction (unnecessary for testing purposes) ---listen TCP port to listen for incoming peer connections +--listen TCP port to listen on for incoming peer connections + **Example:** @@ -149,7 +148,8 @@ Enter the desired password when prompted aleth -m on --config %CODE%\config.json -a 00fd4aaf9713f5bb664c20a462acc4ebc363d1a6 --no-discovery --unsafe-transactions --listen 30303 -Make note of the node's enode URL since you'll need to reference it when launching the second node. The enode URL should be logged within the first few lines of log output. + +Make note of the node's URL (starts with ``enode://``) since you'll need to reference it when launching the second node. The URL should be logged within the first few lines of log output. **Example:** @@ -187,13 +187,13 @@ If everything goes smoothly you should see the node start mining (empty) blocks :: - aleth --config --no-discovery --unsafe-transactions --listen --peerset required: --db-path + aleth --config --no-discovery --unsafe-transactions --listen --peerset required: --db-path --config You need to specify the same chain config file --listen You need to specify a different port - --peerset Be sure to update the IP address in the enode URL to ``127.0.0.1:`` - --db-path Path to save sync'd blocks. Aleth saves blocks by default to ``%APPDATA%\Ethereum`` on Windows and TODO on Linux. You need to specify a different path for your second node otherwise you'll run into database concurrency issues. An example of this error is in the TODO section. + --peerset Be sure to update the IP address in the node URL to 127.0.0.1: + --db-path Path to save sync'd blocks. Aleth saves blocks by default to %APPDATA%\Ethereum on Windows and $HOME/.ethereum on Linux. You need to specify a different path for your second node otherwise you'll run into database concurrency issues. An example of this error is in the `Common Problems`_ section. **Example:** @@ -203,7 +203,7 @@ If everything goes smoothly you should see the node start mining (empty) blocks aleth --config %CODE%\config.json --no-discovery --unsafe-transactions --listen 30305 --db-path %APPDATA%\EthereumPrivate_01 --peerset required:enode://5def584369536c059df3cd86280200beb51829319e4bd1a8bb19df885babe215db30eafa548861b558ae4ac65d546a2d96a5664fade83ba3605c45b6bd88cc51@127.0.0.1:30303 -5. If all goes well the second node will connect to the first node and start syncing blocks: +5. The second node will connect to the first node and start syncing blocks: :: @@ -225,7 +225,7 @@ If everything goes smoothly you should see the node start mining (empty) blocks Common Problems =============== -``Unrecognized peerset`` error +"Unrecognized peerset" error --------------------------------- **Example:** @@ -234,9 +234,9 @@ Common Problems Unrecognized peerset: required:enode://5def584369536c059df3cd86280200beb51829319e4bd1a8bb19df885babe215db30eafa548861b558ae4ac65d546a2d96a5664fade83ba3605c45b6bd88cc51@0.0.0.0:0 -You need to update the IP address in the enode URL to 127.0.0.1: where is the port number you supplied to node 1 via --listen +You need to update the IP address in the node URL to ``127.0.0.1:``, where ```` is the port number you supplied to node 1 via ``--listen``. -``Database already open`` error +"Database already open" error ------------------------------- **Example:** @@ -247,17 +247,14 @@ You need to update the IP address in the enode URL to 127.0.0.1: where `` error +"Couldn't start accepting connections on host. Failed to accept socket on " error -------------------------------------------------------------------------------------------------- **Example:** From 8b9983da80cdeef9dce70cae8daf30a24326bcdf Mon Sep 17 00:00:00 2001 From: Nils-Erik Frantzell Date: Thu, 4 Apr 2019 21:19:12 -0700 Subject: [PATCH 08/12] More minor tweaks --- doc/private_net_sync.rst | 66 ++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 37 deletions(-) diff --git a/doc/private_net_sync.rst b/doc/private_net_sync.rst index 854bd491094..e507be95736 100644 --- a/doc/private_net_sync.rst +++ b/doc/private_net_sync.rst @@ -1,25 +1,25 @@ -Creating a private network with 2 syncing nodes -=============================================== -These instructions cover creating an Ethereum private network consisting of two nodes - one node will mine blocks and the other node will connect to the first node and sync the mined blocks to its own block database. Both nodes will use (the same) private chain configuration. +Creating A Private Network With Two Syncing Nodes +================================================== +These instructions cover creating an Ethereum private network consisting of two nodes - one node will mine blocks and the other node will connect to the first node and sync the mined blocks to its own block database. -What is a private network? +What is a Private Network? -------------------------- For the purposes of this documentation, a **private network** can be thought of as a network of Ethereum nodes only accessible on your physical machine. -What is a private chain? +What is a Private Chain? ------------------------- An Ethereum chain is some state (e.g. accounts and balances and/or contract code) and a set of rules for interacting with that state. For the purposes of this documentation, a **private chain** is an Ethereum chain whose configuration is only available on your physical machine. Mining ------ -- Mining will be done using the Aleth CPU miner (Aleth doesn't include a GPU miner because of the high maintenance and support costs. Please see `EthMiner `_) for GPU mining support. -- Only one node will be mining to keep your machine responsive (since both nodes are running on the same physical system, having both mine will slow your system down significantly). +- Mining will be done using the Aleth CPU miner (Aleth doesn't include a GPU miner because of the high maintenance and support costs. Please see `EthMiner `_ for GPU mining support). +- Only one node will be mining to keep your machine responsive (since both nodes are running on the same physical system, having both mine will really slow down your machine). - If you find your system being sluggish or if you'd like both nodes to mine, you can tune the number of mining threads via the ``-t `` flag -Chain configuration +Chain Configuration ------------------- -- You typically run a private chain using a chain configuration json file (this isn't strictly required, but it makes testing a lot easier since you can do things like lower the difficulty rate and pre-fund addresses with Ether). +- You typically run a private chain using a chain configuration json file (this isn't strictly required, but it makes testing a lot easier since you can do things like lower the difficulty rate and pre-fund addresses). - The chain configuration json file format is defined here: https://github.com/ethereum/wiki/wiki/Ethereum-Chain-Spec-Format - Here's an example file: @@ -72,11 +72,11 @@ Chain configuration } } -- **Both nodes must use the same configuration file!** The configuration file is used to create the chain's genesis state, so using a different configuration file with each node means that each node will be running on a different chain. The nodes will therefore not be able to peer with each other - an example of this is shown in the `Common Problems`_ section. +- **Both nodes must use the same chain configuration file!** The chain configuration is used to create the chain's genesis state, so using a different configuration with each node means that each node will be running on a different chain and won't be able to peer with each other. An example of what this looks like is shown in `Common Problems`_. Instructions ============ -*The examples in this section were generated on Windows 10 running aleth 1.6.0-alpha.1-31+commit.ad7204c9* +*The output in this section was generated on Windows 10 running aleth 1.6.0-alpha.1-31+commit.ad7204c9* 1. Create a key pair for each node: @@ -106,7 +106,7 @@ Enter the desired password when prompted Address: 002c73acd4bc217998966964d27f0ee79a47befb -2. Add each address (the public keys generated in the previous step) to the ``accounts`` section of your chain configuration file (we'll refer to this as ``config.json`` from now on) along with the desired balance in wei. For example, the following initializes each account created in step 1 with 2 ether: +2. Add each address generated in the previous step to the ``accounts`` section of your chain configuration file (we'll refer to this as ``config.json`` from now on) along with the desired balance in wei. For example, the following initializes each account with two ether: :: @@ -128,16 +128,16 @@ Enter the desired password when prompted } -3. Start the first node (each of the command-line options are explained below): +3. Start the first node: :: - Aleth -m on --config -a --no-discovery --unsafe-transactions --listen + Aleth -m on --config -a --no-discovery --unsafe-transactions --listen --m on Enables CPU mining +-m on Enable CPU mining --config Path to chain configuration json file --a Sets recipient of mining block reward ---no-discovery Disables the devp2p discovery protocol (it's unnecessary in a 2-node configuration, we'll be adding a peer manually) +-a Set recipient of mining block reward +--no-discovery Disable the devp2p discovery protocol (it's unnecessary in a two-node network, we'll be adding a peer manually) --unsafe-transactions Don't require approval before sending each transaction (unnecessary for testing purposes) --listen TCP port to listen on for incoming peer connections @@ -149,7 +149,7 @@ Enter the desired password when prompted aleth -m on --config %CODE%\config.json -a 00fd4aaf9713f5bb664c20a462acc4ebc363d1a6 --no-discovery --unsafe-transactions --listen 30303 -Make note of the node's URL (starts with ``enode://``) since you'll need to reference it when launching the second node. The URL should be logged within the first few lines of log output. +Make note of the node's URL (which starts with ``enode://``) since you'll need to supply it when launching the second node. The URL should be logged within the first few lines of log output. **Example:** @@ -162,12 +162,9 @@ Make note of the node's URL (starts with ``enode://``) since you'll need to refe INFO 04-01 20:34:40 p2p info UPnP device not found. WARN 04-01 20:34:40 p2p warn "_enabled" parameter is false, discovery is disabled Node ID: enode://fb867844056920bbf0dd0945faff8a7a249d33726786ec367461a6c023cae62d7b2bb725a07e2f9832eb05be89e71cf81acf22022215b51a561929c37419531a@0.0.0.0:0 - INFO 04-01 20:34:40 main rpc JSON-RPC socket path: \\.\pipe\\geth.ipc - JSONRPC Admin Session Key: 7BPb1cysJuQ= - INFO 04-01 20:34:40 main client Mining Beneficiary: @00fd4aaf… -If everything goes smoothly you should see the node start mining (empty) blocks after a minute or two: +You should see the node start mining blocks after a minute or two: :: @@ -189,18 +186,17 @@ If everything goes smoothly you should see the node start mining (empty) blocks aleth --config --no-discovery --unsafe-transactions --listen --peerset required: --db-path - - --config You need to specify the same chain config file - --listen You need to specify a different port - --peerset Be sure to update the IP address in the node URL to 127.0.0.1: - --db-path Path to save sync'd blocks. Aleth saves blocks by default to %APPDATA%\Ethereum on Windows and $HOME/.ethereum on Linux. You need to specify a different path for your second node otherwise you'll run into database concurrency issues. An example of this error is in the `Common Problems`_ section. +--config Specify the same chain config file +--listen Specify a different port +--peerset Update the IP address in the node URL to ``127.0.0.1:`` +--db-path Path to save sync'd blocks. Aleth saves blocks by default to ``%APPDATA%\Ethereum`` on Windows and ``$HOME/.ethereum`` on Linux. You need to specify a different path for your second node otherwise you'll run into database access issues. An example of this error is in the `Common Problems`_ section. **Example:** :: - aleth --config %CODE%\config.json --no-discovery --unsafe-transactions --listen 30305 --db-path %APPDATA%\EthereumPrivate_01 --peerset required:enode://5def584369536c059df3cd86280200beb51829319e4bd1a8bb19df885babe215db30eafa548861b558ae4ac65d546a2d96a5664fade83ba3605c45b6bd88cc51@127.0.0.1:30303 + aleth --config %CODE%\config.json --no-discovery --unsafe-transactions --listen 30305 --db-path %APPDATA%\EthereumPrivate_01 --peerset required:enode://fb867844056920bbf0dd0945faff8a7a249d33726786ec367461a6c023cae62d7b2bb725a07e2f9832eb05be89e71cf81acf22022215b51a561929c37419531a@127.0.0.1:30303 5. The second node will connect to the first node and start syncing blocks: @@ -234,7 +230,7 @@ Common Problems Unrecognized peerset: required:enode://5def584369536c059df3cd86280200beb51829319e4bd1a8bb19df885babe215db30eafa548861b558ae4ac65d546a2d96a5664fade83ba3605c45b6bd88cc51@0.0.0.0:0 -You need to update the IP address in the node URL to ``127.0.0.1:``, where ```` is the port number you supplied to node 1 via ``--listen``. +Your peerset string is formatted incorrectly. You probably need to update the IP address in the node URL to ``127.0.0.1:``, where ```` is the port number you supplied to node 1 via ``--listen``. "Database already open" error ------------------------------- @@ -247,14 +243,14 @@ You need to update the IP address in the node URL to ``127.0.0.1:``, where WARN 04-01 20:50:31 main warn Database "C:\Users\nilse\AppData\Roaming\EthereumPrivate_00\ddce0f53\blocks"or "C:\Users\nilse\AppData\Roaming\EthereumPrivate_00\ddce0f53\12041\extras"already open. You appear to have another instance of ethereum running. Bailing. -Both of your Aleth nodes are trying to use the same location for their block databases. You need to set one of your nodes' database paths (``--db-path``) to a different location. +Both of your Aleth nodes are trying to use the same location for their block databases. Set one of your nodes' database paths to a different location (``--db-path``). Node 2 doesn't sync with node 1 ------------------------------- -This means that node 2 couldn't successfully peer with node 1. This typically happens because you used a different chain config file for each node. You can enable verbose logging on node 1 (``-v4 --log-channels net sync``) to get helpful logs for debugging. +This means that node 2 couldn't successfully peer with node 1. A common cause when running a private network is using a different chain config for each node. You can enable verbose logging on node 1 (``-v4 --log-channels net sync``) to get helpful logs for debugging. **You need to enable the verbose logging on the node being connected to (i.e. the miner).** -For example, here are the node 1 logs when node 1 and node 2 use different chain configuration files (note the ``Peer not suitable for sync: Invalid genesis hash.`` error): +**Example**: Here are the node 1 logs when node 1 and node 2 use different chain configuration files (note the ``Peer not suitable for sync: Invalid genesis hash.`` error): :: @@ -306,9 +302,5 @@ For example, here are the node 1 logs when node 1 and node 2 use different chain Dynamic exception type: class boost::exception_detail::clone_impl > std::exception::what: bind: Only one usage of each socket address (protocol/network address/port) is normally permitted - INFO 04-01 21:01:20 p2p info UPnP device not found. - WARN 04-01 21:01:20 p2p warn "_enabled" parameter is false, discovery is disabled - - -You're running both nodes on the same listen port. Be sure to specify different ports via ``--listen``. +You're running both nodes on the same listen port. Specify different ports when launching each node via ``--listen``. From d918c994a4d6180efac87de757db5ba3000aa5a1 Mon Sep 17 00:00:00 2001 From: Nils-Erik Frantzell Date: Thu, 4 Apr 2019 21:34:51 -0700 Subject: [PATCH 09/12] More updates --- doc/private_net_sync.rst | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/doc/private_net_sync.rst b/doc/private_net_sync.rst index e507be95736..63f971346f1 100644 --- a/doc/private_net_sync.rst +++ b/doc/private_net_sync.rst @@ -14,8 +14,8 @@ An Ethereum chain is some state (e.g. accounts and balances and/or contract code Mining ------ - Mining will be done using the Aleth CPU miner (Aleth doesn't include a GPU miner because of the high maintenance and support costs. Please see `EthMiner `_ for GPU mining support). -- Only one node will be mining to keep your machine responsive (since both nodes are running on the same physical system, having both mine will really slow down your machine). -- If you find your system being sluggish or if you'd like both nodes to mine, you can tune the number of mining threads via the ``-t `` flag +- Only one node will mine to keep your machine responsive. +- If mining slows down your system too much or you'd like both nodes to mine, you can tune the number of mining threads via ``-t ``. Chain Configuration ------------------- @@ -72,7 +72,7 @@ Chain Configuration } } -- **Both nodes must use the same chain configuration file!** The chain configuration is used to create the chain's genesis state, so using a different configuration with each node means that each node will be running on a different chain and won't be able to peer with each other. An example of what this looks like is shown in `Common Problems`_. +- **Both nodes must use the same chain configuration file:** The chain configuration is used to create the chain's genesis state, so using a different configuration with each node means that the nodes will be unable to peer with each other. An example of this is shown in the `Common Problems`_ section. Instructions ============ @@ -106,7 +106,7 @@ Enter the desired password when prompted Address: 002c73acd4bc217998966964d27f0ee79a47befb -2. Add each address generated in the previous step to the ``accounts`` section of your chain configuration file (we'll refer to this as ``config.json`` from now on) along with the desired balance in wei. For example, the following initializes each account with two ether: +2. Add each address generated in the previous step to the ``accounts`` section of your chain configuration file (we'll refer to this as ``config.json`` from now on) along with the desired balance in wei. For example, the following initializes each account with 2000000000000000000 wei (2 ether): :: @@ -135,21 +135,21 @@ Enter the desired password when prompted Aleth -m on --config -a --no-discovery --unsafe-transactions --listen -m on Enable CPU mining ---config Path to chain configuration json file +--config Set chain configuration -a Set recipient of mining block reward ---no-discovery Disable the devp2p discovery protocol (it's unnecessary in a two-node network, we'll be adding a peer manually) +--no-discovery Disable devp2p discovery protocol (it's unnecessary in a two-node network, we'll be adding a peer manually) --unsafe-transactions Don't require approval before sending each transaction (unnecessary for testing purposes) ---listen TCP port to listen on for incoming peer connections +--listen Set TCP port to listen on for incoming peer connections **Example:** :: - aleth -m on --config %CODE%\config.json -a 00fd4aaf9713f5bb664c20a462acc4ebc363d1a6 --no-discovery --unsafe-transactions --listen 30303 + aleth -m on --config config.json -a 00fd4aaf9713f5bb664c20a462acc4ebc363d1a6 --no-discovery --unsafe-transactions --listen 30303 -Make note of the node's URL (which starts with ``enode://``) since you'll need to supply it when launching the second node. The URL should be logged within the first few lines of log output. +Make note of the node's URL (which starts with ``enode://``) since you'll need to supply it when starting the second node. The URL should be logged within the first few lines of console output. **Example:** @@ -164,7 +164,7 @@ Make note of the node's URL (which starts with ``enode://``) since you'll need t Node ID: enode://fb867844056920bbf0dd0945faff8a7a249d33726786ec367461a6c023cae62d7b2bb725a07e2f9832eb05be89e71cf81acf22022215b51a561929c37419531a@0.0.0.0:0 -You should see the node start mining blocks after a minute or two: +The node should start mining blocks after a minute or two: :: @@ -189,17 +189,17 @@ You should see the node start mining blocks after a minute or two: --config Specify the same chain config file --listen Specify a different port --peerset Update the IP address in the node URL to ``127.0.0.1:`` ---db-path Path to save sync'd blocks. Aleth saves blocks by default to ``%APPDATA%\Ethereum`` on Windows and ``$HOME/.ethereum`` on Linux. You need to specify a different path for your second node otherwise you'll run into database access issues. An example of this error is in the `Common Problems`_ section. +--db-path Path to save sync'd blocks. Aleth saves blocks by default to ``%APPDATA%\Ethereum`` on Windows and ``$HOME/.ethereum`` on Linux. You need to specify a different path for your second node otherwise you'll run into database access issues. See the `Common Problems`_ section for an example of this error. **Example:** :: - aleth --config %CODE%\config.json --no-discovery --unsafe-transactions --listen 30305 --db-path %APPDATA%\EthereumPrivate_01 --peerset required:enode://fb867844056920bbf0dd0945faff8a7a249d33726786ec367461a6c023cae62d7b2bb725a07e2f9832eb05be89e71cf81acf22022215b51a561929c37419531a@127.0.0.1:30303 + aleth --config config.json --no-discovery --unsafe-transactions --listen 30305 --db-path %APPDATA%\EthereumPrivate_01 --peerset required:enode://fb867844056920bbf0dd0945faff8a7a249d33726786ec367461a6c023cae62d7b2bb725a07e2f9832eb05be89e71cf81acf22022215b51a561929c37419531a@127.0.0.1:30303 -5. The second node will connect to the first node and start syncing blocks: +5. The node should connect to the first node and start syncing blocks: :: @@ -230,7 +230,7 @@ Common Problems Unrecognized peerset: required:enode://5def584369536c059df3cd86280200beb51829319e4bd1a8bb19df885babe215db30eafa548861b558ae4ac65d546a2d96a5664fade83ba3605c45b6bd88cc51@0.0.0.0:0 -Your peerset string is formatted incorrectly. You probably need to update the IP address in the node URL to ``127.0.0.1:``, where ```` is the port number you supplied to node 1 via ``--listen``. +Your ``peerset`` string is formatted incorrectly. You probably need to update the IP address in the node URL to ``127.0.0.1:``, where ```` is the port number you supplied to node 1 via ``--listen``. "Database already open" error ------------------------------- @@ -248,7 +248,7 @@ Both of your Aleth nodes are trying to use the same location for their block dat Node 2 doesn't sync with node 1 ------------------------------- -This means that node 2 couldn't successfully peer with node 1. A common cause when running a private network is using a different chain config for each node. You can enable verbose logging on node 1 (``-v4 --log-channels net sync``) to get helpful logs for debugging. **You need to enable the verbose logging on the node being connected to (i.e. the miner).** +This means that node 2 couldn't successfully peer with node 1. A possible reason for this when running a private network is using a different chain config for each node. To see if this is the issue, enable verbose logging on node 1 (``-v4 --log-channels net sync``) to get helpful logs for debugging. **Example**: Here are the node 1 logs when node 1 and node 2 use different chain configuration files (note the ``Peer not suitable for sync: Invalid genesis hash.`` error): From 0f374795ea6ced78b459fa38d85dfb0690b055aa Mon Sep 17 00:00:00 2001 From: Nils-Erik Frantzell Date: Thu, 4 Apr 2019 21:42:26 -0700 Subject: [PATCH 10/12] Yet more edits --- doc/private_net_sync.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/private_net_sync.rst b/doc/private_net_sync.rst index 63f971346f1..3f4b117ddd2 100644 --- a/doc/private_net_sync.rst +++ b/doc/private_net_sync.rst @@ -14,12 +14,12 @@ An Ethereum chain is some state (e.g. accounts and balances and/or contract code Mining ------ - Mining will be done using the Aleth CPU miner (Aleth doesn't include a GPU miner because of the high maintenance and support costs. Please see `EthMiner `_ for GPU mining support). -- Only one node will mine to keep your machine responsive. -- If mining slows down your system too much or you'd like both nodes to mine, you can tune the number of mining threads via ``-t ``. +- We will only start mining for one node to keep your machine responsive. +- If mining slows down your system too much or you'd like to have both nodes mine, you can tune the number of mining threads via ``-t ``. Chain Configuration ------------------- -- You typically run a private chain using a chain configuration json file (this isn't strictly required, but it makes testing a lot easier since you can do things like lower the difficulty rate and pre-fund addresses). +- You typically initialize a private chain using a chain configuration json file (this isn't strictly required, but it makes testing a lot easier since you can do things like lower the difficulty rate and pre-fund addresses). - The chain configuration json file format is defined here: https://github.com/ethereum/wiki/wiki/Ethereum-Chain-Spec-Format - Here's an example file: @@ -72,7 +72,7 @@ Chain Configuration } } -- **Both nodes must use the same chain configuration file:** The chain configuration is used to create the chain's genesis state, so using a different configuration with each node means that the nodes will be unable to peer with each other. An example of this is shown in the `Common Problems`_ section. +- **Both nodes must use the same chain configuration file:** The chain configuration is used to create the chain's genesis state, so using a different configuration for each node means that they won't be able to peer with each other. An example of this is shown in the `Common Problems`_ section. Instructions ============ @@ -106,7 +106,7 @@ Enter the desired password when prompted Address: 002c73acd4bc217998966964d27f0ee79a47befb -2. Add each address generated in the previous step to the ``accounts`` section of your chain configuration file (we'll refer to this as ``config.json`` from now on) along with the desired balance in wei. For example, the following initializes each account with 2000000000000000000 wei (2 ether): +2. Add each address generated in the previous step to the ``accounts`` section of your chain configuration file (we'll refer to this as ``config.json``) along with the desired balance in wei. For example, the following initializes each account with 2 ether (2000000000000000000 wei): :: From ad8787b25a677b39e7c2c0e6134b9b5a101c7962 Mon Sep 17 00:00:00 2001 From: Nils-Erik Frantzell Date: Thu, 4 Apr 2019 21:42:36 -0700 Subject: [PATCH 11/12] Update index --- doc/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/index.rst b/doc/index.rst index 0a058405131..93aeee39325 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -6,4 +6,4 @@ Internal documentation 3. `Generating Consensus Tests `_ 4. `Using snapshot sync `_ 5. `Creating a single-node private network and deploying a contract with Remix `_ -6. `Creating a private network with 2 syncing nodes `_ +6. `Creating a private network with two syncing nodes `_ From 48eead6b8ea20f3bf988912e6cea1dd3bafeda72 Mon Sep 17 00:00:00 2001 From: Nils-Erik Frantzell Date: Fri, 5 Apr 2019 21:44:10 -0700 Subject: [PATCH 12/12] Address PR feedback --- doc/private_net_sync.rst | 111 +++++++++++++++++++-------------------- 1 file changed, 55 insertions(+), 56 deletions(-) diff --git a/doc/private_net_sync.rst b/doc/private_net_sync.rst index 3f4b117ddd2..d224ab7620e 100644 --- a/doc/private_net_sync.rst +++ b/doc/private_net_sync.rst @@ -1,6 +1,6 @@ Creating A Private Network With Two Syncing Nodes ================================================== -These instructions cover creating an Ethereum private network consisting of two nodes - one node will mine blocks and the other node will connect to the first node and sync the mined blocks to its own block database. +These instructions cover creating an Ethereum private network consisting of two nodes - one node will mine blocks and the other node will connect to the first node and sync the mined blocks to its own block database. Both nodes will run a private chain configuration. What is a Private Network? @@ -9,7 +9,7 @@ For the purposes of this documentation, a **private network** can be thought of What is a Private Chain? ------------------------- -An Ethereum chain is some state (e.g. accounts and balances and/or contract code) and a set of rules for interacting with that state. For the purposes of this documentation, a **private chain** is an Ethereum chain whose configuration is only available on your physical machine. +An Ethereum chain is some state (e.g. accounts and balances and/or contract code) and a set of rules for interacting with that state. **Private chain** is used in this documentation to refer to an Ethereum chain whose configuration is only available on your physical machine. Mining ------ @@ -19,8 +19,7 @@ Mining Chain Configuration ------------------- -- You typically initialize a private chain using a chain configuration json file (this isn't strictly required, but it makes testing a lot easier since you can do things like lower the difficulty rate and pre-fund addresses). -- The chain configuration json file format is defined here: https://github.com/ethereum/wiki/wiki/Ethereum-Chain-Spec-Format +- You typically initialize a private chain using a chain configuration json file (this isn't strictly required, but it makes testing easier since you can do things like lower the difficulty rate and pre-fund addresses). - Here's an example file: :: @@ -28,47 +27,47 @@ Chain Configuration { "sealEngine": "Ethash", "params": { - "accountStartNonce": "0x00", - "maximumExtraDataSize": "0x20", - "homesteadForkBlock": "0x00", - "EIP150ForkBlock": "0x00", - "EIP158ForkBlock": "0x00", - "byzantiumForkBlock": "0x00", - "constantinopleForkBlock": "0x00", - "constantinopleFixForkBlock": "0x00", - "minGasLimit": "0x5208", - "maxGasLimit": "0x7fffffffffffffff", - "tieBreakingGas": false, - "gasLimitBoundDivisor": "0x0400", - "minimumDifficulty": "0x100000", - "difficultyBoundDivisor": "0x0800", - "durationLimit": "0x0d", - "blockReward": "0x4563918244F40000", - "networkID" : "0x42", - "chainID": "0x42", - "allowFutureBlocks" : false + "accountStartNonce": "0x00", + "maximumExtraDataSize": "0x20", + "homesteadForkBlock": "0x00", + "EIP150ForkBlock": "0x00", + "EIP158ForkBlock": "0x00", + "byzantiumForkBlock": "0x00", + "constantinopleForkBlock": "0x00", + "constantinopleFixForkBlock": "0x00", + "minGasLimit": "0x5208", + "maxGasLimit": "0x7fffffffffffffff", + "tieBreakingGas": false, + "gasLimitBoundDivisor": "0x0400", + "minimumDifficulty": "0x100000", + "difficultyBoundDivisor": "0x0800", + "durationLimit": "0x0d", + "blockReward": "0x4563918244F40000", + "networkID" : "0x42", + "chainID": "0x42", + "allowFutureBlocks" : false }, "genesis": { - "nonce": "0x0000000000000042", - "difficulty": "0x100000", - "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", - "author": "0x0000000000000000000000000000000000000000", - "timestamp": "0x5A5B92D7", - "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", - "extraData": "0x655741534d2074657374206e6574776f726b2030", - "gasLimit": "0x989680" + "nonce": "0x0000000000000042", + "difficulty": "0x100000", + "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "author": "0x0000000000000000000000000000000000000000", + "timestamp": "0x5A5B92D7", + "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "extraData": "0x655741534d2074657374206e6574776f726b2030", + "gasLimit": "0x989680" }, "accounts": { - "0000000000000000000000000000000000000001": { "precompiled": { "name": "ecrecover", "linear": { "base": 3000, "word": 0 } }, "balance": "0x01" }, - "0000000000000000000000000000000000000002": { "precompiled": { "name": "sha256", "linear": { "base": 60, "word": 12 } }, "balance": "0x01" }, - "0000000000000000000000000000000000000003": { "precompiled": { "name": "ripemd160", "linear": { "base": 600, "word": 120 } }, "balance": "0x01" }, - "0000000000000000000000000000000000000004": { "precompiled": { "name": "identity", "linear": { "base": 15, "word": 3 } }, "balance": "0x01" }, - "0000000000000000000000000000000000000005": { "precompiled": { "name": "modexp" }, "balance": "0x01" }, - "0000000000000000000000000000000000000006": { "precompiled": { "name": "alt_bn128_G1_add", "linear": { "base": 500, "word": 0 } }, "balance": "0x01" }, - "0000000000000000000000000000000000000007": { "precompiled": { "name": "alt_bn128_G1_mul", "linear": { "base": 40000, "word": 0 } }, "balance": "0x01" }, - "0000000000000000000000000000000000000008": { "precompiled": { "name": "alt_bn128_pairing_product" }, "balance": "0x01" }, - "00fd4aaf9713f5bb664c20a462acc4ebc363d1a6": { "balance" : "0x200000000000000000000000000000000000000000000000000000000000000" }, - "004d5baf9ab6a9c29c73725ec35023e330af2bc8": { "balance" : "0x200000000000000000000000000000000000000000000000000000000000000" } + "0000000000000000000000000000000000000001": { "precompiled": { "name": "ecrecover", "linear": { "base": 3000, "word": 0 } }, "balance": "0x01" }, + "0000000000000000000000000000000000000002": { "precompiled": { "name": "sha256", "linear": { "base": 60, "word": 12 } }, "balance": "0x01" }, + "0000000000000000000000000000000000000003": { "precompiled": { "name": "ripemd160", "linear": { "base": 600, "word": 120 } }, "balance": "0x01" }, + "0000000000000000000000000000000000000004": { "precompiled": { "name": "identity", "linear": { "base": 15, "word": 3 } }, "balance": "0x01" }, + "0000000000000000000000000000000000000005": { "precompiled": { "name": "modexp" }, "balance": "0x01" }, + "0000000000000000000000000000000000000006": { "precompiled": { "name": "alt_bn128_G1_add", "linear": { "base": 500, "word": 0 } }, "balance": "0x01" }, + "0000000000000000000000000000000000000007": { "precompiled": { "name": "alt_bn128_G1_mul", "linear": { "base": 40000, "word": 0 } }, "balance": "0x01" }, + "0000000000000000000000000000000000000008": { "precompiled": { "name": "alt_bn128_pairing_product" }, "balance": "0x01" }, + "00fd4aaf9713f5bb664c20a462acc4ebc363d1a6": { "balance" : "0x200000000000000000000000000000000000000000000000000000000000000" }, + "004d5baf9ab6a9c29c73725ec35023e330af2bc8": { "balance" : "0x200000000000000000000000000000000000000000000000000000000000000" } } } @@ -111,20 +110,20 @@ Enter the desired password when prompted :: "accounts": { - "0000000000000000000000000000000000000001": { "precompiled": { "name": "ecrecover", "linear": { "base": 3000, "word": 0 } }, "balance": "0x01" }, - "0000000000000000000000000000000000000002": { "precompiled": { "name": "sha256", "linear": { "base": 60, "word": 12 } }, "balance": "0x01" }, - "0000000000000000000000000000000000000003": { "precompiled": { "name": "ripemd160", "linear": { "base": 600, "word": 120 } }, "balance": "0x01" }, - "0000000000000000000000000000000000000004": { "precompiled": { "name": "identity", "linear": { "base": 15, "word": 3 } }, "balance": "0x01" }, - "0000000000000000000000000000000000000005": { "precompiled": { "name": "modexp" }, "balance": "0x01" }, - "0000000000000000000000000000000000000006": { "precompiled": { "name": "alt_bn128_G1_add", "linear": { "base": 500, "word": 0 } }, "balance": "0x01" }, - "0000000000000000000000000000000000000007": { "precompiled": { "name": "alt_bn128_G1_mul", "linear": { "base": 40000, "word": 0 } }, "balance": "0x01" }, - "0000000000000000000000000000000000000008": { "precompiled": { "name": "alt_bn128_pairing_product" }, "balance": "0x01" }, - "007e13502a8b226b0f19e7412db75352dc1d0760": { - "balance" : "0x2000000000000000000" - }, - "002c73acd4bc217998966964d27f0ee79a47befb": { - "balance" : "0x2000000000000000000" - } + "0000000000000000000000000000000000000001": { "precompiled": { "name": "ecrecover", "linear": { "base": 3000, "word": 0 } }, "balance": "0x01" }, + "0000000000000000000000000000000000000002": { "precompiled": { "name": "sha256", "linear": { "base": 60, "word": 12 } }, "balance": "0x01" }, + "0000000000000000000000000000000000000003": { "precompiled": { "name": "ripemd160", "linear": { "base": 600, "word": 120 } }, "balance": "0x01" }, + "0000000000000000000000000000000000000004": { "precompiled": { "name": "identity", "linear": { "base": 15, "word": 3 } }, "balance": "0x01" }, + "0000000000000000000000000000000000000005": { "precompiled": { "name": "modexp" }, "balance": "0x01" }, + "0000000000000000000000000000000000000006": { "precompiled": { "name": "alt_bn128_G1_add", "linear": { "base": 500, "word": 0 } }, "balance": "0x01" }, + "0000000000000000000000000000000000000007": { "precompiled": { "name": "alt_bn128_G1_mul", "linear": { "base": 40000, "word": 0 } }, "balance": "0x01" }, + "0000000000000000000000000000000000000008": { "precompiled": { "name": "alt_bn128_pairing_product" }, "balance": "0x01" }, + "007e13502a8b226b0f19e7412db75352dc1d0760": { + "balance" : "2000000000000000000" + }, + "002c73acd4bc217998966964d27f0ee79a47befb": { + "balance" : "2000000000000000000" + } } @@ -132,7 +131,7 @@ Enter the desired password when prompted :: - Aleth -m on --config -a --no-discovery --unsafe-transactions --listen + aleth -m on --config -a --no-discovery --unsafe-transactions --listen -m on Enable CPU mining --config Set chain configuration