Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

Nc 2026 network option #645

Merged
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/
package tech.pegasys.pantheon.tests.acceptance.dsl.node;

import static tech.pegasys.pantheon.cli.EthNetworkConfig.mainnet;
import static tech.pegasys.pantheon.cli.NetworkName.MAINNET;

import tech.pegasys.pantheon.Runner;
import tech.pegasys.pantheon.RunnerBuilder;
Expand Down Expand Up @@ -55,7 +55,10 @@ public void startNode(final PantheonNode node) {
final PantheonControllerBuilder builder = new PantheonControllerBuilder();
final EthNetworkConfig ethNetworkConfig =
node.ethNetworkConfig()
.orElse(new EthNetworkConfig.Builder(mainnet()).setNetworkId(NETWORK_ID).build());
.orElse(
new EthNetworkConfig.Builder(EthNetworkConfig.getNetworkConfig(MAINNET))
.setNetworkId(NETWORK_ID)
.build());
final PantheonController<?> pantheonController;
try {
pantheonController =
Expand Down
12 changes: 8 additions & 4 deletions docs/Configuring-Pantheon/Accounts-for-Testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,22 @@ description: Ethereum accounts used for testing only on private network

# Accounts for Testing

You can use existing accounts for testing by including them in the genesis file for a private network. Alternatively, Pantheon provides predefined accounts in development mode.
You can use existing accounts for testing by including them in the genesis file for a private network.
Alternatively, Pantheon provides predefined accounts in development mode.

## Development Mode

When you start Pantheon with the [`--dev-mode`](/Reference/Pantheon-CLI-Syntax/#dev-mode) command line option, the `dev.json` genesis file is used by default.
When you start Pantheon with the [`--network=dev`](../Reference/Pantheon-CLI-Syntax.md#network)
command line option, the `dev.json` genesis file is used by default.

The `dev.json` genesis file defines the accounts below that can be used for testing.

{!global/test_accounts.md!}

## Genesis File

To use existing test accounts, specify the accounts and balances in a genesis file for your test network. For an example of defining accounts in the genesis file, refer to [`dev.json`](https://github.com/PegaSysEng/pantheon/blob/master/config/src/main/resources/dev.json).
To use existing test accounts, specify the accounts and balances in a genesis file for your test network.
For an example of defining accounts in the genesis file, refer to [`dev.json`](https://github.com/PegaSysEng/pantheon/blob/master/config/src/main/resources/dev.json).

Use the [`--genesis`](/Reference/Pantheon-CLI-Syntax/#genesis) command line option to start Pantheon with the genesis file defining the existing accounts.
Use the [`--genesis-file`](../Reference/Pantheon-CLI-Syntax.md#genesis-file) command line option to
start Pantheon with the genesis file defining the existing accounts.
27 changes: 19 additions & 8 deletions docs/Configuring-Pantheon/Logging.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,16 @@ Pantheon uses Log4J2 for logging. There are two methods to configure logging beh

## Basic Log Level Setting

Use the [`--logging`](../Reference/Pantheon-CLI-Syntax.md#logging) command line option to specify the logging verbosity. The [`--logging`](../Reference/Pantheon-CLI-Syntax.md#logging) option changes the volume of events displayed in the log.
Use the [`--logging`](../Reference/Pantheon-CLI-Syntax.md#logging) command line option to specify
the logging verbosity. The [`--logging`](../Reference/Pantheon-CLI-Syntax.md#logging) option changes
the volume of events displayed in the log.

## Advanced Custom Logging

You can provide your own logging configuration using the standard Log4J2 configuration mechanisms. For example, the following Log4J2 configuration is the same as the [default configuration](https://github.com/PegaSysEng/pantheon/blob/master/pantheon/src/main/resources/log4j2.xml) except logging of stack traces for exceptions is excluded.
You can provide your own logging configuration using the standard Log4J2 configuration mechanisms.
For example, the following Log4J2 configuration is the same as the
[default configuration](https://github.com/PegaSysEng/pantheon/blob/master/pantheon/src/main/resources/log4j2.xml)
except logging of stack traces for exceptions is excluded.

```xml tab="log4j2.xml"
<?xml version="1.0" encoding="UTF-8"?>
Expand All @@ -41,12 +46,18 @@ You can provide your own logging configuration using the standard Log4J2 configu
</Configuration>
```

To use your custom configuration, set the environment variable `LOG4J_CONFIGURATION_FILE` to the location of your configuration file.
To use your custom configuration, set the environment variable `LOG4J_CONFIGURATION_FILE` to the
location of your configuration file.

If you have more specific requirements, you can create your own [log4j2 configuration](https://logging.apache.org/log4j/2.x/manual/configuration.html).
If you have more specific requirements, you can create your own
[log4j2 configuration](https://logging.apache.org/log4j/2.x/manual/configuration.html).

For Bash-based executions, you can set the variable for only the scope of the program execution by setting it before starting Pantheon. For example, to set the debug logging and start Pantheon connected to the Rinkeby testnet:
For Bash-based executions, you can set the variable for only the scope of the program execution by
setting it before starting Pantheon.

```bash
$ LOG4J_CONFIGURATION_FILE=./debug.xml bin/pantheon --rinkeby
```
!!!example
To set the debug logging and start Pantheon connected to the Rinkeby testnet:

```bash
$ LOG4J_CONFIGURATION_FILE=./debug.xml bin/pantheon --network=rinkeby
```
18 changes: 14 additions & 4 deletions docs/Configuring-Pantheon/NetworkID-And-ChainID.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,21 @@ description: Pantheon network ID and chain ID implementation

# Network ID and Chain ID

Ethereum networks have a **network ID** and a **chain ID**. The network ID is specified using the [`--network-id`](../Reference/Pantheon-CLI-Syntax.md#network-id) option and the chain ID is specified in the genesis file.
Ethereum networks have a **network ID** and a **chain ID**. The network ID can be specified using the
[`--network-id`](../Reference/Pantheon-CLI-Syntax.md#network-id) option and the chain ID is specified
in the genesis file.

For most networks including mainnet and the public testnets, the network ID and the chain ID are the same.
For most networks including MainNet and the public testnets, the network ID and the chain ID are the
same and Pantheon network id default values are defined according to the genesis chain id value.

The network ID is automatically set by Pantheon when connecting to the Ethereum mainnet ==1==, Rinkeby ==4==, and Ropsten ==3==.
The network ID is automatically set by Pantheon to the chain ID when connecting to the Ethereum networks:

When using the [`--dev-mode`](../Reference/Pantheon-CLI-Syntax.md#dev-mode) or [`--genesis`](../Reference/Pantheon-CLI-Syntax.md#genesis) options, specify the network ID using the [`--network-id`](../Reference/Pantheon-CLI-Syntax.md#network-id) option.
- **MainNet:** chain-id ==1==, network-id ==1==
- **Rinkeby:** chain-id ==4==, network-id ==4==
- **Ropsten:** chain-id ==3==, network-id ==3==
- **Dev:** chain-id ==2018==, network-id ==2018==

When using the [`--network=dev`](../Reference/Pantheon-CLI-Syntax.md#network) or
[`--genesis-file`](../Reference/Pantheon-CLI-Syntax.md#genesis-file) options, you can override the
network ID using the [`--network-id`](../Reference/Pantheon-CLI-Syntax.md#network-id) option.

4 changes: 3 additions & 1 deletion docs/Configuring-Pantheon/Networking.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ If connections are not getting through the firewalls, ensure the peer discovery

## Peer Discovery Port

The [`--p2p-listen`](../Reference/Pantheon-CLI-Syntax.md#p2p-listen) option specifies the host and port on which P2P peer discovery listens. The default is ==127.0.0.1:30303==.
The [`--p2p-host`](../Reference/Pantheon-CLI-Syntax.md#p2p-host) and [`--p2p-port`](../Reference/Pantheon-CLI-Syntax.md#p2p-port)
options specifies the host and port on which P2P peer discovery listens. The default is ==127.0.0.1==
for host and ==30303== for port.

## Limiting Peers

Expand Down
2 changes: 1 addition & 1 deletion docs/Configuring-Pantheon/Passing-JVM-Options.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ For Bash-based executions, you can set the variable for only the scope of the pr
!!! example
```bash
$ PANTHEON_OPTS=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 \
$ bin/pantheon --rinkeby
$ bin/pantheon --network=rinkeby
```
24 changes: 14 additions & 10 deletions docs/Configuring-Pantheon/Testing-Developing-Nodes.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,41 +21,45 @@ To start a bootnode for a private network:

!!! example
```bash
pantheon --genesis=privateNetworkGenesis.json --datadir=nodeDataDir export-pub-key bootnode
pantheon --genesis-file=privateNetworkGenesis.json --data-path=nodeDataPath export-pub-key bootnode
```
Where `privateNetworkGenesis.json` and `nodeDataDir` are changed to the relevant values for
Where `privateNetworkGenesis.json` and `nodeDataPath` are changed to the relevant values for
your private network.

The node public key is exported to the `bootnode` file.

2. Start the bootnode, specifying:

* No arguments for the [`--bootnodes` option](../Reference/Pantheon-CLI-Syntax.md#bootnodes) because this is the bootnode.
* Network ID for your private network.
* Genesis file and data directory as in the previous step.

!!! example
```
pantheon --bootnodes --genesis=privateNetworkGenesis.json --datadir=nodeDataDir --network-id 123
pantheon --genesis-file=privateNetworkGenesis.json --data-path=nodeDataPath
```

To specify this bootnode for another node, the enode URL for the `--bootnodes` option is `enode://<id>@<host:port>` where:
To specify this bootnode for another node, the enode URL for the [`--bootnodes`](../Reference/Pantheon-CLI-Syntax.md#bootnodes)
option is `enode://<id>@<host:port>` where:

* `<id>` is the node public key written to the specified file (`bootnode` in the above example) excluding the initial 0x.
* `<host:port>` is the host and port the bootnode is listening on for P2P peer discovery. Specified by the `--p2p-listen` option for the bootnode (default is `127.0.0.1:30303`).
* `<host:port>` is the host and port the bootnode is listening on for P2P peer discovery.
Specified by the [`--p2p-host` option](../Reference/Pantheon-CLI-Syntax.md#p2p-host) and
[`--p2p-port` option](../Reference/Pantheon-CLI-Syntax.md#p2p-port) option for the bootnode
(default host is `127.0.0.1` and port is `30303`).

!!! example
If the `--p2p-listen` option is not specified and the node public key exported is `0xc35c3ec90a8a51fd5703594c6303382f3ae6b2ecb9589bab2c04b3794f2bc3fc2631dabb0c08af795787a6c004d8f532230ae6e9925cbbefb0b28b79295d615f`
If the [`--p2p-host`](../Reference/Pantheon-CLI-Syntax.md#p2p-host) or [`--p2p-port`](../Reference/Pantheon-CLI-Syntax.md#p2p-port) options are not specified and the node public key exported is `0xc35c3ec90a8a51fd5703594c6303382f3ae6b2ecb9589bab2c04b3794f2bc3fc2631dabb0c08af795787a6c004d8f532230ae6e9925cbbefb0b28b79295d615f`

The enode URL is:
`enode://c35c3ec90a8a51fd5703594c6303382f3ae6b2ecb9589bab2c04b3794f2bc3fc2631dabb0c08af795787a6c004d8f532230ae6e9925cbbefb0b28b79295d615f@127.0.0.1:30303`

!!! info
The default host and port for P2P peer discovery is `127.0.0.1:30303`. Use the `--p2p-listen` option to specify a host and port.
The default host and port for P2P peer discovery is `127.0.0.1:30303`.
Use the [`--p2p-host`](../Reference/Pantheon-CLI-Syntax.md#p2p-host) and
[`--p2p-port`](../Reference/Pantheon-CLI-Syntax.md#p2p-port) option to specify a host and port.

To start a node specifying the bootnode for P2P discovery:

!!! example
```bash
pantheon --genesis=privateNetworkGenesis.json --datadir=nodeDataDir --p2p-listen=127.0.0.1:30301 --network-id=123 --bootnodes=enode://c35c3ec90a8a51fd5703594c6303382f3ae6b2ecb99bab2c04b3794f2bc3fc2631dabb0c08af795787a6c004d8f532230ae6e9925cbbefb0b28b79295d615f@127.0.0.1:30303
pantheon --genesis-file=privateNetworkGenesis.json --data-path=nodeDataPath --p2p-host=127.0.0.1 --p2p-port=30301 --network-id=123 --bootnodes=enode://c35c3ec90a8a51fd5703594c6303382f3ae6b2ecb99bab2c04b3794f2bc3fc2631dabb0c08af795787a6c004d8f532230ae6e9925cbbefb0b28b79295d615f@127.0.0.1:30303
```
20 changes: 13 additions & 7 deletions docs/Configuring-Pantheon/Using-Configuration-File.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
To specify command line options in a file, use a TOML configuration file.

The configuration file can be saved and reused across node startups. To specify the configuration file,
use the [`--config` option](../Reference/Pantheon-CLI-Syntax.md#config).
use the [`--config-file` option](../Reference/Pantheon-CLI-Syntax.md#config).

To override an option specified in the configuration file, specify the same option on the command line.
When an option is specified in both places, Pantheon is started with the command line value.
Expand All @@ -25,17 +25,23 @@ Specific differences between the command line and the TOML file format are:
!!!example "Example TOML configuration file"
```toml
# Valid TOML config file
datadir="~/pantheondata" # Path
data-path="~/pantheondata" # Path

# Network
bootnodes=["enode://001@123:4567", "enode://002@123:4567", "enode://003@123:4567"]
p2p-listen="1.2.3.4:1234" # IP:port

p2p-host="1.2.3.4"
p2p-port=1234
max-peers=42
rpc-listen="5.6.7.8:5678" # IP:port
ws-listen="9.10.11.12:9101" # IP:port

rpc-http-host="5.6.7.8"
rpc-http-port=5678

rpc-ws-host="9.10.11.12"
rpc-ws-port=9101

# Chain
genesis="~/genesis.json" # Path to the custom genesis file
genesis-file="~/genesis.json" # Path to the custom genesis file

# Mining
miner-enabled=true
Expand All @@ -44,5 +50,5 @@ Specific differences between the command line and the TOML file format are:

!!!example "Starting Pantheon with a Configuration File"
```bash
pantheon --config=/home/me/me_node/config.toml
pantheon --config-file=/home/me/me_node/config.toml
```
33 changes: 22 additions & 11 deletions docs/Consensus-Protocols/Clique.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@ source: rinkeby.json

# Clique

Pantheon implements the Clique Proof-of-Authority (PoA) consensus protocol. Clique is used by the Rinkeby testnet and can be used for private networks.
Pantheon implements the Clique Proof-of-Authority (PoA) consensus protocol. Clique is used by the
Rinkeby testnet and can be used for private networks.

In Clique networks, transactions and blocks are validated by approved accounts, known as signers. Signers take turns to create the next block. Existing signers propose and vote to add or remove signers.
In Clique networks, transactions and blocks are validated by approved accounts, known as signers.
Signers take turns to create the next block. Existing signers propose and vote to add or remove signers.

## Genesis File

To use Clique in a private network, Pantheon requires a Clique genesis file. When connecting to Rinkeby, Pantheon uses the [`rinkeby.json`](https://github.com/PegaSysEng/pantheon/blob/master/config/src/main/resources/rinkeby.json) genesis file in the `/pantheon/config/src/main/resources` directory.
To use Clique in a private network, Pantheon requires a Clique genesis file. When connecting to Rinkeby,
Pantheon uses the [`rinkeby.json`](https://github.com/PegaSysEng/pantheon/blob/master/config/src/main/resources/rinkeby.json)
genesis file in the `/pantheon/config/src/main/resources` directory.

A PoA genesis file defines properties specific to Clique:

Expand All @@ -37,14 +41,17 @@ The properties specific to Clique are:
* `epoch` - Number of blocks after which to reset all votes.
* `extraData` - Initial signers are specified after the 32 bytes reserved for vanity data.

To connect to the Rinkeby testnet, start Pantheon with the [`--rinkeby`](../Reference/Pantheon-CLI-Syntax.md#rinkeby) command line option. To start a node on a Clique private network, use the [`--genesis`](../Reference/Pantheon-CLI-Syntax.md#genesis`) option to specify the custom genesis file.
To connect to the Rinkeby testnet, start Pantheon with the [`--network=rinkeby`](../Reference/Pantheon-CLI-Syntax.md#network)
command line option. To start a node on a Clique private network, use the
[`--genesis-file`](../Reference/Pantheon-CLI-Syntax.md#genesis-file) option to specify the custom genesis file.

## Adding and Removing Signers

To propose adding or removing signers using the JSON-RPC methods, enable the HTTP interface
using [`--rpc-enabled`](../Reference/Pantheon-CLI-Syntax.md#rpc-enabled) or WebSockets interface using
[`--ws-enabled`](../Reference/Pantheon-CLI-Syntax.md#ws-enabled). If also using the [`--rpc-api`](../Reference/Pantheon-CLI-Syntax.md#rpc-api)
or [`--ws-api`](../Reference/Pantheon-CLI-Syntax.md#ws-api) options, include `CLIQUE`.
using [`--rpc-http-enabled`](../Reference/Pantheon-CLI-Syntax.md#rpc-http-enabled) or WebSockets interface using
[`--rpc-ws-enabled`](../Reference/Pantheon-CLI-Syntax.md#rpc-ws-enabled). If also using the
[`--rpc-api`](../Reference/Pantheon-CLI-Syntax.md#rpc-api)
or [`--ws-api`](../Reference/Pantheon-CLI-Syntax.md#ws-api) options, include `CLIQUE`.

The JSON-RPC methods to add or remove signers are:

Expand All @@ -60,9 +67,11 @@ To propose adding a signer, call `clique_propose` specifying the address of the

When the next block is created by the signer, a vote is added to the block for the proposed signer.

When more than half of the existing signers propose adding the signer and their votes have been distributed in blocks, the signer is added and can begin signing blocks.
When more than half of the existing signers propose adding the signer and their votes have been
distributed in blocks, the signer is added and can begin signing blocks.

Use `clique_getSigners` to return a list of the signers and to confirm that your proposed signer has been added.
Use `clique_getSigners` to return a list of the signers and to confirm that your proposed signer has
been added.
!!! example "JSON-RPC clique_getSigners Request Example"
```bash
curl -X POST --data '{"jsonrpc":"2.0","method":"clique_getSigners","params":["latest"], "id":1}' <JSON-RPC-endpoint:port>
Expand All @@ -74,11 +83,13 @@ To discard your proposal after confirming the signer was added, call `clique_dis
curl -X POST --data '{"jsonrpc":"2.0","method":"clique_discard","params":["0xFE3B557E8Fb62b89F4916B721be55cEb828dBd73"], "id":1}' <JSON-RPC-endpoint:port>
```

The process for removing a signer is the same as adding a signer except you specify `false` as the second parameter of `clique_propose`.
The process for removing a signer is the same as adding a signer except you specify `false` as the
second parameter of `clique_propose`.

### Epoch Transition

At each epoch transition, all pending votes collected from received blocks are discarded. Existing proposals remain in effect and signers re-add their vote the next time they create a block.
At each epoch transition, all pending votes collected from received blocks are discarded.
Existing proposals remain in effect and signers re-add their vote the next time they create a block.

Define the number of blocks between epoch transitions in the genesis file.

Expand Down
Loading