-
Notifications
You must be signed in to change notification settings - Fork 879
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a launcher to easily configure the Besu client on the mainnet. Signed-off-by: Karim TAAM <t2am.karim@gmail.com>
- Loading branch information
Showing
10 changed files
with
305 additions
and
3 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
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
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
54 changes: 54 additions & 0 deletions
54
besu/src/main/java/org/hyperledger/besu/cli/options/unstable/LauncherOptions.java
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,54 @@ | ||
/* | ||
* Copyright ConsenSys AG. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
package org.hyperledger.besu.cli.options.unstable; | ||
|
||
import net.consensys.quorum.mainnet.launcher.options.Options; | ||
import picocli.CommandLine; | ||
|
||
public class LauncherOptions implements Options { | ||
|
||
private static final String LAUNCHER_OPTION_NAME = "--Xlauncher"; | ||
private static final String LAUNCHER_OPTION_NAME_FORCE = "--Xlauncher-force"; | ||
|
||
@SuppressWarnings({"FieldCanBeFinal", "FieldMayBeFinal"}) | ||
@CommandLine.Option( | ||
hidden = true, | ||
names = {LAUNCHER_OPTION_NAME}, | ||
description = | ||
"Activate the launcher if no configuration file is present. (default: ${DEFAULT-VALUE})", | ||
arity = "0..1") | ||
private Boolean isLauncherMode = Boolean.FALSE; | ||
|
||
@SuppressWarnings({"FieldCanBeFinal", "FieldMayBeFinal"}) | ||
@CommandLine.Option( | ||
hidden = true, | ||
names = {LAUNCHER_OPTION_NAME_FORCE}, | ||
description = | ||
"Force to activate the launcher even if a configuration file is present. (default: ${DEFAULT-VALUE})", | ||
arity = "0..1") | ||
private Boolean isLauncherModeForced = Boolean.FALSE; | ||
|
||
public static LauncherOptions create() { | ||
return new LauncherOptions(); | ||
} | ||
|
||
public boolean isLauncherMode() { | ||
return isLauncherMode; | ||
} | ||
|
||
public boolean isLauncherModeForced() { | ||
return isLauncherModeForced; | ||
} | ||
} |
187 changes: 187 additions & 0 deletions
187
besu/src/main/resources/org/hyperledger/besu/cli/launcher.json
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,187 @@ | ||
{ | ||
"config-file-name": "config.toml", | ||
"steps": [ | ||
{ | ||
"prompt-type": "LIST", | ||
"question": "Which Ethereum network would you like to use ?", | ||
"config-key": "network", | ||
"available-options": "org.hyperledger.besu.cli.config.NetworkName", | ||
"additional-flag": { | ||
"yolo_v2": "Xberlin-enabled" | ||
} | ||
}, | ||
{ | ||
"prompt-type": "LIST", | ||
"question": "Which synchronization mode?", | ||
"config-key": "sync-mode", | ||
"available-options": "org.hyperledger.besu.ethereum.eth.sync.SyncMode" | ||
}, | ||
{ | ||
"prompt-type": "CONFIRM", | ||
"question": "Do you want to enable pruning?", | ||
"config-key": "pruning-enabled", | ||
"default-option": "no" | ||
}, | ||
{ | ||
"prompt-type": "INPUT", | ||
"question": "What is the data directory ?", | ||
"config-key": "data-path" | ||
}, | ||
{ | ||
"prompt-type": "CONFIRM", | ||
"question": "Do you want to enable the JSON-RPC HTTP service ?", | ||
"config-key": "rpc-http-enabled", | ||
"default-option": "yes", | ||
"sub-questions": [ | ||
{ | ||
"prompt-type": "CONFIRM", | ||
"question": "Do you want to configure the JSON-RPC options now ?", | ||
"default-option": "yes", | ||
"sub-questions": [ | ||
{ | ||
"prompt-type": "INPUT", | ||
"question": "What is the JSON RPC HTTP host address ?", | ||
"config-key": "rpc-http-host" | ||
}, | ||
{ | ||
"prompt-type": "INPUT", | ||
"question": "What is the JSON RPC HTTP port ?", | ||
"config-key": "rpc-http-port", | ||
"regex": "[0-9]+" | ||
}, | ||
{ | ||
"prompt-type": "CHECKBOX", | ||
"question": "Select the list of APIs to enable on JSON-RPC HTTP service", | ||
"config-key": "rpc-http-apis", | ||
"available-options": "org.hyperledger.besu.ethereum.api.jsonrpc.RpcApis$ALL_JSON_RPC_APIS", | ||
"default-option": "ETH, NET, WEB3" | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
{ | ||
"prompt-type": "CONFIRM", | ||
"question": "Do you want to enable the JSON-RPC Websocket service ?", | ||
"config-key": "rpc-ws-enabled", | ||
"default-option": "no", | ||
"sub-questions": [ | ||
{ | ||
"prompt-type": "CONFIRM", | ||
"question": "Do you want to configure the JSON-RPC options now ?", | ||
"default-option": "yes", | ||
"sub-questions": [ | ||
{ | ||
"prompt-type": "INPUT", | ||
"question": "What is the JSON RPC Websocket host address ?", | ||
"config-key": "rpc-ws-host" | ||
}, | ||
{ | ||
"prompt-type": "INPUT", | ||
"question": "What is the JSON RPC Websocket port ?", | ||
"config-key": "rpc-ws-port", | ||
"regex": "[0-9]+" | ||
}, | ||
{ | ||
"prompt-type": "CHECKBOX", | ||
"question": "Select the list of APIs to enable on JSON-RPC Websocket service", | ||
"config-key": "rpc-ws-apis", | ||
"available-options": "org.hyperledger.besu.ethereum.api.jsonrpc.RpcApis$ALL_JSON_RPC_APIS", | ||
"default-option": "ETH, NET, WEB3" | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
{ | ||
"prompt-type": "CONFIRM", | ||
"question": "Do you want to enable GraphQL functionality ?", | ||
"config-key": "graphql-http-enabled", | ||
"default-option": "no", | ||
"sub-questions": [ | ||
{ | ||
"prompt-type": "CONFIRM", | ||
"question": "Do you want to configure the GraphQL options now ?", | ||
"default-option": "yes", | ||
"sub-questions": [ | ||
{ | ||
"prompt-type": "INPUT", | ||
"question": "What is the GraphQL host address ?", | ||
"config-key": "graphql-http-host" | ||
}, | ||
{ | ||
"prompt-type": "INPUT", | ||
"question": "What is the GraphQL port ?", | ||
"config-key": "graphql-http-port", | ||
"regex": "[0-9]+" | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
{ | ||
"prompt-type": "CONFIRM", | ||
"question": "Do you want to use Ethstats ?", | ||
"default-option": "no", | ||
"sub-questions": [ | ||
{ | ||
"prompt-type": "INPUT", | ||
"question": "What is the URL of Ethstats (nodename:secret@host:port) ?", | ||
"config-key": "Xethstats", | ||
"regex": "([-\\w]+):([\\w]+)?@([-.\\w]+):([\\d]+)" | ||
}, | ||
{ | ||
"prompt-type": "INPUT", | ||
"question": "What is the contact address ?", | ||
"config-key": "Xethstats-contact" | ||
} | ||
] | ||
}, | ||
{ | ||
"prompt-type": "CONFIRM", | ||
"question": "Do you want to enable NAT ?", | ||
"default-option": "no", | ||
"sub-questions": [ | ||
{ | ||
"prompt-type": "LIST", | ||
"question": "Which NAT method would you like to use ?", | ||
"config-key": "nat-method", | ||
"available-options": "org.hyperledger.besu.nat.NatMethod" | ||
} | ||
] | ||
}, | ||
{ | ||
"prompt-type": "CONFIRM", | ||
"question": "Do you want to enable mining ?", | ||
"default-option": "no", | ||
"config-key": "miner-enabled", | ||
"sub-questions": [ | ||
{ | ||
"prompt-type": "INPUT", | ||
"question": "What is the account to which mining rewards are paid ?", | ||
"config-key": "miner-coinbase", | ||
"regex": "^0x[0-9a-fA-F]{40}$" | ||
}, | ||
{ | ||
"prompt-type": "CONFIRM", | ||
"question": "Do you want to use Stratum ?", | ||
"default-option": "no", | ||
"config-key": "miner-stratum-enabled", | ||
"sub-questions": [ | ||
{ | ||
"prompt-type": "INPUT", | ||
"question": "What is the Stratum host address ?", | ||
"config-key": "miner-stratum-host" | ||
}, | ||
{ | ||
"prompt-type": "INPUT", | ||
"question": "What is the Stratum port service ?", | ||
"config-key": "miner-stratum-port", | ||
"regex": "[0-9]+" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} |
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
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
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
Oops, something went wrong.