This page demonstrates how to deploy a custom VM into cloud-based validators using Avalanche-CLI.
Note
Currently, only Fuji network and Devnets are supported.
ALPHA WARNING: This command is currently in experimental mode. Proceed at your own risk.
Before we begin, you will need to have:
- Created a cloud server node as described here
- Created a Custom VM, as described here.
- (Ignore for Devnet) Set up a key to be able to pay for transaction Fees, as described here.
Currently, only AWS & GCP cloud services are supported.
We will be deploying the MorpheusVM example built with the HyperSDK.
The following settings will be used:
- Repo url:
https://github.com/ava-labs/hypersdk/
- Branch Name:
vryx-poc
- Build Script:
examples/morpheusvm/scripts/build.sh
Note
The CLI needs a public repo url in order to be able to download and install the custom VM on cloud.
The following contents will serve as the chain genesis. They were generated using morpheus-cli
as shown here.
Save it into a file with path <genesisPath>
(for example ~/morpheusvm_genesis.json
):
Let's create a Subnet called <blockchainName>
, with custom VM binary and genesis.
Choose custom
Provide path to genesis:
Provide the source code repo url:
Set the branch and finally set the build script:
CLI will generate a locally compiled binary, and then create the Subnet.
For this example, we will deploy the Subnet and blockchain on Fuji. Run:
Choose Fuji:
Use the stored key:
Choose <keyName>
as the key to use to pay the fees:
Use the same key as the control key for the Subnet:
The successfully creation of our Subnet and blockchain is confirmed by the following output:
Avalanche-CLI supports uploading the full set of configuration files for a blockchain:
- Genesis File
- Blockchain Config
- Subnet Config
- Network Upgrades
- AvalancheGo Config
The following example uses all of them, but the user can decide to provide a subset of those.
Save the following content (as defined here)
into a file with path <avagoFlagsPath>
(for example ~/morpheusvm_avago.json
):
Then set the Subnet to use it by executing:
Select node-config.json:
Provide the path to the AvalancheGo config file:
Finally, choose no:
morpheus-cli
as shown here.
Save the following content (generated by this script)
in a known file path (for example ~/morpheusvm_chain.json
):
Then set the Subnet to use it by executing:
Select chain.json:
Provide the path to the blockchain config file:
Finally choose no:
Save the following content (generated by this script)
in a known path (for example ~/morpheusvm_subnet.json
):
Then set the Subnet to use it by executing:
Select subnet.json
:
Provide the path to the Subnet config file:
Choose no:
Save the following content (currently with no network upgrades) in a known path (for example ~/morpheusvm_upgrades.json
):
Then set the Subnet to use it by executing:
Provide the path to the network upgrades file:
To deploy our Custom VM, run:
Your custom VM is successfully deployed!
You can also use avalanche node update blockchain <blockchainName>
to reinstall the binary when the branch is updated, or update the config files.