diff --git a/.gitignore b/.gitignore index 4ed17aa2a46..dd1d0fe2ccd 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,9 @@ /cabal.project.diff /cabal.project.local /cabal.project.old -dist-newstyle/ +configuration/defaults/simpleview/genesis/ +configuration/defaults/liveview/genesis/ +/dist-newstyle/ dist/ *~ \#* diff --git a/README.md b/README.md index ae3803faa77..96b70dd21f1 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,14 @@ provided as a [feature](https://github.com/input-output-hk/cardano-shell/blob/master/app/Cardano/Shell/Features/Logging.hs) by the node shell to the other packages. +- The cardano-node is the top level for the node and + aggregates the other components from other packages: consensus, ledger and + networking, with configuration, CLI, logging and monitoring. + +- The node no longer incorporates wallet or explorer functionality. The wallet + backend and explorer backend are separate components that run in separate + external processes that communicate with the node via local IPC. + ## How to build ### Stack @@ -71,7 +79,7 @@ Usage: cardano-node --topology FILEPATH --database-path FILEPATH `--port` - Specify which port to assign to the node. -`--config` - Specify the filepath to the config `.yaml` file. This file is responsible for all the other node's required settings. See examples in `configuration` (e.g. `log-config-0.yaml`). +`--config` - Specify the filepath to the config `.yaml` file. This file is responsible for all the other node's required settings. See examples in `configuration` (e.g. [`config-0.yaml`](configuration/defaults/liveview/config-0.yaml)). ## Configuration `.yaml` files @@ -173,8 +181,7 @@ Genesis delegation and related concepts are described in detail in: https://hydra.iohk.io/job/Cardano/cardano-ledger-specs/byronLedgerSpec/latest/download-by-type/doc-pdf/ledger-spec The canned `scripts/genesis.sh` example provides a nice set of defaults and -illustrates available options. Running it will produce a `./configuration/XXXXX` directory, -where `XXXXX` will be a 5-character prefix of the genesis hash. +illustrates available options. ## Key operations @@ -245,7 +252,9 @@ The easiest way to create a transaction is via the `scripts/issue-genesis-utxo-e `./scripts/issue-genesis-utxo-expenditure.sh transaction_file` -This will run `scripts/genesis.sh` if you do not have a genesis file and will create a tx file with the name `transaction_file`. The script `scripts/issue-genesis-utxo-expenditure.sh` has defaults for all the requirements of the `issue-genesis-utxo-expenditure` command. +NB: This by default creates a transaction based on `configuration/defaults/liveview/config-0.yaml` + +If you do not have a `genesis_file` you can run `scripts/genesis.sh` which will create an example `genesis_file` for you. The script `scripts/issue-genesis-utxo-expenditure.sh` has defaults for all the requirements of the `issue-genesis-utxo-expenditure` command. ### Submission @@ -253,7 +262,7 @@ The `submit-tx` subcommand provides the option of submitting a pre-signed transaction, in its raw wire format (see GenTx for Byron transactions). The canned `scripts/submit-tx.sh` script will submit the supplied transaction to a testnet -launched by `scripts/shelley-testnet-*.sh` family of scripts. +launched by `scripts/shelley-testnet-liveview.sh` script. ### Issuing UTxO expenditure (genesis and regular) @@ -282,7 +291,7 @@ You can query the tip of your local node via the `get-tip` command as follows 1. Open `tmux` 2. Run `cabal build cardano-node` 3. Run `./scripts/shelley-testnet-live.sh` -4. `cabal exec cardano-cli -- get-tip --config configuration/log-config-0.liveview.yaml --socket-path socket/0` +4. `cabal exec cardano-cli -- get-tip --config configuration/defaults/liveview/config-0.yaml --socket-path socket/0` You will see output from stdout in this format: ``` @@ -292,6 +301,44 @@ Slot: 6 Block number: 5 ``` +## Update proposals + +There is currently only support to create a Byron update proposal: + +``` +cardano-cli create-byron-update-proposal --config NODE-CONFIGURATION + --signing-key FILEPATH + --protocol-version-major WORD16 + --protocol-version-minor WORD16 + --protocol-version-alt WORD8 + --application-name STRING + --software-version-num WORD32 + --system-tag STRING + --installer-hash HASH + --filepath FILEPATH + ... +``` +The mandatory arguments are `config`, `signing-key`, `protocol-version-major`, `protocol-version-minor`, `protocol-version-alt`, `application-name`, `software-version-num`, `system-tag`, `installer-hash` and `filepath`. + +The remaining arguments are optional parameters you want to update in your update proposal. + +You can also check your proposal's validity using the [`validate-cbor`](#validate-cbor-files) command. + +See the [Byron specification](https://hydra.iohk.io/job/Cardano/cardano-ledger-specs/byronLedgerSpec/latest/download-by-type/doc-pdf/ledger-spec) for more details on update proposals. + +You can submit your proposal using the `submit-byron-update-proposal` command. + +Example: +``` +cardano-cli submit-byron-update-proposal --config configuration/configuration-mainnet.yaml + --filepath my-update-proposal + --socket-path socket/0 +``` +The socket path must either be specified as an argument (`--socket-path`) or specified in the supplied config file. + +See the [Byron specification](https://hydra.iohk.io/job/Cardano/cardano-ledger-specs/byronLedgerSpec/latest/download-by-type/doc-pdf/ledger-spec) for more deatils on update proposals. + + # Development run *ghcid* with: `ghcid -c "cabal v2-repl exe:cardano-node --reorder-goals"` diff --git a/cardano-node/README.md b/cardano-node/README.md deleted file mode 100644 index e2b57d2abd2..00000000000 --- a/cardano-node/README.md +++ /dev/null @@ -1,347 +0,0 @@ -

- Cardano Node -

- -![alt text](https://github.com/input-output-hk/cardano-node/blob/media/Cardano-ADA.png?raw=true) - -

- - -

- -
- -- The cardano-node is the top level for the node and - aggregates the other components from other packages: consensus, ledger and - networking, with configuration, CLI, logging and monitoring. - -- The node no longer incorporates wallet or explorer functionality. The wallet - backend and explorer backend are separate components that run in separate - external processes that communicate with the node via local IPC. - -## How to build - -### Stack -Use [Haskell Stack - Version 2.1.3](https://haskellstack.org/) to build this project: - -``` -$ cd cardano-node -$ stack build -``` - -## Cabal - -Use [Cabal - Version 3.0](https://www.haskell.org/cabal/) to build this project: - -``` -$ cd cardano-node -$ cabal build -``` - -# `cardano-node` - -This refers to the client that is used for running a node. - -The general synopsis is as follows: -``` - -Usage: cardano-node --topology FILEPATH --database-path FILEPATH - --genesis-file FILEPATH [--delegation-certificate FILEPATH] - [--signing-key FILEPATH] --socket-path FILEPATH - [--host-addr HOST-NAME] --port PORT - --config NODE-CONFIGURATION [--help] [--help-tracing] - [--help-advanced] - Start node of the Cardano blockchain. -``` -`--topology` - Filepath to a topology file describing which peers the node should connect to. - -`--database-path` - Path to the blockchain database. - -`--genesis-file` - Path to the genesis file of the chain you are connecting to. - -`--delegation-certificate` - Optional path to the delegation certificate. The delegation certificate allows the delegator (the issuer of said certificate) to give his/her own block signing rights to somebody else (the delegatee). The delegatee can then sign blocks on behalf of the delegator. - -`--signing-key` - Optional path to the signing key. - -`--socket-path` - Path to the socket file. - -`--host-addr` - Optionally specify your node's IPv4 or IPv6 address. - -`--port` - Specify which port to assign to the node. - -`--config` - Specify the filepath to the config `.yaml` file. This file is responsible for all the other node's required settings. See examples in `configuration` (e.g. `log-config-0.yaml`). - - -## Configuration `.yaml` files - -The `--config` flag points to a `.yaml` file that is responsible to configuring the logging & other important settings for the node. -Some of the more important settings are as follows: - -`NodeId: 0` -- Used in mock protocols only to differentiate nodes. - -`Protocol: RealPBFT` -- Protocol the node will execute - -`RequiresNetworkMagic`: RequiresNoMagic -- Used to distinguish between mainnet (`RequiresNoMagic`) and testnets (`RequiresMagic`) - -`ViewMode: SimpleView` -- Choose between SimpleView or LiveView - - -## Logging - -Logs are output to the `log/` dir. - - -## Scripts - -Please see `scripts/README.md` for information on the various scripts. - -# `cardano-cli` - -A CLI utility to support a variety of key material operations (genesis, migration, pretty-printing..) for different system generations. - -The general synopsis is as follows: - ``` - Usage: cardano-cli (Byron related CMDs |Genesis related CMDs | Key related CMDs | Delegation related CMDs | Transaction related CMDs | Local node related CMDs) -``` - -NOTE: the exact invocation command depends on the environment. If you have only -built `cardano-cli`, without installing it, then you have to prepend `cabal -run -- ` before `cardano-cli`. We henceforth assume that the necessary -environment-specific adjustment has been made, so we only mention `cardano-cli`. - -The subcommands are subdivided in groups, and their full list can be seen in the -output of `cardano-cli --help`. - -All subcommands have help available: - -``` -$ cabal v2-run -- cardano-cli migrate-delegate-key-from --help -Usage: cardano-cli migrate-delegate-key-from (--byron-legacy | --bft | --praos | - --mock-pbft | --real-pbft) - --from FILEPATH - (--byron-legacy | --bft | --praos | - --mock-pbft | --real-pbft) - --to FILEPATH - Migrate a delegate key from an older version. - -Available options: - --byron-legacy Byron/Ouroboros Classic suite of algorithms - --bft BFT consensus - --praos Praos consensus - --mock-pbft Permissive BFT consensus with a mock ledger - --real-pbft Permissive BFT consensus with a real ledger - --from FILEPATH Signing key file to migrate. - --byron-legacy Byron/Ouroboros Classic suite of algorithms - --bft BFT consensus - --praos Praos consensus - --mock-pbft Permissive BFT consensus with a mock ledger - --real-pbft Permissive BFT consensus with a real ledger - --to FILEPATH Non-existent file to write the signing key to. - -h,--help Show this help text -``` - -## Genesis operations - -### Generation - -The genesis generation operations will create a directory that contains: - - `genesis.json` - :: The genesis JSON file itself. - - `avvm-seed.*.seed` - :: Ada Voucher Vending Machine seeds (secret). Affected by `--avvm-entry-count` and `--avvm-entry-balance`. - - `delegate-keys.*.key` - :: Delegate private keys. Affected by: `--n-delegate-addresses`. - - `delegation-cert.*.json` - :: Delegation certificates. Affected by: `--n-delegate-addresses`. - - `genesis-keys.*.key` - :: Genesis stake private keys. Affected by: `--n-delegate-addresses`, `--total-balance`. - - `poor-keys.*.key` - :: Non-delegate private keys with genesis UTxO. Affected by: `--n-poor-addresses`, `--total-balance`. - -More details on the Genesis `JSON` file can be found in `docs/GenesisData.md` - -Genesis delegation and related concepts are described in detail in: - - https://hydra.iohk.io/job/Cardano/cardano-ledger-specs/byronLedgerSpec/latest/download-by-type/doc-pdf/ledger-spec - -The canned `scripts/genesis.sh` example provides a nice set of defaults and -illustrates available options. Running it will produce a `./configuration/XXXXX` directory, -where `XXXXX` will be a 5-character prefix of the genesis hash. - -## Key operations - -Note that no key operation currently supports accepting password-protected keys. -The `keygen` subcommand, though, can generate such keys. - -### Signing key generation & verification key extraction - -Signing keys can be generated using the `keygen` subcommand, password protection being -controlled by the `--no-password` flag. - -Extracting a verification key out of the signing key is performed by the `to-verification` subcommand. - -### Delegate key migration - -In order to continue using a delegate key from the Byron Legacy era in the new implementation, -it needs to be migrated over, which is done by the `migrate-delegate-key-from` subcommand: - - -``` -$ cabal v2-run -- cardano-cli migrate-delegate-key-from ---byron-legacy --from key0.sk --real-pbft --to key0.pbft -``` - -### Signing key queries - -One can gather information about a signing key's properties through the `signing-key-public` -and `signing-key-address` subcommands (the latter requires the network magic): - -``` -$ cabal v2-run -- cardano-cli signing-key-public --real-pbft --secret key0.pbft - -public key hash: a2b1af0df8ca764876a45608fae36cf04400ed9f413de2e37d92ce04 - public key: sc4pa1pAriXO7IzMpByKo4cG90HCFD465Iad284uDYz06dHCqBwMHRukReQ90+TA/vQpj4L1YNaLHI7DS0Z2Vg== - -$ cabal v2-run -- cardano-cli signing-key-address --real-pbft --secret key0.pbft --testnet-magic 459045235 - -2cWKMJemoBakxhXgZSsMteLP9TUvz7owHyEYbUDwKRLsw2UGDrG93gPqmpv1D9ohWNddx -VerKey address with root e5a3807d99a1807c3f161a1558bcbc45de8392e049682df01809c488, attributes: AddrAttributes { derivation path: {} } -``` - -## Delegation - -The `issue-delegation-certificate` subcommand enables generation of Byron genesis -delegation certificates, given the following inputs: - - - node configuration yaml file - - starting epoch of delegation - - genesis delegator signing key - - delegate verification key - -To check the generated delegation certificate, you can use the `check-delegation` subcommand, -which would verify: - - - certificate signature validity - - correspondence of the expected issuer/delegate with those on the certificate. - -The expected issuer and delegate are supplied through the `--issuer-key` and `--delegate-key` -options. - -## Transactions - -### Creation - -Transactions can be created via the `issue-genesis-utxo-expenditure` & `issue-utxo-expenditure` commands. - -The easiest way to create a transaction is via the `scripts/issue-genesis-utxo-expenditure.sh` script as follows: - -`./scripts/issue-genesis-utxo-expenditure.sh transaction_file` - -This will run `scripts/genesis.sh` if you do not have a genesis file and will create a tx file with the name `transaction_file`. The script `scripts/issue-genesis-utxo-expenditure.sh` has defaults for all the requirements of the `issue-genesis-utxo-expenditure` command. - -### Submission - -The `submit-tx` subcommand provides the option of submitting a pre-signed -transaction, in its raw wire format (see GenTx for Byron transactions). - -The canned `scripts/submit-tx.sh` script will submit the supplied transaction to a testnet -launched by `scripts/shelley-testnet-*.sh` family of scripts. - -### Issuing UTxO expenditure (genesis and regular) - -To make a transaction spending UTxO, you can either use the: - - - `issue-genesis-utxo-expenditure`, for genesis UTxO - - `issue-utxo-expenditure`, for normal UTxO - -subcommands directly, or, again use canned scripts that will make transactions tailored -for the aforementioned testnet cluster: - - - `scripts/issue-genesis-utxo-expenditure.sh`. - - `scripts/issue-utxo-expenditure.sh`. - -The script requires the target file name to write the transaction to, input TxId -(for normal UTxO), and optionally allows specifying the source txin output index, -source and target signing keys and lovelace value to send. - -The target address defaults to the 1-st richman key (`configuration/delegate-keys.001.key`) -of the testnet, and lovelace amount is almost the entirety of its funds. - -## Local node queries - -You can query the tip of your local node via the `get-tip` command as follows - -1. Open `tmux` -2. Run `cabal build cardano-node` -3. Run `./scripts/shelley-testnet-live.sh` -4. `cabal exec cardano-cli -- get-tip --config configuration/log-config-0.liveview.yaml --socket-path socket/0` - -You will see output from stdout in this format: -``` -Current tip: -Block hash: 4ab21a10e1b25e39 -Slot: 6 -Block number: 5 -``` - -## Update proposals - -There is currently only support to create a Byron update proposal: - -``` -cardano-cli create-byron-update-proposal --config NODE-CONFIGURATION - --signing-key FILEPATH - --protocol-version-major WORD16 - --protocol-version-minor WORD16 - --protocol-version-alt WORD8 - --application-name STRING - --software-version-num WORD32 - --system-tag STRING - --installer-hash HASH - --filepath FILEPATH - ... -``` -The mandatory arguments are `config`, `signing-key`, `protocol-version-major`, `protocol-version-minor`, `protocol-version-alt`, `application-name`, `software-version-num`, `system-tag`, `installer-hash` and `filepath`. - -The remaining arguments are optional parameters you want to update in your update proposal. - -You can also check your proposal's validity using the [`validate-cbor`](#validate-cbor-files) command. - -See the [Byron specification](https://hydra.iohk.io/job/Cardano/cardano-ledger-specs/byronLedgerSpec/latest/download-by-type/doc-pdf/ledger-spec) for more details on update proposals. - -You can submit your proposal using the `submit-byron-update-proposal` command. - -Example: -``` -cardano-cli submit-byron-update-proposal --config configuration/configuration-mainnet.yaml - --filepath my-update-proposal - --socket-path socket/0 -``` -The socket path must either be specified as an argument (`--socket-path`) or specified in the supplied config file. - -See the [Byron specification](https://hydra.iohk.io/job/Cardano/cardano-ledger-specs/byronLedgerSpec/latest/download-by-type/doc-pdf/ledger-spec) for more deatils on update proposals. - -# Development - -run *ghcid* with: `ghcid -c "cabal v2-repl exe:cardano-node --reorder-goals"` - -# Debugging - -### Pretty printing CBOR encoded files - -It may be useful to print the on chain representations of blocks, delegation certificates, txs and update proposals. There are two commands that do this (for any cbor encoded file): - -To pretty print as CBOR: -`cabal exec cardano-cli -- pretty-print-cbor --filepath CBOREncodedFile` - -### Validate cbor files - -You can validate Byron era blocks, delegation certificates, txs and update proposals with the `validate-cbor` command. - -`cabal exec cardano-cli -- validate-cbor --byron-block --filepath CBOREncodedByronBlockFile` diff --git a/configuration/.gitignore b/configuration/.gitignore deleted file mode 100644 index 5f859b21815..00000000000 --- a/configuration/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/genesis \ No newline at end of file diff --git a/configuration/log-config-0.liveview.yaml b/configuration/defaults/liveview/config-0.yaml similarity index 100% rename from configuration/log-config-0.liveview.yaml rename to configuration/defaults/liveview/config-0.yaml diff --git a/configuration/log-config-1.liveview.yaml b/configuration/defaults/liveview/config-1.yaml similarity index 100% rename from configuration/log-config-1.liveview.yaml rename to configuration/defaults/liveview/config-1.yaml diff --git a/configuration/log-config-2.liveview.yaml b/configuration/defaults/liveview/config-2.yaml similarity index 100% rename from configuration/log-config-2.liveview.yaml rename to configuration/defaults/liveview/config-2.yaml diff --git a/configuration/realPBFT/simple-topology-real-pbft-node-0.json b/configuration/defaults/liveview/topology-node-0.json similarity index 100% rename from configuration/realPBFT/simple-topology-real-pbft-node-0.json rename to configuration/defaults/liveview/topology-node-0.json diff --git a/configuration/realPBFT/simple-topology-real-pbft-node-1.json b/configuration/defaults/liveview/topology-node-1.json similarity index 100% rename from configuration/realPBFT/simple-topology-real-pbft-node-1.json rename to configuration/defaults/liveview/topology-node-1.json diff --git a/configuration/realPBFT/simple-topology-real-pbft-node-2.json b/configuration/defaults/liveview/topology-node-2.json similarity index 100% rename from configuration/realPBFT/simple-topology-real-pbft-node-2.json rename to configuration/defaults/liveview/topology-node-2.json diff --git a/configuration/configuration-mainnet.yaml b/configuration/defaults/mainnet/configuration.yaml similarity index 99% rename from configuration/configuration-mainnet.yaml rename to configuration/defaults/mainnet/configuration.yaml index e09db596f60..fe01528ab7b 100644 --- a/configuration/configuration-mainnet.yaml +++ b/configuration/defaults/mainnet/configuration.yaml @@ -5,7 +5,7 @@ ##### Locations ##### -GenesisFile: mainnet-genesis.json +GenesisFile: genesis.json SocketPath: db/node.socket #TODO: These parameters cannot yet be used in the config file, only on the CLI: diff --git a/configuration/mainnet-genesis.json b/configuration/defaults/mainnet/genesis.json similarity index 100% rename from configuration/mainnet-genesis.json rename to configuration/defaults/mainnet/genesis.json diff --git a/configuration/mainnet-topology.json b/configuration/defaults/mainnet/topology.json similarity index 100% rename from configuration/mainnet-topology.json rename to configuration/defaults/mainnet/topology.json diff --git a/configuration/log-config-0.yaml b/configuration/defaults/simpleview/config-0.yaml similarity index 100% rename from configuration/log-config-0.yaml rename to configuration/defaults/simpleview/config-0.yaml diff --git a/configuration/log-config-1.yaml b/configuration/defaults/simpleview/config-1.yaml similarity index 100% rename from configuration/log-config-1.yaml rename to configuration/defaults/simpleview/config-1.yaml diff --git a/configuration/log-config-2.yaml b/configuration/defaults/simpleview/config-2.yaml similarity index 100% rename from configuration/log-config-2.yaml rename to configuration/defaults/simpleview/config-2.yaml diff --git a/configuration/defaults/simpleview/topology-node-0.json b/configuration/defaults/simpleview/topology-node-0.json new file mode 100644 index 00000000000..95902077560 --- /dev/null +++ b/configuration/defaults/simpleview/topology-node-0.json @@ -0,0 +1,15 @@ + + { + "Producers":[ + { + "addr":"127.0.0.1", + "port":3001, + "valency":1 + }, + { + "addr":"127.0.0.1", + "port":3002, + "valency":1 + } + ] + } diff --git a/configuration/defaults/simpleview/topology-node-1.json b/configuration/defaults/simpleview/topology-node-1.json new file mode 100644 index 00000000000..a64ebe10a66 --- /dev/null +++ b/configuration/defaults/simpleview/topology-node-1.json @@ -0,0 +1,14 @@ +{ + "Producers":[ + { + "addr":"127.0.0.1", + "port":3000, + "valency":1 + }, + { + "addr":"127.0.0.1", + "port":3002, + "valency":1 + } + ] +} diff --git a/configuration/defaults/simpleview/topology-node-2.json b/configuration/defaults/simpleview/topology-node-2.json new file mode 100644 index 00000000000..a762a3e8f19 --- /dev/null +++ b/configuration/defaults/simpleview/topology-node-2.json @@ -0,0 +1,14 @@ +{ + "Producers":[ + { + "addr":"127.0.0.1", + "port":3000, + "valency":1 + }, + { + "addr":"127.0.0.1", + "port":3001, + "valency":1 + } + ] +} diff --git a/configuration/mainnet-genesis-dryrun-with-stakeholders.json b/configuration/mainnet-ci/mainnet-genesis-dryrun-with-stakeholders.json similarity index 100% rename from configuration/mainnet-genesis-dryrun-with-stakeholders.json rename to configuration/mainnet-ci/mainnet-genesis-dryrun-with-stakeholders.json diff --git a/configuration/mainnet-staging-short-epoch-genesis.json b/configuration/mainnet-ci/mainnet-staging-short-epoch-genesis.json similarity index 100% rename from configuration/mainnet-staging-short-epoch-genesis.json rename to configuration/mainnet-ci/mainnet-staging-short-epoch-genesis.json diff --git a/configuration/shelley-staging-genesis.json b/configuration/mainnet-ci/shelley-staging-genesis.json similarity index 100% rename from configuration/shelley-staging-genesis.json rename to configuration/mainnet-ci/shelley-staging-genesis.json diff --git a/configuration/shelley-staging-short-genesis.json b/configuration/mainnet-ci/shelley-staging-short-genesis.json similarity index 100% rename from configuration/shelley-staging-short-genesis.json rename to configuration/mainnet-ci/shelley-staging-short-genesis.json diff --git a/configuration/testnet-genesis.json b/configuration/mainnet-ci/testnet-genesis.json similarity index 100% rename from configuration/testnet-genesis.json rename to configuration/mainnet-ci/testnet-genesis.json diff --git a/configuration/simple-topology.json b/configuration/simple-topology.json deleted file mode 100644 index 736f8032ddb..00000000000 --- a/configuration/simple-topology.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "MockProducers":[ - { - "nodeId":0, - "nodeAddress":{ - "addr":"127.0.0.1", - "port":3000 - }, - "producers":[ - { - "addr":"127.0.0.1", - "port":3001, - "valency":1 - }, - { - "addr":"127.0.0.1", - "port":3002, - "valency":1 - } - ] - }, - { - "nodeId":1, - "nodeAddress":{ - "addr":"127.0.0.1", - "port":3001 - }, - "producers":[ - { - "addr":"127.0.0.1", - "port":3000, - "valency":1 - }, - { - "addr":"127.0.0.1", - "port":3002, - "valency":1 - } - ] - }, - { - "nodeId":2, - "nodeAddress":{ - "addr":"127.0.0.1", - "port":3002 - }, - "producers":[ - { - "addr":"127.0.0.1", - "port":3000, - "valency":1 - }, - { - "addr":"127.0.0.1", - "port":3001, - "valency":1 - } - ] - } - ] -} diff --git a/scripts/README.md b/scripts/README.md index 35641a6bcf8..9737c65e55b 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -72,17 +72,15 @@ set-window-option -g mouse on set -g default-terminal "tmux-256color" ``` -1.) Generate the necessary genesis files by running - - `./scripts/genesis.sh` - -2.) create a `tmux` session +1.) create a `tmux` session `tmux new-session -s Demo` -3.) run the demo script in this new session +2.) run the demo script in this new session -`./scripts/shelley-testnet.sh` +`./scripts/shelley-testnet-live.sh` + +NB: This will automatically create the necessary genesis file in `configuration/defaults/liveview/genesis` ## Run chairman @@ -121,6 +119,8 @@ Submit the tx: ``` The `submit-tx.sh` script by default sends the transaction to node with node id 0. +NB: This will submit a tx based on the `configuration/defaults/liveview/config-0.yaml` config file. + See cardano-cli's [Transactions](../cardano-node/README.md#transactions) section for instructions on how to generate a tx. ## Startup testnet with dns diff --git a/scripts/chairman.sh b/scripts/chairman.sh index d076b275e2e..972ca2b5e67 100755 --- a/scripts/chairman.sh +++ b/scripts/chairman.sh @@ -9,13 +9,13 @@ set -e SOCKET_PATHS=${@/#/--socket-path } -. $(dirname $0)/lib-node.sh +. $(dirname $0)/lib-node.sh defaults/liveview CHAIRMAN="$(executable_runner chairman)" set -x ${CHAIRMAN} \ - -k 10 -s 250 \ + -p 25 \ -t 1000 \ - --config "${configuration}/log-config-0.yaml" \ + --config "${configuration_root}/config-0.yaml" \ $SOCKET_PATHS diff --git a/scripts/genesis.sh b/scripts/genesis.sh index 42d90d3e941..74d90073efa 100755 --- a/scripts/genesis.sh +++ b/scripts/genesis.sh @@ -1,12 +1,6 @@ #!/usr/bin/env bash -test "$1" == "--help" && { - cat <&2; exit 1; } - -umask 077 +OUTPUTDIR=${1?scripts.genesis.Error: no output directory specified} . $(dirname $0)/lib.sh CLI="$(executable_quiet_runner cardano-cli)" @@ -49,18 +43,17 @@ args=( set -xe -${CLI} genesis "${args[@]}" "$@" +${CLI} genesis "${args[@]}" # move new genesis to configuration GENHASH=`${CLI} print-genesis-hash --genesis-json "${tmpdir}/genesis.json" | tail -1` -TARGETDIR="${configuration}/genesis" -mkdir -vp "${TARGETDIR}" -cp -iav ${tmpdir}/genesis.json "${TARGETDIR}"/ -cp -iav ${tmpdir}/delegate-keys.*.key "${TARGETDIR}"/ -cp -iav ${tmpdir}/delegation-cert.*.json "${TARGETDIR}"/ +mkdir -vp "${OUTPUTDIR}" +cp -iav ${tmpdir}/genesis.json "${OUTPUTDIR}"/ +cp -iav ${tmpdir}/delegate-keys.*.key "${OUTPUTDIR}"/ +cp -iav ${tmpdir}/delegation-cert.*.json "${OUTPUTDIR}"/ set - -echo $GENHASH > "${TARGETDIR}"/GENHASH -echo "genesis created with hash = ${GENHASH}" -echo " in directory ${TARGETDIR}" +echo $GENHASH > "${OUTPUTDIR}"/GENHASH +echo "genesis created with hash = ${OUTPUTDIR}" +echo " in directory ${OUTPUTDIR}" diff --git a/scripts/get-default-key-address.sh b/scripts/get-default-key-address.sh index 1005dcdcc5a..a939237f3d9 100755 --- a/scripts/get-default-key-address.sh +++ b/scripts/get-default-key-address.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -. $(dirname $0)/lib-node.sh +. $(dirname $0)/lib-node.sh defaults/liveview CLI="$(executable_quiet_runner cardano-cli)" proto_magic="$(jq '.protocolConsts | .protocolMagic' "${genesis_file}")" diff --git a/scripts/issue-genesis-utxo-expenditure.sh b/scripts/issue-genesis-utxo-expenditure.sh index 6d055b3ae27..f3bcd2b0352 100755 --- a/scripts/issue-genesis-utxo-expenditure.sh +++ b/scripts/issue-genesis-utxo-expenditure.sh @@ -1,23 +1,21 @@ #!/usr/bin/env bash +TX=${1?scripts.issue-genesis-utxo-expenditure.Error: no tx name specified} -. $(dirname $0)/lib-node.sh +. $(dirname $0)/lib-node.sh defaults/liveview CLI="$(executable_quiet_runner cardano-cli)" -CONFIG="configuration/log-config-0.liveview.yaml" +CONFIG="configuration/defaults/liveview/config-0.yaml" from_addr="2cWKMJemoBain3UWCzSY5wZvcf8uQ2MAaSy8hedrwpqsbYCm4QnBgPn3cEH7KF3X7DKoZ" -from_key="${genesis_root}/delegate-keys.000.key" -default_to_key="${genesis_root}/delegate-keys.001.key" +from_key="${configuration_root}/genesis/delegate-keys.000.key" +default_to_key="${configuration_root}/genesis/delegate-keys.001.key" ## ADA to be spent default_lovelace="863000000000000" - case $# in - 1 ) tx="$1" - proto_magic="$(jq '.protocolConsts | .protocolMagic' "${genesis_file}")" + 1 ) proto_magic="$(jq '.protocolConsts | .protocolMagic' "${genesis_file}")" addr="$(${scripts}/get-default-key-address.sh ${default_to_key})" lovelace=${default_lovelace};; - 3 ) tx="$1"; - addr="$2"; + 3 ) addr="$2"; lovelace="$3";; * ) cat >&2 <&1; exit 1 - fi +if [ -a "$genesis_file" ]; +then : +elif test -x ${scripts}/genesis.sh +then ${scripts}/genesis.sh "${genesis_root}" +else echo "ERROR: could not locate genesis generator!">&1; exit 1 fi + genesis_hash=`cat "${genesis_root}/GENHASH"` if test ! -f "${genesis_file}" then echo "ERROR: genesis ${genesis_file} does not exist!">&1; exit 1; fi function nodecfg () { - printf -- "--config ${configuration}/log-config-${1}${2}.yaml " + printf -- "--config ${configuration_root}/config-${1}.yaml " } function dlgkey () { printf -- "--signing-key ${genesis_root}/delegate-keys.%03d.key " "$1" @@ -25,17 +29,16 @@ function dlgcert () { printf -- "--delegation-certificate ${genesis_root}/delegation-cert.%03d.json " "$1" } function commonargs() { - printf -- "--topology ${configuration}/realPBFT/simple-topology-real-pbft-node-$1.json " + printf -- "--topology ${configuration_root}/topology-node-$1.json " printf -- "--database-path ${root}/db/db-$1 " printf -- "--socket-path ${root}/socket/$1 " } function nodeargs () { local id="$1" - local flavor="$2" local extra="$3" commonargs $id - nodecfg $id $flavor + nodecfg $id dlgkey $id dlgcert $id printf -- "${extra} " diff --git a/scripts/mainnet.sh b/scripts/mainnet.sh index c3499f62e8a..c4e643fd107 100755 --- a/scripts/mainnet.sh +++ b/scripts/mainnet.sh @@ -5,13 +5,13 @@ set -e . $(dirname $0)/lib.sh NODE="$(executable_runner cardano-node)" -TOPOLOGY=${TOPOLOGY:-"${configuration}/mainnet-topology.json"} +TOPOLOGY=${TOPOLOGY:-"${configuration}/defaults/mainnet/topology.json"} ARGS=( run --database-path "${root}/db/" --topology "${TOPOLOGY}" --socket-path "${root}/socket/mainnet-socket" - --config "${configuration}/configuration-mainnet.yaml" + --config "${configuration}/defaults/mainnet/configuration.yaml" --port 7776 ) diff --git a/scripts/shelley-testnet-dns.sh b/scripts/shelley-testnet-dns.sh index 352526e2ec3..3c7b1964402 100755 --- a/scripts/shelley-testnet-dns.sh +++ b/scripts/shelley-testnet-dns.sh @@ -30,7 +30,7 @@ NETARGS="--slot-duration 2 --topology configuration/simple-topology-dns.json ${A NODE="$(executable_runner cardano-node)" function mklogcfg () { - echo "--log-config configuration/log-config-${1}.yaml" + echo "--log-config configuration/config-${1}.yaml" } tmux split-window -h diff --git a/scripts/shelley-testnet-live.sh b/scripts/shelley-testnet-live.sh index 0e020dd6530..86779118384 100755 --- a/scripts/shelley-testnet-live.sh +++ b/scripts/shelley-testnet-live.sh @@ -10,7 +10,7 @@ set -e EXTRA="" -. $(dirname $0)/lib-node.sh +. $(dirname $0)/lib-node.sh defaults/liveview NODE="$(executable_runner cardano-node)" # for logs: @@ -26,8 +26,8 @@ tmux select-pane -t 0 tmux split-window -v tmux select-pane -t 1 -tmux send-keys "cd '${PWD}'; ${NODE} run $(nodeargs 0 '.liveview' "${ALGO} $(echo -n ${EXTRA})") " C-m +tmux send-keys "cd '${PWD}'; ${NODE} run $(nodeargs 0 "${ALGO} $(echo -n ${EXTRA})") " C-m tmux select-pane -t 2 -tmux send-keys "cd '${PWD}'; ${NODE} run $(nodeargs 1 '.liveview' "${ALGO} $(echo -n ${EXTRA})") " C-m +tmux send-keys "cd '${PWD}'; ${NODE} run $(nodeargs 1 "${ALGO} $(echo -n ${EXTRA})") " C-m tmux select-pane -t 3 -tmux send-keys "cd '${PWD}'; ${NODE} run $(nodeargs 2 '.liveview' "${ALGO} $(echo -n ${EXTRA})") " C-m +tmux send-keys "cd '${PWD}'; ${NODE} run $(nodeargs 2 "${ALGO} $(echo -n ${EXTRA})") " C-m diff --git a/scripts/shelley-testnet.sh b/scripts/shelley-testnet.sh index 2bde7db2425..f6b3ce31b3e 100755 --- a/scripts/shelley-testnet.sh +++ b/scripts/shelley-testnet.sh @@ -17,7 +17,7 @@ VERBOSITY="--tracing-verbosity-maximal" EXTRA="" -. $(dirname $0)/lib-node.sh +. $(dirname $0)/lib-node.sh defaults/simpleview NODE="$(executable_runner cardano-node)" sleep 2 @@ -35,8 +35,8 @@ tmux select-pane -t 0 tmux split-window -v tmux select-pane -t 1 -tmux send-keys "cd '${PWD}'; ${NODE} run $(nodeargs 0 '' "${ALGO} $(echo -n ${EXTRA})") " C-m +tmux send-keys "cd '${PWD}'; ${NODE} run $(nodeargs 0 "${ALGO} $(echo -n ${EXTRA})") " C-m tmux select-pane -t 2 -tmux send-keys "cd '${PWD}'; ${NODE} run $(nodeargs 1 '' "${ALGO} $(echo -n ${EXTRA})") " C-m +tmux send-keys "cd '${PWD}'; ${NODE} run $(nodeargs 1 "${ALGO} $(echo -n ${EXTRA})") " C-m tmux select-pane -t 3 -tmux send-keys "cd '${PWD}'; ${NODE} run $(nodeargs 2 '' "${ALGO} $(echo -n ${EXTRA})") " C-m +tmux send-keys "cd '${PWD}'; ${NODE} run $(nodeargs 2 "${ALGO} $(echo -n ${EXTRA})") " C-m diff --git a/scripts/submit-tx.sh b/scripts/submit-tx.sh index 651d8c7b5f9..652b01c4a8a 100755 --- a/scripts/submit-tx.sh +++ b/scripts/submit-tx.sh @@ -9,10 +9,10 @@ EOF TX="$1" shift -. $(dirname $0)/lib-node.sh +. $(dirname $0)/lib-node.sh defaults/liveview CLI="$(executable_runner cardano-cli)" -CONFIG="configuration/log-config-0.liveview.yaml" +CONFIG="configuration/defaults/liveview/config-0.yaml" NOW=`date "+%Y-%m-%d 00:00:00"` SOCKET="socket/0" NETARGS=(