forked from ethereumbook/ethereumbook
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Started with peering and re-organized files.
- Loading branch information
Showing
3 changed files
with
424 additions
and
411 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -0,0 +1,97 @@ | ||
[[_anchor_operate_private_network]] | ||
== Operating a private Ethereum network | ||
|
||
[[_anchor_start_nodes]] | ||
==== Start nodes | ||
|
||
1. Log onto first machine and start Ethereum with the command below. | ||
|
||
[[_code_start_node_nodiscover]] | ||
[source,bash] | ||
---- | ||
geth --datadir "/home/ubuntu/eth-priv" --networkid 15 --nodiscover --maxpeers 2 --port 30333 console | ||
---- | ||
|
||
2. Log onto second machine and start Ethereum with the command below. | ||
|
||
[[_code_start_node]] | ||
[source,bash] | ||
---- | ||
geth --datadir "/home/ubuntu/eth-priv" --networkid 15 --port 30333 console | ||
---- | ||
|
||
3. Check for connected peer with the command below. | ||
|
||
[[_code_node_list]] | ||
[source,bash] | ||
---- | ||
admin.peers | ||
---- | ||
|
||
4. Exit with `Ctrl-D` on the third machine. | ||
|
||
[[_anchor_account_setup]] | ||
==== Set-up accounts | ||
|
||
For now, we will set-up accounts only on the third machine. First, we launch the console as shown below. | ||
|
||
[[_code_console_launch]] | ||
[source,bash] | ||
---- | ||
geth --datadir "/home/ubuntu/eth-priv" --networkid 15 console | ||
---- | ||
|
||
Then, we add an account as below. | ||
|
||
[[_code_add_account]] | ||
[source,bash] | ||
---- | ||
geth --datadir "/home/ubuntu/eth-priv" account new | ||
---- | ||
|
||
Finally, we start the mining process so that ethers are credited to this account. | ||
|
||
[[_code_start_mining]] | ||
[source,bash] | ||
---- | ||
geth --datadir "/home/ubuntu/eth-priv" --networkid 15 --mine | ||
---- | ||
|
||
We can check the balance using the following command on the console. | ||
|
||
[[_code_account_balance]] | ||
[source,bash] | ||
---- | ||
eth.getBalance(eth.accounts[0]) | ||
---- | ||
|
||
[[_anchor_RPC]] | ||
==== Start RPC | ||
|
||
On the third machine, open up the RPC port to allow for communication with a client. | ||
|
||
[[_code_start_rpc]] | ||
[source,bash] | ||
---- | ||
geth --datadir eth-priv --networkid 15 --maxpeers 2 --port 30333 --rpc --rpcapi "web3,eth,personal" --rpcaddr "0.0.0.0" --rpccorsdomain "*" | ||
---- | ||
|
||
**NOTE** that, the `--rpcaddr 0.0.0.0` value has been set for testing only. This value is **strongly discouraged**. | ||
|
||
[[_anchor_mining]] | ||
=== Mining | ||
|
||
[[_code_start_mining_rpc]] | ||
[source,bash] | ||
---- | ||
geth --datadir eth-priv --networkid 15 --maxpeers 3 --port 30333 --rpc --rpcapi "web3,eth,personal" --rpcaddr "0.0.0.0" --rpccorsdomain "*" --mine | ||
---- | ||
|
||
[[_anchor_RPC_end-point]] | ||
=== RPC End-point | ||
|
||
=== Contract deployment and execution | ||
|
||
==== Deployment | ||
|
||
==== Execution |
Oops, something went wrong.