11Creating A Private Network With Two Syncing Nodes
22==================================================
3- 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.
3+ 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.
44
55
66What is a Private Network?
@@ -9,7 +9,7 @@ For the purposes of this documentation, a **private network** can be thought of
99
1010What is a Private Chain?
1111-------------------------
12- 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.
12+ 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.
1313
1414Mining
1515------
@@ -19,56 +19,55 @@ Mining
1919
2020Chain Configuration
2121-------------------
22- - 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).
23- - The chain configuration json file format is defined here: https://github.com/ethereum/wiki/wiki/Ethereum-Chain-Spec-Format
22+ - 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).
2423- Here's an example file:
2524
2625::
2726
2827 {
2928 "sealEngine": "Ethash",
3029 "params": {
31- "accountStartNonce": "0x00",
32- "maximumExtraDataSize": "0x20",
33- "homesteadForkBlock": "0x00",
34- "EIP150ForkBlock": "0x00",
35- "EIP158ForkBlock": "0x00",
36- "byzantiumForkBlock": "0x00",
37- "constantinopleForkBlock": "0x00",
38- "constantinopleFixForkBlock": "0x00",
39- "minGasLimit": "0x5208",
40- "maxGasLimit": "0x7fffffffffffffff",
41- "tieBreakingGas": false,
42- "gasLimitBoundDivisor": "0x0400",
43- "minimumDifficulty": "0x100000",
44- "difficultyBoundDivisor": "0x0800",
45- "durationLimit": "0x0d",
46- "blockReward": "0x4563918244F40000",
47- "networkID" : "0x42",
48- "chainID": "0x42",
49- "allowFutureBlocks" : false
30+ "accountStartNonce": "0x00",
31+ "maximumExtraDataSize": "0x20",
32+ "homesteadForkBlock": "0x00",
33+ "EIP150ForkBlock": "0x00",
34+ "EIP158ForkBlock": "0x00",
35+ "byzantiumForkBlock": "0x00",
36+ "constantinopleForkBlock": "0x00",
37+ "constantinopleFixForkBlock": "0x00",
38+ "minGasLimit": "0x5208",
39+ "maxGasLimit": "0x7fffffffffffffff",
40+ "tieBreakingGas": false,
41+ "gasLimitBoundDivisor": "0x0400",
42+ "minimumDifficulty": "0x100000",
43+ "difficultyBoundDivisor": "0x0800",
44+ "durationLimit": "0x0d",
45+ "blockReward": "0x4563918244F40000",
46+ "networkID" : "0x42",
47+ "chainID": "0x42",
48+ "allowFutureBlocks" : false
5049 },
5150 "genesis": {
52- "nonce": "0x0000000000000042",
53- "difficulty": "0x100000",
54- "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
55- "author": "0x0000000000000000000000000000000000000000",
56- "timestamp": "0x5A5B92D7",
57- "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
58- "extraData": "0x655741534d2074657374206e6574776f726b2030",
59- "gasLimit": "0x989680"
51+ "nonce": "0x0000000000000042",
52+ "difficulty": "0x100000",
53+ "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
54+ "author": "0x0000000000000000000000000000000000000000",
55+ "timestamp": "0x5A5B92D7",
56+ "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
57+ "extraData": "0x655741534d2074657374206e6574776f726b2030",
58+ "gasLimit": "0x989680"
6059 },
6160 "accounts": {
62- "0000000000000000000000000000000000000001": { "precompiled": { "name": "ecrecover", "linear": { "base": 3000, "word": 0 } }, "balance": "0x01" },
63- "0000000000000000000000000000000000000002": { "precompiled": { "name": "sha256", "linear": { "base": 60, "word": 12 } }, "balance": "0x01" },
64- "0000000000000000000000000000000000000003": { "precompiled": { "name": "ripemd160", "linear": { "base": 600, "word": 120 } }, "balance": "0x01" },
65- "0000000000000000000000000000000000000004": { "precompiled": { "name": "identity", "linear": { "base": 15, "word": 3 } }, "balance": "0x01" },
66- "0000000000000000000000000000000000000005": { "precompiled": { "name": "modexp" }, "balance": "0x01" },
67- "0000000000000000000000000000000000000006": { "precompiled": { "name": "alt_bn128_G1_add", "linear": { "base": 500, "word": 0 } }, "balance": "0x01" },
68- "0000000000000000000000000000000000000007": { "precompiled": { "name": "alt_bn128_G1_mul", "linear": { "base": 40000, "word": 0 } }, "balance": "0x01" },
69- "0000000000000000000000000000000000000008": { "precompiled": { "name": "alt_bn128_pairing_product" }, "balance": "0x01" },
70- "00fd4aaf9713f5bb664c20a462acc4ebc363d1a6": { "balance" : "0x200000000000000000000000000000000000000000000000000000000000000" },
71- "004d5baf9ab6a9c29c73725ec35023e330af2bc8": { "balance" : "0x200000000000000000000000000000000000000000000000000000000000000" }
61+ "0000000000000000000000000000000000000001": { "precompiled": { "name": "ecrecover", "linear": { "base": 3000, "word": 0 } }, "balance": "0x01" },
62+ "0000000000000000000000000000000000000002": { "precompiled": { "name": "sha256", "linear": { "base": 60, "word": 12 } }, "balance": "0x01" },
63+ "0000000000000000000000000000000000000003": { "precompiled": { "name": "ripemd160", "linear": { "base": 600, "word": 120 } }, "balance": "0x01" },
64+ "0000000000000000000000000000000000000004": { "precompiled": { "name": "identity", "linear": { "base": 15, "word": 3 } }, "balance": "0x01" },
65+ "0000000000000000000000000000000000000005": { "precompiled": { "name": "modexp" }, "balance": "0x01" },
66+ "0000000000000000000000000000000000000006": { "precompiled": { "name": "alt_bn128_G1_add", "linear": { "base": 500, "word": 0 } }, "balance": "0x01" },
67+ "0000000000000000000000000000000000000007": { "precompiled": { "name": "alt_bn128_G1_mul", "linear": { "base": 40000, "word": 0 } }, "balance": "0x01" },
68+ "0000000000000000000000000000000000000008": { "precompiled": { "name": "alt_bn128_pairing_product" }, "balance": "0x01" },
69+ "00fd4aaf9713f5bb664c20a462acc4ebc363d1a6": { "balance" : "0x200000000000000000000000000000000000000000000000000000000000000" },
70+ "004d5baf9ab6a9c29c73725ec35023e330af2bc8": { "balance" : "0x200000000000000000000000000000000000000000000000000000000000000" }
7271 }
7372 }
7473
@@ -111,28 +110,28 @@ Enter the desired password when prompted
111110::
112111
113112 "accounts": {
114- "0000000000000000000000000000000000000001": { "precompiled": { "name": "ecrecover", "linear": { "base": 3000, "word": 0 } }, "balance": "0x01" },
115- "0000000000000000000000000000000000000002": { "precompiled": { "name": "sha256", "linear": { "base": 60, "word": 12 } }, "balance": "0x01" },
116- "0000000000000000000000000000000000000003": { "precompiled": { "name": "ripemd160", "linear": { "base": 600, "word": 120 } }, "balance": "0x01" },
117- "0000000000000000000000000000000000000004": { "precompiled": { "name": "identity", "linear": { "base": 15, "word": 3 } }, "balance": "0x01" },
118- "0000000000000000000000000000000000000005": { "precompiled": { "name": "modexp" }, "balance": "0x01" },
119- "0000000000000000000000000000000000000006": { "precompiled": { "name": "alt_bn128_G1_add", "linear": { "base": 500, "word": 0 } }, "balance": "0x01" },
120- "0000000000000000000000000000000000000007": { "precompiled": { "name": "alt_bn128_G1_mul", "linear": { "base": 40000, "word": 0 } }, "balance": "0x01" },
121- "0000000000000000000000000000000000000008": { "precompiled": { "name": "alt_bn128_pairing_product" }, "balance": "0x01" },
122- "007e13502a8b226b0f19e7412db75352dc1d0760": {
123- "balance" : "0x2000000000000000000 "
124- },
125- "002c73acd4bc217998966964d27f0ee79a47befb": {
126- "balance" : "0x2000000000000000000 "
127- }
113+ "0000000000000000000000000000000000000001": { "precompiled": { "name": "ecrecover", "linear": { "base": 3000, "word": 0 } }, "balance": "0x01" },
114+ "0000000000000000000000000000000000000002": { "precompiled": { "name": "sha256", "linear": { "base": 60, "word": 12 } }, "balance": "0x01" },
115+ "0000000000000000000000000000000000000003": { "precompiled": { "name": "ripemd160", "linear": { "base": 600, "word": 120 } }, "balance": "0x01" },
116+ "0000000000000000000000000000000000000004": { "precompiled": { "name": "identity", "linear": { "base": 15, "word": 3 } }, "balance": "0x01" },
117+ "0000000000000000000000000000000000000005": { "precompiled": { "name": "modexp" }, "balance": "0x01" },
118+ "0000000000000000000000000000000000000006": { "precompiled": { "name": "alt_bn128_G1_add", "linear": { "base": 500, "word": 0 } }, "balance": "0x01" },
119+ "0000000000000000000000000000000000000007": { "precompiled": { "name": "alt_bn128_G1_mul", "linear": { "base": 40000, "word": 0 } }, "balance": "0x01" },
120+ "0000000000000000000000000000000000000008": { "precompiled": { "name": "alt_bn128_pairing_product" }, "balance": "0x01" },
121+ "007e13502a8b226b0f19e7412db75352dc1d0760": {
122+ "balance" : "2000000000000000000 "
123+ },
124+ "002c73acd4bc217998966964d27f0ee79a47befb": {
125+ "balance" : "2000000000000000000 "
126+ }
128127 }
129128
130129
1311303. Start the first node:
132131
133132::
134133
135- Aleth -m on --config <file> -a <addr> --no-discovery --unsafe-transactions --listen <port>
134+ aleth -m on --config <file> -a <addr> --no-discovery --unsafe-transactions --listen <port>
136135
137136-m on Enable CPU mining
138137--config Set chain configuration
0 commit comments