2. Blueprint Configuration and Apply
The Ash Console is currently in beta and not production-ready. It is under active development and subject to breaking changes.
We need to write blueprints that define all the entities needed to deploy a 5-node Avalanche devnet and to create the Subnet. For convenience, we have prepared the devnet.yml and devnet-evm-subnet.yml blueprints for you.
Download the blueprints
If not already done, create a folder for this guide and navigate to it:
mkdir -p ash-console-guides/one-command-devnet
cd ash-console-guides/one-command-devnetDownload the devnet.yml and devnet-evm-subnet.yml blueprints from the ash-rs GitHub repository.
curl -sSL https://raw.githubusercontent.com/AshAvalanche/ash-rs/main/crates/ash_cli/examples/console/blueprint/devnet.yml -o devnet.yml
curl -sSL https://raw.githubusercontent.com/AshAvalanche/ash-rs/main/crates/ash_cli/examples/console/blueprint/devnet-evm-subnet.yml -o devnet-evm-subnet.yml
Review the blueprints
Let's take a look at the first blueprint, devnet.yml
. You will see that it defines:
- 5
nodeId
secrets for the 5 nodes of our Avalanche devnet (the node IDs of alocal
Avalanche network are hard-coded in AvalancheGo).
AnodeId
secret contains the TLS keys, certificates and BLS keys for an Avalanche node:secrets:
- name: local-node-id-01
secretType: nodeId
nodeId: NodeID-7Xhw2mDxuDS44j42TCB6U5579esbSt3Lg
nodeCert: LS0tLS...
nodeKey: LS0tLS...
nodeBlsKey: U2fcxy...
# ... - 1 project named
ash-devnet
and tied to thelocal
network. It is the logical set that will contain all the resources of our devnet:projects:
- project:
name: ash-devnet
network: local
sharedResourceConfig:
avalancheNodeConfig:
avalanchego_version: 1.10.17tipThe project also defines
sharedResourceConfig.avalancheNodeConfig
that will be used by all theavalancheNode
resources of the project. - 1 region in the
ash-devnet
project. We will deploy all our resources in this region.regions:
- cloudProvider: "${CLOUD_PROVIDER}}"
region: "${CLOUD_REGION}"
cloudCredentialsSecretId: "${CLOUD_CREDENTIALS_SECRET}"tipHere we reference environment variables that we will define in the next section.
- 5
avalancheNode
resources in theash-devnet
project. EachavalancheNode
resource references anodeId
secret:resources:
- name: local-node-01
resourceType: avalancheNode
cloudRegionId: "${CLOUD_PROVIDER}/${CLOUD_REGION}"
nodeIdSecretId: local-node-id-01
size: small
# ...tipWe reference environment variables to determine to which cloud region the resources will be deployed. We will define these variables in the next section.
The second blueprint, devnet-evm-subnet.yml
, defines:
1
wallet
secret. This wallet will be use to sign the Subnet transactions (creation, validator management, etc.) and the P-Chain address will be used as the control key of the Subnet.secrets:
# Local network pre-funded account wallet
- name: ewoq-key
secretType: wallet
pChainAddress: P-fuji18jma8ppw3nhx5r4ap8clazz0dps7rv5u6wmu4t
privateKey: PrivateKey-ewoqjP7PxY4yr3iLTpLisriqt94hdyDFNgchSxGGztUrTXtNN
privateKeyFormat: cb58dangerDo not use this wallet as control key in production!
1
avalancheSubnet
resource in theash-devnet
project. It references theewoq-key
secret above and defines a Subnet EVM blockchain to be created with a standard genesis configuration:resources:
- name: ash-subnet
resourceType: avalancheSubnet
cloudRegionId: "${CLOUD_PROVIDER}/${CLOUD_REGION}"
subnetControlKeySecretId: ewoq-key
subnetConfig:
createSubnet: true
avalancheSubnetConfig:
subnet_blockchains_list:
- name: AshSubnetEVM
vm: subnet-evm
# ...tipThe
avalancheSubnetConfig
field is following the same structure as the Ansible Avalanche Collection'sash.avalanche_subnet
role. See Blockchain configuration for more information on how to generate a custom genesis configuration.
Define environment variables
A blueprint is very flexible thanks to the use of environment variables. Here we can dynamically specify the cloud provider, region, and cloud credentials secret ID. Let's define them depending on your cloud provider you set up in step 1:
- Example for AWS
- Example for Azure
- Example for Google Cloud
export CLOUD_PROVIDER=aws
export CLOUD_REGION=us-east-1
export CLOUD_CREDENTIALS_SECRET=aws-credentials
export CLOUD_PROVIDER=azure
export CLOUD_REGION=westus
export CLOUD_CREDENTIALS_SECRET=azure-credentials
export CLOUD_PROVIDER=google
export CLOUD_REGION=us-central1
export CLOUD_CREDENTIALS_SECRET=google-credentials
Of course, pick the CLOUD_REGION
of your choice.
Apply the devnet blueprint
Everything is ready to deploy our devnet! Let's apply the first blueprint:
ash console blueprint apply ./devnet.yml
The CLI will ask you to confirm the action:
Blueprint summary
Secrets
5 to create: local-node-id-01, local-node-id-02, local-node-id-03, local-node-id-04, local-node-id-05
0 to update:
Projects
1 to create:
- 'ash-devnet':
Regions: aws/us-east-1
Resources: local-node-01, local-node-02, local-node-03, local-node-04, local-node-05
0 to update:
? Are you sure you want to apply this blueprint? (y/N)
[This action is irreversible!]
Enter y
and watch the magic happen!
> Are you sure you want to apply this blueprint? Yes
Creating entities...
Creating secret: local-node-id-01
Secret created successfully!
+------------------+-------------+--------+------------------+---------+
| Secret name | Secret ID | Type | Created at | Used by |
+==================+=============+========+==================+=========+
| local-node-id-01 | f906...0afc | NodeId | 2024-01-02T11:54 | 0 |
+------------------+-------------+--------+------------------+---------+
# ...
Creating resource: ash-devnet:local-node-05
Resource successfully created in project 'ash-devnet'!
+---------------+-------------+---------------+-----------------+-------+------------------+---------+--------------------------+
| Resource name | Resource ID | Type | Cloud region ID | Size | Created at | Status | Resource specific |
+===============+=============+===============+=================+=======+==================+=========+==========================+
| local-node-05 | cd99...0342 | AvalancheNode | 8d01...b4fc | Small | 2024-01-02T11:56 | Pending | IP address | None |
| | | | | | | | Running | false |
| | | | | | | | Bootstrapped | [false] |
| | | | | | | | Healthy | [false] |
| | | | | | | | Restart req. | false |
+---------------+-------------+---------------+-----------------+-------+------------------+---------+--------------------------+
Health
It will take a few minutes before the local network is
Bootstrapped
andHealthy
. You can get its updated status with theconsole resource info
command:Commandash console resource info local-node-01
OutputResource 'local-node-01' of project 'devnet-guide':
+-------------------+-------------+---------------+-----------------+-------+------------------+---------+--------------------------------+
| Resource name | Resource ID | Type | Cloud region ID | Size | Created at | Status | Resource specific |
+===================+=============+===============+=================+========+==================+=========+================================+
| local-node-01 | 9419...6722 | AvalancheNode | 634d...c9d9 | Small | 2024-01-02T11:54 | Running | IP address | 3.210.183.166 |
| | | | | | | | Running | true |
| | | | | | | | Bootstrapped | [false] |
| | | | | | | | Healthy | [false] |
| | | | | | | | Restart req. | false |
+-------------------+-------------+---------------+-----------------+-------+------------------+---------+--------------------------------+Once a node is
Running
, you can also query the nodeinfo
endpoint with theavalanche node info
command:Commandash avalanche node info -n 3.210.183.166
OutputNode '3.210.183.166:9650':
ID: NodeID-7Xhw2mDxuDS44j42TCB6U5579esbSt3Lg
Network: local
Public IP: 3.210.183.166
Staking port: 9651
Versions:
AvalancheGo: avalanche/1.10.17
Database: v1.4.5
RPC Protocol: 28
Git commit: 145dfb0dc179d688f45ad44067ef6f9821148b36
VMs:
AvalancheVM: v1.10.17
Coreth: v0.12.5
PlatformVM: v1.10.17
Subnet VMs: []
Uptime:
Rewarding stake: 100%
Weighted average: 100%noteYour node IP address will be different.
Your local Avalanche network is now up and running!
Apply the Subnet blueprint
Now that we have a devnet ready to be used, we can apply the second blueprint, devnet-evm-subnet.yml
:
ash console blueprint apply ./devnet-evm-subnet.yml
The CLI will ask you to confirm the action:
Blueprint summary
Secrets
1 to create: ewoq-key
0 to update:
Projects
0 to create:
1 to update:
- 'ash-devnet':
Resources: ash-subnet
? Are you sure you want to apply this blueprint? (y/N)
[This action is irreversible!]
Enter y
and watch the magic happen!
> Are you sure you want to apply this blueprint? Yes
Creating entities...
Creating secret: ewoq-key
Secret created successfully!
+-------------+-------------+--------+------------------+---------+
| Secret name | Secret ID | Type | Created at | Used by |
+=============+=============+========+==================+=========+
| ewoq-key | e9b0...5e35 | Wallet | 2024-01-30T17:25 | 0 |
+-------------+-------------+--------+------------------+---------+
Updating entities...
Updating project: ash-devnet
Project updated successfully!
+--------------+-------------+---------+-----------------+--------------------+------------------+
| Project name | Project ID | Network | Cloud regions | Resources | Created at |
+==============+=============+=========+=================+====================+==================+
| ash-devnet | 3443...5326 | Local | aws/us-east-1 | avalancheNode: 5 | 2024-01-30T13:21 |
+--------------+-------------+---------+-----------------+--------------------+------------------+
Adding resource: ash-devnet:ash-subnet
Resource successfully created in project 'ash-devnet'!
+---------------+-------------+-----------------+---------------+-------+------------------+---------+-------------------+
| Resource name | Resource ID | Type | Cloud region | Size | Created at | Status | Resource specific |
+===============+=============+=================+===============+=======+==================+=========+===================+
| ash-subnet | 396d...6cc8 | AvalancheSubnet | aws/us-east-1 | Small | 2024-01-30T17:26 | Pending | ID | |
| | | | | | | | Validators | 0 |
+---------------+-------------+-----------------+---------------+-------+------------------+---------+-------------------+
Subnet information
After a few minutes, we can get the Subnet ID, control keys, blockchains, and validator nodes information from the subnetStatus
field returned by the console resource info
command:
ash console resource info ash-subnet --json | jq '.subnetStatus'
We use the --json
flag to get the extended information about the Subnet. All those information cannot be displayed in a table format.
{
"blockchains": [
{
"id": "RfX8YRUHePxFENBZFwaNt1tP6CR6RQ4hJJ5AqYv49LRoSKniK",
"name": "AshLocalEVM",
"vm_id": "srEXiWaHuhNyGwPUi444Tu47ZEDwxTWrbQiuD7FmgSAQ6X7Dy",
"vm_type": "SubnetEVM"
}
],
"controlKeys": [
"P-local18jma8ppw3nhx5r4ap8clazz0dps7rv5u00z96u"
],
"id": "29uVeLPJB1eQJkzRemU8g8wZDw5uJRqpab5U2mX9euieVwiEbL",
"pendingValidators": [],
"subnetType": "Permissioned",
"threshold": 1,
"validators": [
{
"connected": true,
"end_time": 1707486609,
"node_id": "NodeID-MFrZFVCXPv5iCn6M9K6XduxGTYp891xXZ",
"stake_amount": 100,
"start_time": 1706881809,
"tx_id": "DhEgYijBur6QDUDgUMpmDAyF5XGyq6JwG919B8bkryDLijvua",
"uptime": 100,
"weight": 100
},
# ...
]
}
Blockchain RPC endpoint
The CLI provides a powerful helper to get the RPC endpoint that can be used to query the Subnet EVM blockchain (e.g. to connect a Web3 wallet). Provide the avalancheNode
resource name to be used as RPC and the avalancheSubnet
resource name:
ash console helper rpc local-node-01 ash-subnet
AshLocalEVM RCP endpoint:
http://44.223.28.33:9650/ext/bc/RfX8YRUHePxFENBZFwaNt1tP6CR6RQ4hJJ5AqYv49LRoSKniK/rpc
See the reference for more information about resources lifecycle management.