Updated tutorials for printing of enode on startup (#1149)

Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
This commit is contained in:
MadelineMurray
2019-03-23 10:47:55 +10:00
committed by GitHub
parent 70d1636ae6
commit 48176d9a16
8 changed files with 123 additions and 234 deletions

View File

@@ -40,6 +40,9 @@ Specified by the [`--p2p-host`](../Reference/Pantheon-CLI-Syntax.md#p2p-host) an
The enode URL is:
`enode://c35c3ec90a8a51fd5703594c6303382f3ae6b2ecb9589bab2c04b3794f2bc3fc2631dabb0c08af795787a6c004d8f532230ae6e9925cbbefb0b28b79295d615f@127.0.0.1:30303`
The enode is displayed when starting a Pantheon node and can be obtained using the [`net_enode`](../Reference/JSON-RPC-API-Methods.md#net_enode)
JSON-RPC API method.
## Specifying a Custom Node Private Key File
Use the [`--node-private-key-file`](../Reference/Pantheon-CLI-Syntax.md#node-private-key-file) option to specify a custom `key` file in any location.

View File

@@ -354,7 +354,7 @@ None
### net_enode
Returns the client enode (if active).
Returns the [enode URL](../Configuring-Pantheon/Node-Keys.md#enode-url).
**Parameters**
@@ -366,17 +366,17 @@ None
!!! example
```bash tab="curl HTTP request"
curl -X POST --data '{"jsonrpc":"2.0","method":"net_enode","params":[],"id":53}' http://127.0.0.1:8545
curl -X POST --data '{"jsonrpc":"2.0","method":"net_enode","params":[],"id":1}' http://127.0.0.1:8545
```
```bash tab="wscat WS request"
{"jsonrpc":"2.0","method":"net_enode","params":[],"id":53}
{"jsonrpc":"2.0","method":"net_enode","params":[],"id":1}
```
```json tab="JSON result"
{
"jsonrpc" : "2.0",
"id" : 53,
"id" : 1,
"result" : "enode://6a63160d0ccef5e4986d270937c6c8d60a9a4d3b25471cda960900d037c61988ea14da67f69dbfb3497c465d0de1f001bb95598f74b68a39a5156a608c42fa1b@127.0.0.1:30303"
}
```

View File

@@ -3,12 +3,6 @@ description: Pantheon command line interface reference
# Pantheon Command Line
!!! important "Breaking Changes in v0.9"
In v0.9, the command line changed to improve usability. These are breaking changes; that is,
in many cases the v0.8 command line options no longer work.
This reference and the rest of the documentation has been updated to reflect these changes. The [release notes](https://github.com/PegaSysEng/pantheon/blob/master/CHANGELOG.md)
include a mapping of the previous command line options to the new options.
This reference describes the syntax of the Pantheon Command Line Interface (CLI) options and subcommands.
```bash

View File

@@ -18,16 +18,14 @@ consensus protocol](../Consensus-Protocols/IBFT.md).
To create a private network using IBFT 2.0 with three nodes and one initial validator:
1. [Create Folders](#1-create-folders)
1. [Get Public Key for Node-1](#2-get-public-key-for-node-1)
1. [Get Node Addresses](#3-get-node-addresses)
1. [Create JSON File to RLP Encode](#4-create-json-file-to-rlp-encode)
1. [RLP Encode Extra Data](#5-rlp-encode-extra-data)
1. [Create Genesis File](#6-create-genesis-file)
1. [Delete Database Directory](#7-delete-database-directory)
1. [Start First Node as Bootnode](#8-start-first-node-as-bootnode)
1. [Start Node-2](#9-start-node-2)
1. [Start Node-3](#10-start-node-3)
1. [Confirm Private Network is Working](#11-confirm-private-network-is-working)
1. [Get Node Addresses](#2-get-node-addresses)
1. [Create JSON File to RLP Encode](#3-create-json-file-to-rlp-encode)
1. [RLP Encode Extra Data](#4-rlp-encode-extra-data)
1. [Create Genesis File](#5-create-genesis-file)
1. [Start First Node as Bootnode](#6-start-first-node-as-bootnode)
1. [Start Node-2](#7-start-node-2)
1. [Start Node-3](#8-start-node-3)
1. [Confirm Private Network is Working](#9-confirm-private-network-is-working)
### 1. Create Folders
@@ -45,38 +43,7 @@ IBFT-Network/
├── data
```
### 2. Get Public Key for Node-1
The public key of Node-1 is needed for the [enode URL](../Configuring-Pantheon/Node-Keys.md#enode-url). The enode URL
is used when starting Node-2 and Node-3 to specify Node-1 is the bootnode.
In the `Node-1` directory, use the [`public-key export`](../Reference/Pantheon-CLI-Syntax.md#public-key) subcommand to write
the [node public key](../Configuring-Pantheon/Node-Keys.md) to the specified file (`publicKey`):
```bash tab="MacOS"
pantheon --data-path=data public-key export --to=data/publicKey
```
```bash tab="Windows"
pantheon --data-path=path public-key export --to=data\publicKey
```
!!!note
The [`--data-path`](../Reference/Pantheon-CLI-Syntax.md#data-path) option is not used when running Pantheon
from the [Docker image](../Getting-Started/Run-Docker-Image.md). Use a volume to [specify the data directory](../Getting-Started/Run-Docker-Image.md#data-directory).
Your node 1 directory now contains:
```bash
├── Node-1
   ├── data
├── database
      ├── key
      ├── publicKey
```
The `database` directory contains the blockchain data.
### 3. Get Node Addresses
### 2. Get Node Addresses
In IBFT 2.0 networks, the address of at least one initial validator must be included in the genesis file in the
RLP encoded `extraData` string. For this network, we will use Node-1 as the initial validator. This requires obtaining the address for Node-1.
@@ -96,7 +63,7 @@ To vote in validators once the network is running, the node address for the prop
and `Node-3` directories, write the node address for each node to the specified file using the `public-key export-address`
command as for `Node-1`.
### 4. Create JSON File to RLP Encode
### 3. Create JSON File to RLP Encode
Create a file called `toEncode.json` in the `IBFT-Network` directory that contains the [Node 1 address excluding the 0x prefix](#3-get-node-addresses)
from the `nodeAddress` file in the `Node-1/data` directory:
@@ -114,7 +81,7 @@ from the `nodeAddress` file in the `Node-1/data` directory:
```
### 5. RLP Encode Extra Data
### 4. RLP Encode Extra Data
The `extraData` property in IBFT 2.0 genesis files is an RLP encoding of `[32 Bytes Vanity, List<Validators>, No Vote, Round=Int(0), 0 Seals]`.
@@ -130,7 +97,7 @@ pantheon rlp encode --from=toEncode.json --to=rlpEncodedExtraData
```
### 6. Create Genesis File
### 5. Create Genesis File
The genesis file defines the genesis block of the blockchain (that is, the start of the blockchain).
The [IBFT 2.0 genesis file](../Consensus-Protocols/IBFT.md#genesis-file) includes the address of Node-1 as the initial validator in the
@@ -195,12 +162,7 @@ In `extraData`, copy the [RLP encoded data](#5-rlp-encode-extra-data) from the `
The private keys are displayed which means the accounts are not secure.
### 7. Delete Database Directories
Delete the `database` directories created when [getting the public key for Node-1](#2-get-public-key-for-node-1) and [addresses for Node-2 and Node-3](#3-get-node-addresses).
The nodes cannot be started with the IBFT 2.0 genesis file while the previously generated data is in the `database` directories.
### 8. Start First Node as Bootnode
### 6. Start First Node as Bootnode
In the `Node-1` directory, start Node-1:
@@ -225,18 +187,23 @@ The command line specifies:
* All hosts can access the HTTP JSON-RPC API using the [`--host-whitelist`](../Reference/Pantheon-CLI-Syntax.md#host-whitelist) option
* All domains can access the node using the HTTP JSON-RPC API using the [`--rpc-http-cors-origins`](../Reference/Pantheon-CLI-Syntax.md#rpc-http-cors-origins) option
### 9. Start Node-2
When the node starts, the [enode URL](../Configuring-Pantheon/Node-Keys.md#enode-url) is displayed.
Copy the enode URL to specify Node-1 as the bootnode in the following steps.
![Node 1 Enode URL](../images/EnodeStartup.png)
### 7. Start Node-2
You need the [enode URL](../Configuring-Pantheon/Node-Keys.md#enode-url) for Node-1 to specify Node-1 as a bootnode.
Start another terminal, change to the `Node-2` directory and start Node-2 replacing the enode URL with your bootonde:
Start another terminal, change to the `Node-2` directory and start Node-2 specifying the Node-1 enode URL copied when starting Node-1 as the bootnode:
```bash tab="MacOS"
pantheon --data-path=data --genesis-file=../ibftGenesis.json --bootnodes="enode://<node public key ex 0x>@127.0.0.1:30303" --p2p-port=30304 --rpc-http-enabled --rpc-http-api=ETH,NET,IBFT --host-whitelist=* --rpc-http-cors-origins="all" --rpc-http-port=8546
pantheon --data-path=data --genesis-file=../ibftGenesis.json --bootnodes=<Node-1 Enode URL> --p2p-port=30304 --rpc-http-enabled --rpc-http-api=ETH,NET,IBFT --host-whitelist=* --rpc-http-cors-origins="all" --rpc-http-port=8546
```
```bash tab="Windows"
pantheon --data-path=data --genesis-file=..\ibftGenesis.json --bootnodes="enode://<node public key ex 0x>@127.0.0.1:30303" --p2p-port=30304 --rpc-http-enabled --rpc-http-api=ETH,NET,IBFT --host-whitelist=* --rpc-http-cors-origins="all" --rpc-http-port=8546
pantheon --data-path=data --genesis-file=..\ibftGenesis.json --bootnodes=<Node-1 Enode URL> --p2p-port=30304 --rpc-http-enabled --rpc-http-api=ETH,NET,IBFT --host-whitelist=* --rpc-http-cors-origins="all" --rpc-http-port=8546
```
The command line specifies:
@@ -248,16 +215,16 @@ The command line specifies:
* Other options as for [Node-1](#5-start-first-node-as-bootnode).
### 10. Start Node-3
### 8. Start Node-3
Start another terminal, change to the `Node-3` directory and start Node-3 replacing the enode URL with your bootnode:
Start another terminal, change to the `Node-3` directory and start Node-3 specifying the Node-1 enode URL copied when starting Node-1 as the bootnode:
```bash tab="MacOS"
pantheon --data-path=data --genesis-file=../ibftGenesis.json --bootnodes="enode://<node public key ex 0x>@127.0.0.1:30303" --p2p-port=30305 --rpc-http-enabled --rpc-http-api=ETH,NET,IBFT --host-whitelist=* --rpc-http-cors-origins="all" --rpc-http-port=8547
pantheon --data-path=data --genesis-file=../ibftGenesis.json --bootnodes=<Node-1 Enode URL> --p2p-port=30305 --rpc-http-enabled --rpc-http-api=ETH,NET,IBFT --host-whitelist=* --rpc-http-cors-origins="all" --rpc-http-port=8547
```
```bash tab="Windows"
pantheon --data-path=data --genesis-file=..\ibftGenesis.json --bootnodes="enode://<node public key ex 0x>@127.0.0.1:30303" --p2p-port=30305 --rpc-http-enabled --rpc-http-api=ETH,NET,IBFT --host-whitelist=* --rpc-http-cors-origins="all" --rpc-http-port=8547
pantheon --data-path=data --genesis-file=..\ibftGenesis.json --bootnodes=<Node-1 Enode URL> --p2p-port=30305 --rpc-http-enabled --rpc-http-api=ETH,NET,IBFT --host-whitelist=* --rpc-http-cors-origins="all" --rpc-http-port=8547
```
The command line specifies:
@@ -268,7 +235,7 @@ The command line specifies:
* Bootnode as for [Node-2](#6-start-node-2).
* Other options as for [Node-1](#5-start-first-node-as-bootnode).
### 11. Confirm Private Network is Working
### 9. Confirm Private Network is Working
Start another terminal, use curl to call the JSON-RPC API [`net_peerCount`](../Reference/JSON-RPC-API-Methods.md#net_peercount) method and confirm the nodes are functioning as peers:
@@ -304,4 +271,4 @@ Import accounts to MetaMask and send transactions as described in the [Private N
When finished using the private network, stop all nodes using ++ctrl+c++ in each terminal window.
!!!tip
To restart the IBFT 2.0 network in the future, start from [8. Start First Node as Bootnode](#8-start-first-node-as-bootnode).
To restart the IBFT 2.0 network in the future, start from [6. Start First Node as Bootnode](#6-start-first-node-as-bootnode).

View File

@@ -25,11 +25,10 @@ To create a permissoned network:
1. [Get Address of Node-1](#3-get-address-of-node-1)
1. [Create Genesis File](#4-create-genesis-file)
1. [Create Permissions Configuration File](#5-create-permissions-configuration-file)
1. [Delete Database Directories](#6-delete-database-directories)
1. [Start First Node as Bootnode](#7-start-first-node-as-bootnode)
1. [Start Node-2](#8-start-node-2)
1. [Start Node-3](#9-start-node-3)
1. [Confirm Permissioned Network is Working](#10-confirm-permissioned-network-is-working)
1. [Start First Node as Bootnode](#6-start-first-node-as-bootnode)
1. [Start Node-2](#7-start-node-2)
1. [Start Node-3](#8-start-node-3)
1. [Confirm Permissioned Network is Working](#9-confirm-permissioned-network-is-working)
### 1. Create Folders
@@ -41,11 +40,11 @@ Create directories for your permissioned network, each of the three nodes, and a
```bash
Permissioned-Network/
├── Node-1
│   ├── Node-1-data-path
│   ├── data
├── Node-2
│   ├── Node-2-data-path
│   ├── data
└── Node-3
├── Node-3-data-path
├── data
```
### 2. Get Node Public Keys
@@ -56,11 +55,11 @@ In the `Node-1` directory, use the [`public-key`](../Reference/Pantheon-CLI-Synt
the [node public key](../Configuring-Pantheon/Node-Keys.md) to the specified file (`publicKeyNode1` in this example):
```bash tab="MacOS"
pantheon --data-path=Node-1-data-path public-key export --to=Node-1-data-path/publicKeyNode1
pantheon --data-path=data public-key export --to=data/publicKeyNode1
```
```bash tab="Windows"
pantheon --data-path=Node-1-data-path public-key export --to=Node-1-data-path\publicKeyNode1
pantheon --data-path=data public-key export --to=data\publicKeyNode1
```
!!!note
@@ -70,26 +69,23 @@ pantheon --data-path=Node-1-data-path public-key export --to=Node-1-data-path\pu
Your node 1 directory now contains:
```bash
├── Node-1
   ├── Node-1-data-path
├── database
   ├── data
      ├── key
      ├── publicKeyNode1
```
The `database` directory contains the blockchain data.
Repeat this for Node-2 and Node-3 in the `Node-2` and `Node-3` directories:
```bash tab="MacOS"
pantheon --data-path=Node-2-data-path public-key export --to=Node-2-data-path/publicKeyNode2
pantheon --data-path=data public-key export --to=data/publicKeyNode2
pantheon --data-path=Node-3-data-path public-key export --to=Node-3-data-path/publicKeyNode3
pantheon --data-path=data public-key export --to=data/publicKeyNode3
```
```bash tab="Windows"
pantheon --data-path=Node-2-data-path public-key export --to=Node-2-data-path\publicKeyNode2
pantheon --data-path=data public-key export --to=data\publicKeyNode2
pantheon --data-path=Node-3-data-path public-key export --to=Node-3-data-path\publicKeyNode3
pantheon --data-path=data public-key export --to=data\publicKeyNode3
```
### 3. Get Address of Node-1
@@ -101,11 +97,11 @@ To obtain the address for Node-1, in the `Node-1` directory, use the [`public-ke
subcommand to write the node address to the specified file (`nodeAddress1` in this example)
```bash tab="MacOS"
pantheon --data-path=Node-1-data-path public-key export-address --to=Node-1-data-path/nodeAddress1
pantheon --data-path=data public-key export-address --to=data/nodeAddress1
```
```bash tab="Windows"
pantheon --data-path=Node-1-data-path public-key export-address --to=Node-1-data-path\nodeAddress1
pantheon --data-path=data public-key export-address --to=data\nodeAddress1
```
### 4. Create Genesis File
@@ -179,8 +175,8 @@ In `extraData`, replace `<Node 1 Address>` with the [address for Node-1](#3-get-
The permissions configuration file defines the nodes and accounts whitelists.
Copy the following permissions configuration to a file called `permissions_config.toml` and save a copy in the `Node-1-data-path`,
`Node-2-data-path`, and `Node-3-data-path` directories:
Copy the following permissions configuration to a file called `permissions_config.toml` and save a copy in the `Node-1/data`,
`Node-2/data`, and `Node-3/data` directories:
!!! example "permissions_config.toml"
```toml
@@ -203,21 +199,16 @@ The permissions configuration file includes:
On-chain permissioning is under development. On-chain permissioning will use one on-chain
nodes whitelist and accounts whitelist.
### 6. Delete Database Directories
Delete the `database` directories created when [getting the public keys for each node](#2-get-public-keys).
The nodes cannot be started while the previously generated data is in the `database` directory.
### 7. Start First Node as Bootnode
### 6. Start First Node as Bootnode
Start Node-1:
```bash tab="MacOS"
pantheon --data-path=Node-1-data-path --genesis-file=../cliqueGenesis.json --permissions-nodes-enabled --permissions-accounts-enabled --rpc-http-enabled --rpc-http-api=ADMIN,ETH,NET,PERM,CLIQUE --host-whitelist=* --rpc-http-cors-origins=*
pantheon --data-path=data --genesis-file=../cliqueGenesis.json --permissions-nodes-enabled --permissions-accounts-enabled --rpc-http-enabled --rpc-http-api=ADMIN,ETH,NET,PERM,CLIQUE --host-whitelist=* --rpc-http-cors-origins=*
```
```bash tab="Windows"
pantheon --data-path=Node-1-data-path --genesis-file=..\cliqueGenesis.json --permissions-nodes-enabled --permissions-accounts-enabled --rpc-http-enabled --rpc-http-api=ADMIN,ETH,NET,PERM,CLIQUE --host-whitelist=* --rpc-http-cors-origins=*
pantheon --data-path=data --genesis-file=..\cliqueGenesis.json --permissions-nodes-enabled --permissions-accounts-enabled --rpc-http-enabled --rpc-http-api=ADMIN,ETH,NET,PERM,CLIQUE --host-whitelist=* --rpc-http-cors-origins=*
```
!!!note
@@ -235,18 +226,18 @@ and [`--permissions-accounts-enabled`](../Reference/Pantheon-CLI-Syntax.md#permi
* All domains can access the node using the HTTP JSON-RPC API using the [`--rpc-http-cors-origins`](../Reference/Pantheon-CLI-Syntax.md#rpc-http-cors-origins) option.
### 8. Start Node-2
### 7. Start Node-2
You need the [enode URL](../Configuring-Pantheon/Node-Keys.md#enode-url) for Node-1 to specify Node-1 as a bootnode.
Start another terminal, change to the `Node-2` directory and start Node-2 replacing the public key in the enode URL with your bootonde:
```bash tab="MacOS"
pantheon --data-path=Node-2-data-path --bootnodes="enode://<publicKeyNode1 ex 0x>@127.0.0.1:30303" --genesis-file=../cliqueGenesis.json --permissions-nodes-enabled --permissions-accounts-enabled --rpc-http-enabled --rpc-http-api=ADMIN,ETH,NET,PERM,CLIQUE --host-whitelist=* --rpc-http-cors-origins=* --p2p-port=30304 --rpc-http-port=8546
pantheon --data-path=data --bootnodes="enode://<publicKeyNode1 ex 0x>@127.0.0.1:30303" --genesis-file=../cliqueGenesis.json --permissions-nodes-enabled --permissions-accounts-enabled --rpc-http-enabled --rpc-http-api=ADMIN,ETH,NET,PERM,CLIQUE --host-whitelist=* --rpc-http-cors-origins=* --p2p-port=30304 --rpc-http-port=8546
```
```bash tab="Windows"
pantheon --data-path=Node-2-data-path --bootnodes="enode://<publicKeyNode1 ex 0x>@127.0.0.1:30303" --genesis-file=..\cliqueGenesis.json --permissions-nodes-enabled --permissions-accounts-enabled --rpc-http-enabled --rpc-http-api=ADMIN,ETH,NET,PERM,CLIQUE --host-whitelist=* --rpc-http-cors-origins=* --p2p-port=30304 --rpc-http-port=8546
pantheon --data-path=data --bootnodes="enode://<publicKeyNode1 ex 0x>@127.0.0.1:30303" --genesis-file=..\cliqueGenesis.json --permissions-nodes-enabled --permissions-accounts-enabled --rpc-http-enabled --rpc-http-api=ADMIN,ETH,NET,PERM,CLIQUE --host-whitelist=* --rpc-http-cors-origins=* --p2p-port=30304 --rpc-http-port=8546
```
The command line specifies:
@@ -258,16 +249,16 @@ The command line specifies:
* Other options as for as for Node-1.
### 9. Start Node-3
### 8. Start Node-3
Start another terminal, change to the `Node-3` directory and start Node-3 replacing the public key in the enode URL with your bootonde:
```bash tab="MacOS"
pantheon --data-path=Node-3-data-path --bootnodes="enode://<publicKeyNode1 ex 0x>@127.0.0.1:30303" --genesis-file=../cliqueGenesis.json --permissions-nodes-enabled --permissions-accounts-enabled --rpc-http-enabled --rpc-http-api=ADMIN,ETH,NET,PERM,CLIQUE --host-whitelist=* --rpc-http-cors-origins=* --p2p-port=30305 --rpc-http-port=8547
pantheon --data-path=data --bootnodes="enode://<publicKeyNode1 ex 0x>@127.0.0.1:30303" --genesis-file=../cliqueGenesis.json --permissions-nodes-enabled --permissions-accounts-enabled --rpc-http-enabled --rpc-http-api=ADMIN,ETH,NET,PERM,CLIQUE --host-whitelist=* --rpc-http-cors-origins=* --p2p-port=30305 --rpc-http-port=8547
```
```bash tab="Windows"
pantheon --data-path=Node-3-data-path --bootnodes="enode://<publicKeyNode1 ex 0x>@127.0.0.1:30303" --genesis-file=..\cliqueGenesis.json --permissions-nodes-enabled --permissions-accounts-enabled --rpc-http-enabled --rpc-http-api=ADMIN,ETH,NET,PERM,CLIQUE --host-whitelist=* --rpc-http-cors-origins=* --p2p-port=30305 --rpc-http-port=8547
pantheon --data-path=data --bootnodes="enode://<publicKeyNode1 ex 0x>@127.0.0.1:30303" --genesis-file=..\cliqueGenesis.json --permissions-nodes-enabled --permissions-accounts-enabled --rpc-http-enabled --rpc-http-api=ADMIN,ETH,NET,PERM,CLIQUE --host-whitelist=* --rpc-http-cors-origins=* --p2p-port=30305 --rpc-http-port=8547
```
The command line specifies:
@@ -278,7 +269,7 @@ The command line specifies:
* Data directory for Node-3 using the [`--data-path`](../Reference/Pantheon-CLI-Syntax.md#data-path) option
* Other options as for as for Node-1.
### 10. Confirm Permissioned Network is Working
### 9. Confirm Permissioned Network is Working
#### Check Peer Count
@@ -320,17 +311,17 @@ Import the last account from the genesis file into MetaMask and try to send a tr
### Start a Node Not on the Nodes Whitelist
In your `Permissioned-Network` directory, create a `Node-4` directory and `Node-4-data-path` directory inside it.
In your `Permissioned-Network` directory, create a `Node-4` directory and `data` directory inside it.
Change to the `Node-4` directory and start Node-4 replacing the public key in the enode URL with your bootnode as when
starting Node-1 and Node-2:
```bash tab="MacOS"
pantheon --data-path=Node-4-data-path --bootnodes="enode://<publicKeyNode1 ex 0x>@127.0.0.1:30303" --genesis-file=../cliqueGenesis.json --rpc-http-enabled --rpc-http-api=ADMIN,ETH,NET,PERM,CLIQUE --host-whitelist=* --rpc-http-cors-origins=* --p2p-port=30306 --rpc-http-port=8548
pantheon --data-path=data --bootnodes="enode://<publicKeyNode1 ex 0x>@127.0.0.1:30303" --genesis-file=../cliqueGenesis.json --rpc-http-enabled --rpc-http-api=ADMIN,ETH,NET,PERM,CLIQUE --host-whitelist=* --rpc-http-cors-origins=* --p2p-port=30306 --rpc-http-port=8548
```
```bash tab="Windows"
pantheon --data-path=Node-4-data-path --bootnodes="enode://<publicKeyNode1 ex 0x>@127.0.0.1:30303" --genesis-file=..\cliqueGenesis.json --rpc-http-enabled --rpc-http-api=ADMIN,ETH,NET,PERM,CLIQUE --host-whitelist=* --rpc-http-cors-origins=* --p2p-port=30306 --rpc-http-port=8548
pantheon --data-path=data --bootnodes="enode://<publicKeyNode1 ex 0x>@127.0.0.1:30303" --genesis-file=..\cliqueGenesis.json --rpc-http-enabled --rpc-http-api=ADMIN,ETH,NET,PERM,CLIQUE --host-whitelist=* --rpc-http-cors-origins=* --p2p-port=30306 --rpc-http-port=8548
```
Start another terminal, use curl to call the JSON-RPC API [`net_peerCount`](../Reference/JSON-RPC-API-Methods.md#net_peercount) method:
@@ -353,4 +344,4 @@ The result confirms Node-4 has no peers even though it specifies Node-1 as a boo
When finished using the permissioned network, stop all nodes using ++ctrl+c++ in each terminal window.
!!!tip
To restart the permissioned network in the future, start from [7. Start First Node as Bootnode](#7-restart-first-node-as-bootnode).
To restart the permissioned network in the future, start from [6. Start First Node as Bootnode](#6-start-first-node-as-bootnode).

View File

@@ -18,14 +18,12 @@ consensus protocol](../Consensus-Protocols/Clique.md).
To create a private network:
1. [Create Folders](#1-create-folders)
1. [Get Public Key for Node-1](#2-get-public-key-for-node-1)
1. [Get Address for Node-1](#3-get-address-for-node-1)
1. [Create Genesis File](#4-create-genesis-file)
1. [Delete Database Directory](#5-delete-database-directory)
1. [Start First Node as Bootnode](#6-start-first-node-as-bootnode)
1. [Start Node-2](#7-start-node-2)
1. [Start Node-3](#8-start-node-3)
1. [Confirm Private Network is Working](#9-confirm-private-network-is-working)
1. [Get Address for Node-1](#2-get-address-for-node-1)
1. [Create Genesis File](#3-create-genesis-file)
1. [Start First Node as Bootnode](#4-start-first-node-as-bootnode)
1. [Start Node-2](#5-start-node-2)
1. [Start Node-3](#6-start-node-3)
1. [Confirm Private Network is Working](#7-confirm-private-network-is-working)
### 1. Create Folders
@@ -36,61 +34,30 @@ Create directories for your private network, each of the three nodes, and a data
```bash
Clique-Network/
├── Node-1
│   ├── Node-1-data-path
│   ├── data
├── Node-2
│   ├── Node-2-data-path
│   ├── data
└── Node-3
├── Node-3-data-path
├── data
```
### 2. Get Public Key for Node-1
To enable nodes to discover each other, a network requires one or more bootnodes.
For this private network, we will use Node-1 as the bootnode. This requires obtaining the public key for the [enode URL](../Configuring-Pantheon/Node-Keys.md#enode-url).
In the `Node-1` directory, use the [`public-key`](../Reference/Pantheon-CLI-Syntax.md#public-key) subcommand to write
the [node public key](../Configuring-Pantheon/Node-Keys.md) to the specified file (`publicKeyNode1` in this example):
```bash tab="MacOS"
pantheon --data-path=Node-1-data-path public-key export --to=Node-1-data-path/publicKeyNode1
```
```bash tab="Windows"
pantheon --data-path=Node-1-data-path public-key export --to=Node-1-data-path\publicKeyNode1
```
!!!note
The [`--data-path`](../Reference/Pantheon-CLI-Syntax.md#data-path) option is not used when running
Pantheon from the [Docker image](../Getting-Started/Run-Docker-Image.md). Use a volume to
[specify the data directory](../Getting-Started/Run-Docker-Image.md#data-directory).
Your node 1 directory now contains:
```bash
├── Node-1
   ├── Node-1-data-path
├── database
      ├── key
      ├── publicKeyNode1
```
The `database` directory contains the blockchain data.
### 3. Get Address for Node-1
### 2. Get Address for Node-1
In Clique networks, the address of at least one initial signer must be included in the genesis file.
For this Clique network, we will use Node-1 as the initial signer. This requires obtaining the address for Node-1.
To obtain the address for Node-1, in the `Node-1` directory, use the [`public-key export-address`](../Reference/Pantheon-CLI-Syntax.md#public-key)
subcommand to write the node address to the specified file (`nodeAddress1` in this example)
subcommand to write the node address to the specified file (`node1Address` in this example)
```bash tab="MacOS"
pantheon --data-path=Node-1-data-path public-key export-address --to=Node-1-data-path/nodeAddress1
pantheon --data-path=data public-key export-address --to=data/node1Address
```
```bash tab="Windows"
pantheon --data-path=Node-1-data-path public-key export-address --to=Node-1-data-path\nodeAddress1
pantheon --data-path=data public-key export-address --to=data\node1Address
```
### 4. Create Genesis File
### 3. Create Genesis File
The genesis file defines the genesis block of the blockchain (that is, the start of the blockchain).
The [Clique genesis file](../Consensus-Protocols/Clique.md#genesis-file) includes the address of Node-1 as the initial signer in the `extraData` field.
@@ -140,7 +107,7 @@ Copy the following genesis definition to a file called `cliqueGenesis.json` and
}
```
In `extraData`, replace `<Node 1 Address>` with the [address for Node-1](#3-get-address-for-node-1) excluding the 0x prefix.
In `extraData`, replace `<Node 1 Address>` with the [address for Node-1](#2-get-address-for-node-1) excluding the 0x prefix.
!!! example
@@ -157,21 +124,16 @@ In `extraData`, replace `<Node 1 Address>` with the [address for Node-1](#3-get-
The private keys are displayed which means the accounts are not secure.
### 5. Delete Database Directory
Delete the `database` directory created when [getting the public key for Node-1](#2-get-public-key-for-node-1).
The node cannot be started with the Clique genesis file while the previously generated data is in the `database` directory.
### 6. Start First Node as Bootnode
### 4. Start First Node as Bootnode
Start Node-1:
```bash tab="MacOS"
pantheon --data-path=Node-1-data-path --genesis-file=../cliqueGenesis.json --bootnodes --network-id 123 --rpc-http-enabled --rpc-http-api=ETH,NET,CLIQUE --host-whitelist=* --rpc-http-cors-origins="all"
pantheon --data-path=data --genesis-file=../cliqueGenesis.json --bootnodes --network-id 123 --rpc-http-enabled --rpc-http-api=ETH,NET,CLIQUE --host-whitelist=* --rpc-http-cors-origins="all"
```
```bash tab="Windows"
pantheon --data-path=Node-1-data-path --genesis-file=..\cliqueGenesis.json --bootnodes --network-id 123 --rpc-http-enabled --rpc-http-api=ETH,NET,CLIQUE --host-whitelist=* --rpc-http-cors-origins="all"
pantheon --data-path=data --genesis-file=..\cliqueGenesis.json --bootnodes --network-id 123 --rpc-http-enabled --rpc-http-api=ETH,NET,CLIQUE --host-whitelist=* --rpc-http-cors-origins="all"
```
!!!note
@@ -187,18 +149,21 @@ The command line specifies:
* All hosts can access the HTTP JSON-RPC API using the [`--host-whitelist`](../Reference/Pantheon-CLI-Syntax.md#host-whitelist) option
* All domains can access the node using the HTTP JSON-RPC API using the [`--rpc-http-cors-origins`](../Reference/Pantheon-CLI-Syntax.md#rpc-http-cors-origins) option
### 7. Start Node-2
When the node starts, the [enode URL](../Configuring-Pantheon/Node-Keys.md#enode-url) is displayed.
Copy the enode URL to specify Node-1 as the bootnode in the following steps.
You need the [enode URL](../Configuring-Pantheon/Node-Keys.md#enode-url) for Node-1 to specify Node-1 as a bootnode.
![Node 1 Enode URL](../images/EnodeStartup.png)
Start another terminal, change to the `Node-2` directory and start Node-2 replacing the enode URL with your bootonde:
### 5. Start Node-2
Start another terminal, change to the `Node-2` directory and start Node-2 specifying the Node-1 enode URL copied when starting Node-1 as the bootnode:
```bash tab="MacOS"
pantheon --data-path=Node-2-data-path --genesis-file=../cliqueGenesis.json --bootnodes="enode://<node public key ex 0x>@127.0.0.1:30303" --network-id 123 --p2p-port=30304 --rpc-http-enabled --rpc-http-api=ETH,NET,CLIQUE --host-whitelist=* --rpc-http-cors-origins="all" --rpc-http-port=8546
pantheon --data-path=data --genesis-file=../cliqueGenesis.json --bootnodes=<Node-1 Enode URL> --network-id 123 --p2p-port=30304 --rpc-http-enabled --rpc-http-api=ETH,NET,CLIQUE --host-whitelist=* --rpc-http-cors-origins="all" --rpc-http-port=8546
```
```bash tab="Windows"
pantheon --data-path=Node-2-data-path --genesis-file=..\cliqueGenesis.json --bootnodes="enode://<node public key ex 0x>@127.0.0.1:30303" --network-id 123 --p2p-port=30304 --rpc-http-enabled --rpc-http-api=ETH,NET,CLIQUE --host-whitelist=* --rpc-http-cors-origins="all" --rpc-http-port=8546
pantheon --data-path=data --genesis-file=..\cliqueGenesis.json --bootnodes=<Node-1 Enode URL> --network-id 123 --p2p-port=30304 --rpc-http-enabled --rpc-http-api=ETH,NET,CLIQUE --host-whitelist=* --rpc-http-cors-origins="all" --rpc-http-port=8546
```
The command line specifies:
@@ -210,16 +175,16 @@ The command line specifies:
* Other options as for [Node-1](#5-start-first-node-as-bootnode).
### 8. Start Node-3
### 6. Start Node-3
Start another terminal, change to the `Node-3` directory and start Node-3 replacing the enode URL with your bootnode:
Start another terminal, change to the `Node-3` directory and start Node-3 specifying the Node-1 enode URL copied when starting Node-1 as the bootnode:
```bash tab="MacOS"
pantheon --data-path=Node-3-data-path --genesis-file=../cliqueGenesis.json --bootnodes="enode://<node public key ex 0x>@127.0.0.1:30303" --network-id 123 --p2p-port=30305 --rpc-http-enabled --rpc-http-api=ETH,NET,CLIQUE --host-whitelist=* --rpc-http-cors-origins="all" --rpc-http-port=8547
pantheon --data-path=data --genesis-file=../cliqueGenesis.json --bootnodes=<Node-1 Enode URL> --network-id 123 --p2p-port=30305 --rpc-http-enabled --rpc-http-api=ETH,NET,CLIQUE --host-whitelist=* --rpc-http-cors-origins="all" --rpc-http-port=8547
```
```bash tab="Windows"
pantheon --data-path=Node-3-data-path --genesis-file=..\cliqueGenesis.json --bootnodes="enode://<node public key ex 0x>@127.0.0.1:30303" --network-id 123 --p2p-port=30305 --rpc-http-enabled --rpc-http-api=ETH,NET,CLIQUE --host-whitelist=* --rpc-http-cors-origins="all" --rpc-http-port=8547
pantheon --data-path=data --genesis-file=..\cliqueGenesis.json --bootnodes=<Node-1 Enode URL> --network-id 123 --p2p-port=30305 --rpc-http-enabled --rpc-http-api=ETH,NET,CLIQUE --host-whitelist=* --rpc-http-cors-origins="all" --rpc-http-port=8547
```
The command line specifies:
@@ -230,7 +195,7 @@ The command line specifies:
* Bootnode as for [Node-2](#6-start-node-2).
* Other options as for [Node-1](#5-start-first-node-as-bootnode).
### 9. Confirm Private Network is Working
### 7. Confirm Private Network is Working
Start another terminal, use curl to call the JSON-RPC API [`net_peerCount`](../Reference/JSON-RPC-API-Methods.md#net_peercount) method and confirm the nodes are functioning as peers:
@@ -266,4 +231,4 @@ Import accounts to MetaMask and send transactions as described in the [Private N
When finished using the private network, stop all nodes using ++ctrl+c++ in each terminal window.
!!!tip
To restart the Clique network in the future, start from [6. Start First Node as Bootnode](#6-start-first-node-as-bootnode).
To restart the Clique network in the future, start from [4. Start First Node as Bootnode](#4-start-first-node-as-bootnode).

View File

@@ -21,11 +21,10 @@ To create a private network:
1. [Create Folders](#1-create-folders)
1. [Create Genesis File](#2-create-genesis-file)
1. [Get Public Key of First Node](#3-get-public-key-of-first-node)
1. [Start First Node as Bootnode](#4-restart-first-node-as-bootnode)
1. [Start Node-2](#5-start-node-2)
1. [Start Node-3](#6-start-node-3)
1. [Confirm Private Network is Working](#7-confirm-private-network-is-working)
1. [Start First Node as Bootnode](#3-start-first-node-as-bootnode)
1. [Start Node-2](#4-start-node-2)
1. [Start Node-3](#5-start-node-3)
1. [Confirm Private Network is Working](#6-confirm-private-network-is-working)
### 1. Create Folders
@@ -36,11 +35,11 @@ Create directories for your private network, each of the three nodes, and a data
```bash
Private-Network/
├── Node-1
│   ├── Node-1-data-path
│   ├── data
├── Node-2
│   ├── Node-2-data-path
│   ├── data
└── Node-3
├── Node-3-data-path
├── data
```
### 2. Create Genesis File
@@ -85,49 +84,16 @@ Copy the following genesis definition to a file called `privateNetworkGenesis.js
Do not use the accounts in the genesis file above on mainnet or any public network except for testing.
The private keys are displayed so the accounts are not secure.
### 3. Get Public Key of First Node
To enable nodes to discover each other, a network requires one or more nodes to be bootnodes.
For this private network, we will use Node-1 as the bootnode. This requires obtaining the public key for the [enode URL](../Configuring-Pantheon/Node-Keys.md#enode-url).
In the `Node-1` directory, use the [`public-key` subcommand](../Reference/Pantheon-CLI-Syntax.md#public-key) to write
the [node public key](../Configuring-Pantheon/Node-Keys.md#node-public-key) to the specified file (`publicKeyNode1` in this example):
```bash tab="MacOS"
pantheon --data-path=Node-1-data-path --genesis-file=../privateNetworkGenesis.json public-key export --to=Node-1-data-path/publicKeyNode1
```
```bash tab="Windows"
pantheon --data-path=Node-1-data-path --genesis-file=..\privateNetworkGenesis.json public-key export --to=Node-1-data-path\publicKeyNode1
```
!!!note
The [`--data-path`](../Reference/Pantheon-CLI-Syntax.md#data-path) and [`--genesis-file`](../Reference/Pantheon-CLI-Syntax.md#genesis-file)
options are not used when running Pantheon from the [Docker image](../Getting-Started/Run-Docker-Image.md).
Use a bind mount to [specify a configuration file with Docker](../Getting-Started/Run-Docker-Image.md#custom-genesis-file)
and volume to [specify the data directory](../Getting-Started/Run-Docker-Image.md#data-directory).
Your node 1 directory now contains:
```bash
├── Node-1
   ├── Node-1-data-path
├── database
      ├── key
      ├── publicKeyNode1
```
The `database` directory contains the blockchain data.
### 4. Start First Node as Bootnode
### 3. Start First Node as Bootnode
Start Node-1:
```bash tab="MacOS"
pantheon --data-path=Node-1-data-path --genesis-file=../privateNetworkGenesis.json --bootnodes --miner-enabled --miner-coinbase fe3b557e8fb62b89f4916b721be55ceb828dbd73 --rpc-http-enabled --host-whitelist=* --rpc-http-cors-origins="all"
pantheon --data-path=data --genesis-file=../privateNetworkGenesis.json --bootnodes --miner-enabled --miner-coinbase fe3b557e8fb62b89f4916b721be55ceb828dbd73 --rpc-http-enabled --host-whitelist=* --rpc-http-cors-origins="all"
```
```bash tab="Windows"
pantheon --data-path=Node-1-data-path --genesis-file=..\privateNetworkGenesis.json --bootnodes --miner-enabled --miner-coinbase fe3b557e8fb62b89f4916b721be55ceb828dbd73 --rpc-http-enabled --host-whitelist=* --rpc-http-cors-origins="all"
pantheon --data-path=data --genesis-file=..\privateNetworkGenesis.json --bootnodes --miner-enabled --miner-coinbase fe3b557e8fb62b89f4916b721be55ceb828dbd73 --rpc-http-enabled --host-whitelist=* --rpc-http-cors-origins="all"
```
The command line specifies:
@@ -142,18 +108,21 @@ and [`--miner-coinbase`](../Reference/Pantheon-CLI-Syntax.md#miner-coinbase) opt
!!! info
The miner coinbase account is one of the accounts defined in the genesis file.
### 5. Start Node-2
When the node starts, the [enode URL](../Configuring-Pantheon/Node-Keys.md#enode-url) is displayed.
Copy the enode URL to specify Node-1 as the bootnode in the following steps.
You need the [enode URL](../Configuring-Pantheon/Node-Keys.md#enode-url) for Node-1 to specify Node-1 as the bootnode for Node-2 and Node-3.
![Node 1 Enode URL](../images/EnodeStartup.png)
Start another terminal, change to the `Node-2` directory and start Node-2 replacing the enode URL with your bootnode:
### 4. Start Node-2
Start another terminal, change to the `Node-2` directory and start Node-2 specifying the Node-1 enode URL copied when starting Node-1 as the bootnode:
```bash tab="MacOS"
pantheon --data-path=Node-2-data-path --genesis-file=../privateNetworkGenesis.json --bootnodes="enode://<node public key ex 0x>@127.0.0.1:30303" --p2p-port=30304
pantheon --data-path=data --genesis-file=../privateNetworkGenesis.json --bootnodes=<Node-1 Enode URL> --p2p-port=30304
```
```bash tab="Windows"
pantheon --data-path=Node-2-data-path --genesis-file=..\privateNetworkGenesis.json --bootnodes="enode://<node public key ex 0x>@127.0.0.1:30303" --p2p-port=30304
pantheon --data-path=data --genesis-file=..\privateNetworkGenesis.json --bootnodes=<Node-1 Enode URL> --p2p-port=30304
```
The command line specifies:
@@ -163,16 +132,16 @@ The command line specifies:
* Data directory for Node-2 using the [`--data-path`](../Reference/Pantheon-CLI-Syntax.md#data-path) option.
* Genesis file as for Node-1.
### 6. Start Node-3
### 5. Start Node-3
Start another terminal, change to the `Node-3` directory and start Node-3 replacing the enode URL with your bootnode:
Start another terminal, change to the `Node-3` directory and start Node-3 specifying the Node-1 enode URL copied when starting Node-1 as the bootnode:
```bash tab="MacOS"
pantheon --data-path=Node-3-data-path --genesis-file=../privateNetworkGenesis.json --bootnodes="enode://<node public key ex 0x>@127.0.0.1:30303" --p2p-port30305
pantheon --data-path=data --genesis-file=../privateNetworkGenesis.json --bootnodes=<Node-1 Enode URL> --p2p-port=30305
```
```bash tab="Windows"
pantheon --data-path=Node-3-data-path --genesis-file=..\privateNetworkGenesis.json --bootnodes="enode://<node public key ex 0x>@127.0.0.1:30303" --p2p-port=30305
pantheon --data-path=data --genesis-file=..\privateNetworkGenesis.json --bootnodes=<Node-1 Enode URL> --p2p-port=30305
```
The command line specifies:
@@ -181,7 +150,7 @@ The command line specifies:
* Data directory for Node-3 using the [`--data-path`](../Reference/Pantheon-CLI-Syntax.md#data-path) option.
* Bootnode and genesis file as for Node-2.
### 7. Confirm Private Network is Working
### 6. Confirm Private Network is Working
Start another terminal, use curl to call the JSON-RPC API [`net_peerCount`](../Reference/JSON-RPC-API-Methods.md#net_peercount) method and confirm the nodes are functioning as peers:
@@ -216,4 +185,4 @@ Start a node with the [`--rpc-ws-enabled`](../Reference/Pantheon-CLI-Syntax.md#r
When finished using the private network, stop all nodes using ++ctrl+c++ in each terminal window.
!!!tip
To restart the private network in the future, start from [4. Restart First Node as Bootnode](#4-restart-first-node-as-bootnode).
To restart the private network in the future, start from [3. Start First Node as Bootnode](#3-start-first-node-as-bootnode).

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB