Second subnet creation, initialisation and deployment
This page will guide you to setup a second subnet. It is similar to the Creation and initialization of the first subnet.
For simplicity, the new subnet we are creating is run by the same validators as the first subnet. This is not mandatory.
Step 1: Create a child subnet
Exactly the same as in Subnet creation and initialisation:
ipc-cli --config-path ~/.ipc/validator1/config.toml subnet create \
--parent /b4 --min-validators 4 --bottomup-check-period 120 \
btc --min-validator-stake 100000000 --min-cross-msg-fee 10 \
--validator-whitelist $WHITELIST
Make sure you write down the subnet id or export it to a env variable $SUBNET_ID
.
Step 2: Update the config.toml files
We now need to add the new subnet configuration to all of the following configuration files:
~/.ipc/validator1/config.toml
~/.ipc/validator2/config.toml
~/.ipc/validator3/config.toml
~/.ipc/validator4/config.toml
~/.ipc/validator5/config.toml
~/.ipc/user1/config.toml
~/.ipc/user2/config.toml
~/.ipc/config.toml
Notice that this time we are changing the entry for Subnet B. The config files already contain the corresponding entry, you only have to replace /b4/t410ftkmrmongfxyrefwgpyz524taorvrijfwfzrfwgy
with the new subnet id.
# Subnet B
[[subnets]]
id = "/b4/t410ftkmrmongfxyrefwgpyz524taorvrijfwfzrfwgy"
[subnets.config]
network_type = "fevm"
provider_http = "http://localhost:9545/"
gateway_addr = "0x77aa40b105843728088c0132e43fc44348881da8"
registry_addr = "0x74539671a1d2f1c8f200826baba665179f53a1b7"
Step 3: Join the subnet
Exactly the same as in Subnet creation and initialisation:
ipc-cli --config-path ~/.ipc/validator1/config.toml subnet join --from $IPC_ADDRESS_OF_VALIDATOR_1 --subnet $SUBNET_ID btc --collateral=200000000 --ip 66.222.44.55:8080 --backup-address "$(bitcoin-cli --rpcwallet=validator1 getnewaddress)"
ipc-cli --config-path ~/.ipc/validator2/config.toml subnet join --from $IPC_ADDRESS_OF_VALIDATOR_2 --subnet $SUBNET_ID btc --collateral=110000000 --ip 66.222.44.55:8081 --backup-address "$(bitcoin-cli --rpcwallet=validator2 getnewaddress)"
ipc-cli --config-path ~/.ipc/validator3/config.toml subnet join --from $IPC_ADDRESS_OF_VALIDATOR_3 --subnet $SUBNET_ID btc --collateral=150000000 --ip 66.222.44.55:8082 --backup-address "$(bitcoin-cli --rpcwallet=validator3 getnewaddress)"
ipc-cli --config-path ~/.ipc/validator4/config.toml subnet join --from $IPC_ADDRESS_OF_VALIDATOR_4 --subnet $SUBNET_ID btc --collateral=180000000 --ip 66.222.44.55:8083 --backup-address "$(bitcoin-cli --rpcwallet=validator4 getnewaddress)"
Step 4: Fund the validators
Exactly the same as in Subnet creation and initialisation:
ipc-cli --config-path ~/.ipc/validator1/config.toml cross-msg fund --subnet=$SUBNET_ID btc --to $IPC_ADDRESS_OF_VALIDATOR_1 210000000
ipc-cli --config-path ~/.ipc/validator2/config.toml cross-msg fund --subnet=$SUBNET_ID btc --to $IPC_ADDRESS_OF_VALIDATOR_2 220000000
ipc-cli --config-path ~/.ipc/validator3/config.toml cross-msg fund --subnet=$SUBNET_ID btc --to $IPC_ADDRESS_OF_VALIDATOR_3 230000000
ipc-cli --config-path ~/.ipc/validator4/config.toml cross-msg fund --subnet=$SUBNET_ID btc --to $IPC_ADDRESS_OF_VALIDATOR_4 240000000
Step 5: Deploy the validators
Similar to Spin up the subnet and deploy the validators, we recommend that you use the helper script to deploy the validator containers for the second subnet. This is because all the ports change, and this can be tricky to do manually.
./scripts/spin_up_subnet_b.sh $SUBNET_ID
Step 6: Check the status of the subnet
Exactly the same as in Spin up the subnet and deploy the validators:
Run the block_checker helper script:
./scripts/l2_block_checker.sh $SUBNET_ID
Run the balancer helper script:
./scripts/balancer.sh $SUBNET_ID
Last updated