Examples
The examples section provides information on some examples of how Solo can be used and leveraged.
The usage of examples in Solo
Table of Contents
Prerequisites
- install taskfile:
npm install -g @go-task/cli
Running the examples with Taskfile
cd
into the directory under examples
that has the Taskfile.yml
, e.g. (from solo repo root directory) cd examples/network-with-block-node/
- make sure that your current kubeconfig context is pointing to the cluster that you want to deploy to
- run
task
which will do the rest and deploy the network and take care of many of the pre-requisites
NOTES:
- Some of these examples are for running against large clusters with a lot of resources available.
- Edit the values of the variables as needed.
Customizing the examples
- take a look at the Taskfile.yml sitting in the subdirectory for the deployment you want to run
- make sure your cluster can handle the number in SOLO_NETWORK_SIZE, if not, then you will have to update that and make it match the number of nodes in the
init-containers-values.yaml
: hedera.nodes[]
- take a look at the
init-containers-values.yaml
file and make sure the values are correct for your deployment with special attention to:- resources
- nodeSelector
- tolerations
1 - Node Create Transaction Example
Using Solo with a custom NodeCreateTransaction from an SDK call
Node Create Transaction Example
This example demonstrates how to use the node add-prepare/prepare-upgrade/freeze-upgrade/add-execute commands against a network in order to manually write a NodeCreateTransaction.
What It Does
- Stands up a network with two existing nodes
- Runs
solo node add-prepare
to get artifacts needed for the SDK NodeCreateTransaction - Runs a JavaScript program using the Hiero SDK JS code to run a NodeCreateTransaction
- Runs
solo node prepare-upgrade
and solo node freeze-upgrade
to put the network into a freeze state - Runs
solo node add-execute
to add network resources for a third consensus node, configures it, then restarts the network to come out of the freeze and leverage the new node - Contains the destroy commands to bring down the network if desired
How to Use
- Install dependencies:
- Make sure you have Task, Node.js, npm, kubectl, and kind installed.
- Run
npm install
while in this directory so that the solo-node-create-transaction.js
script will work correctly when ran
- Choose your Solo command:
- Edit
Taskfile.yml
and comment out/uncomment depending on if you want to run Solo checked out of the repository or running Solo with an NPM installSOLO_COMMAND: "npm run solo --"
: use this if running with solo source repositorySOLO_COMMAND: "solo"
: use this if running with installed version of Solo
- Provide your custom
application.properties
if desired: - CN_VERSION:
- The following is only used for certain decision logic. It is best to have it as close to possible as the local build you are using of consensus node:
CN_VERSION: "v0.64.2"
- The script is configured to leverage a local build of the Consensus Node, for example the
main
branch. You will need to clone the Hiero Consensus Node yourself and then from its root directory run ./gradlew assemble
, this assumes you have all its prerequisites configured, see: https://github.com/hiero-ledger/hiero-consensus-node/blob/main/docs/README.md
- Updating Directory Locations
- The script was designed to run from this directory and so if you copy down the example without the repository or change other locations you might need to make changes
- The
dir: ../..
setting says to run the script two directories above, CN_LOCAL_BUILD_PATH
can be updated to be relative to that, or can be changed to have the full path to the consensus node directory - The
CN_LOCAL_BUILD_PATH
actually points to the <hiero-consensus-node>/hedera-node/data
, this is because this is the location of the artifacts that Solo needs to upload to the network node
- Run the default workflow:
- From this directory, run:
- This will:
- Install the Solo CLI
- Create a Kind cluster
- Set the kubectl context
- Initialize Solo
- Connect and set up the cluster reference
- Create and configure the deployment
- Add the cluster to the deployment
- Generate node keys
- Deploy the network with custom configuration files
- Set up and start nodes
- Deploy mirror node, relay, and explorer
- Perform the node add as described in the ‘What It Does’ section above
- Destroy the network:
- Run:
- This will:
- Stop all nodes
- Destroy mirror node, relay, and explorer
- Destroy the Solo network
- Delete the Kind cluster
Files
Taskfile.yml
— All automation tasks and configurationpackage.json
- Contains the libraries for the solo-node-create-transaction.js
to functionpackage-lock.json
- A snapshot of what was last used when npm install
was ran, run npm ci
to install these versions specificallysolo-node-create-transaction.js
- The script to run the Hiero SDK JS calls
Notes
- This example is self-contained and does not require files from outside this directory.
- All steps in the workflow are named for clear logging and troubleshooting.
- You can extend the Taskfile to add more custom resources or steps as needed.
- For more advanced usage, see the main Solo documentation.
2 - Node Delete Transaction Example
Using Solo with a custom NodeDeleteTransaction from an SDK call
Node Delete Transaction Example
This example demonstrates how to use the node add-prepare/prepare-upgrade/freeze-upgrade/add-execute commands against a network in order to manually write a NodeDeleteTransaction.
What It Does
- Stands up a network with two existing nodes
- Runs
solo node delete-prepare
to get artifacts needed for the SDK NodeDeleteTransaction - Runs a JavaScript program using the Hiero SDK JS code to run a NodeDeleteTransaction
- Runs
solo node prepare-upgrade
and solo node freeze-upgrade
to put the network into a freeze state - Runs
solo node delete-execute
to configure the network to stop using the deleted node, then restarts the network to come out of the freeze and run with the new configurations - Contains the destroy commands to bring down the network if desired
How to Use
- Install dependencies:
- Make sure you have Task, Node.js, npm, kubectl, and kind installed.
- Run
npm install
while in this directory so that the solo-node-delete-transaction.js
script will work correctly when ran
- Choose your Solo command:
- Edit
Taskfile.yml
and comment out/uncomment depending on if you want to run Solo checked out of the repository or running Solo with an NPM installSOLO_COMMAND: "npm run solo --"
: use this if running with solo source repositorySOLO_COMMAND: "solo"
: use this if running with installed version of Solo
- Provide your custom
application.properties
if desired: - CN_VERSION:
- The following is only used for certain decision logic. It is best to have it as close to possible as the local build you are using of consensus node:
CN_VERSION: "v0.64.2"
- The script is configured to leverage a local build of the Consensus Node, for example the
main
branch. You will need to clone the Hiero Consensus Node yourself and then from its root directory run ./gradlew assemble
, this assumes you have all its prerequisites configured, see: https://github.com/hiero-ledger/hiero-consensus-node/blob/main/docs/README.md
- Updating Directory Locations
- The script was designed to run from this directory and so if you copy down the example without the repository or change other locations you might need to make changes
- The
dir: ../..
setting says to run the script two directories above, CN_LOCAL_BUILD_PATH
can be updated to be relative to that, or can be changed to have the full path to the consensus node directory - The
CN_LOCAL_BUILD_PATH
actually points to the <hiero-consensus-node>/hedera-node/data
, this is because this is the location of the artifacts that Solo needs to upload to the network node
- Run the default workflow:
- From this directory, run:
- This will:
- Install the Solo CLI
- Create a Kind cluster
- Set the kubectl context
- Initialize Solo
- Connect and set up the cluster reference
- Create and configure the deployment
- Add the cluster to the deployment
- Generate node keys
- Deploy the network with custom configuration files
- Set up and start nodes
- Deploy mirror node, relay, and explorer
- Perform the node delete as described in the ‘What It Does’ section above
- Destroy the network:
- Run:
- This will:
- Stop all nodes
- Destroy mirror node, relay, and explorer
- Destroy the Solo network
- Delete the Kind cluster
Files
Taskfile.yml
— All automation tasks and configurationpackage.json
- Contains the libraries for the solo-node-delete-transaction.js
to functionpackage-lock.json
- A snapshot of what was last used when npm install
was ran, run npm ci
to install these versions specificallysolo-node-delete-transaction.js
- The script to run the Hiero SDK JS calls
Notes
- This example is self-contained and does not require files from outside this directory.
- All steps in the workflow are named for clear logging and troubleshooting.
- You can extend the Taskfile to add more custom resources or steps as needed.
- For more advanced usage, see the main Solo documentation.
3 - Node Update Transaction Example
Using Solo with a custom NodeUpdateTransaction from an SDK call
Node Update Transaction Example
This example demonstrates how to use the node add-prepare/prepare-upgrade/freeze-upgrade/add-execute commands against a network in order to manually write a NodeUpdateTransaction.
What It Does
- Stands up a network with two existing nodes
- Runs
solo node update-prepare
to get artifacts needed for the SDK NodeUpdateTransaction - Runs a JavaScript program using the Hiero SDK JS code to run a NodeUpdateTransaction
- Runs
solo node prepare-upgrade
and solo node freeze-upgrade
to put the network into a freeze state - Runs
solo node update-execute
to update network resources for the changes to the updated node, then restarts the network to come out of the freeze and leverage the changes - Contains the destroy commands to bring down the network if desired
How to Use
- Install dependencies:
- Make sure you have Task, Node.js, npm, kubectl, and kind installed.
- Run
npm install
while in this directory so that the solo-node-update-transaction.js
script will work correctly when ran
- Choose your Solo command:
- Edit
Taskfile.yml
and comment out/uncomment depending on if you want to run Solo checked out of the repository or running Solo with an NPM installSOLO_COMMAND: "npm run solo --"
: use this if running with solo source repositorySOLO_COMMAND: "solo"
: use this if running with installed version of Solo
- Provide your custom
application.properties
if desired: - CN_VERSION:
- The following is only used for certain decision logic. It is best to have it as close to possible as the local build you are using of consensus node:
CN_VERSION: "v0.64.2"
- The script is configured to leverage a local build of the Consensus Node, for example the
main
branch. You will need to clone the Hiero Consensus Node yourself and then from its root directory run ./gradlew assemble
, this assumes you have all its prerequisites configured, see: https://github.com/hiero-ledger/hiero-consensus-node/blob/main/docs/README.md
- Updating Directory Locations
- The script was designed to run from this directory and so if you copy down the example without the repository or change other locations you might need to make changes
- The
dir: ../..
setting says to run the script two directories above, CN_LOCAL_BUILD_PATH
can be updated to be relative to that, or can be changed to have the full path to the consensus node directory - The
CN_LOCAL_BUILD_PATH
actually points to the <hiero-consensus-node>/hedera-node/data
, this is because this is the location of the artifacts that Solo needs to upload to the network node
- Run the default workflow:
- From this directory, run:
- This will:
- Install the Solo CLI
- Create a Kind cluster
- Set the kubectl context
- Initialize Solo
- Connect and set up the cluster reference
- Create and configure the deployment
- Add the cluster to the deployment
- Generate node keys
- Deploy the network with custom configuration files
- Set up and start nodes
- Deploy mirror node, relay, and explorer
- Perform the node update as described in the ‘What It Does’ section above
- Destroy the network:
- Run:
- This will:
- Stop all nodes
- Destroy mirror node, relay, and explorer
- Destroy the Solo network
- Delete the Kind cluster
Files
Taskfile.yml
— All automation tasks and configurationpackage.json
- Contains the libraries for the solo-node-update-transaction.js
to functionpackage-lock.json
- A snapshot of what was last used when npm install
was ran, run npm ci
to install these versions specificallysolo-node-update-transaction.js
- The script to run the Hiero SDK JS calls
Notes
- This example is self-contained and does not require files from outside this directory.
- All steps in the workflow are named for clear logging and troubleshooting.
- You can extend the Taskfile to add more custom resources or steps as needed.
- For more advanced usage, see the main Solo documentation.