This repository was archived by the owner on Oct 28, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Documentation for creating a private network with 2 nodes #5546
Merged
Merged
Changes from 1 commit
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
9a0ada4
Rename existing private network documentation
halfalicious 98409f3
Initial (extremely rough) version of new private docs
halfalicious 0d1ea37
Lots of revisions. Still need to add proper formatting
halfalicious 515cf26
More edits
halfalicious d672288
First round of formatting changes
halfalicious 119b719
More formatting changes and minor language tweaks
halfalicious ab56949
More formatting changes/edits
halfalicious 8b9983d
More minor tweaks
halfalicious d918c99
More updates
halfalicious 0f37479
Yet more edits
halfalicious ad8787b
Update index
halfalicious 48eead6
Address PR feedback
halfalicious File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
More formatting changes and minor language tweaks
- Loading branch information
commit 119b71902bd06b55a8f98ceeb883bfde52a96c9e
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 <thread count>`` 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 <https://github.com/ethereum-mining/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 <thread count>`` 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 | ||
| ============ | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really follow that spec? It might be outdated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question! I assumed we did, Ill investigate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, the spec is either deprecated or we don't fully implement the spec (for example it lists a "nodes" key which we don't support). I'll remove the link.