From 3ae296aa3f4b5031ccb6d26d658d91d6b703e2cb Mon Sep 17 00:00:00 2001 From: Edward Evans Date: Tue, 22 Oct 2019 13:12:30 +1000 Subject: [PATCH] Add support for creating custom blockchain networks Signed-off-by: Edward Evans --- README.md | 3 ++- templates/config.toml.j2 | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b6f0fea..589d4dc 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,8 @@ All variables which can be overridden are stored in [defaults/main.yml](defaults | `besu_systemd_state` | restarted | The default option for the systemd service state | | `besu_host_ip` | "" | The host IP that Besu uses for the P2P network. This specifies the host on which P2P listens | | `besu_default_ip` | "{{ default(ansible_host) \| default('127.0.0.1') }}" | The fallback default for `besu_host_ip` | -| `besu_network` | mainnet | The network that this node will join. Other values are 'ropsten', 'rinkeby', 'goerli', 'dev'| +| `besu_network` | mainnet | The network that this node will join. Other values are 'ropsten', 'rinkeby', 'goerli', 'dev' and 'custom' | +| `besu_genesis_path | ___unset___ | The path to the genesis file, only valid when `besu_network` is `custom` | | `besu_sync_mode` | FAST | Specifies the synchronization mode. Other values are 'FULL' | | `besu_log_level` | INFO | The log level to use. Other log levels are 'OFF', 'FATAL', 'WARN', 'INFO', 'DEBUG', 'TRACE', 'ALL' | | `besu_p2p_port` | 30303 | Specifies the P2P listening ports (UDP and TCP). Ports must be exposed appropriately | diff --git a/templates/config.toml.j2 b/templates/config.toml.j2 index 489e419..e325a7e 100644 --- a/templates/config.toml.j2 +++ b/templates/config.toml.j2 @@ -2,7 +2,11 @@ data-path="{{besu_data_dir}}" logging="{{besu_log_level}}" +{% if besu_network.lower() != "custom" %} network="{{besu_network}}" +{% else %} +genesis-file="{{ besu_genisis_path }} +{% endif %} sync-mode="{{besu_sync_mode}}" host-whitelist=[{{besu_host_whitelist|map('to_json')|join(',')}}] @@ -34,4 +38,4 @@ metrics-port={{besu_metrics_port}} {% if besu_bootnodes|length > 0 %} # bootnodes bootnodes={{besu_bootnodes}} -{% endif %} \ No newline at end of file +{% endif %}