Optional: Manual subnet creation and deployment
Alternative: Install on the host machine
If in page Installation you chose the alternative deployment — hence bitcoin-core , the monitors and providers, and ipc-cli are running on your host machine — then you must also use this alternative approach here to create a child subnet.
Even if you used the default Docker-based deployment, you still have the option to use this alternative approach here to create a child subnet. In that case, you need to run all following commands from inside the bitcoin-ipc container — the ipc and bitcoin-ipc repos can be found in the /root/workspace directory.
Step 1: Create a child subnet
We can now create a subnet under /b4 — Bitcoin Regtest. If you have not created the env variable, replace $WHITELIST with the one you created earlier.
ipc-cli --config-path ~/.ipc/validator1/config.toml subnet create \
--parent /b4 --min-validators 4 --bottomup-check-period 60 \
btc --min-validator-stake 100000000 --min-cross-msg-fee 10 \
--validator-whitelist $WHITELISTYou should see the subnet ID printed to the console. Let's save the subnet ID for later use — we will refer to it as $SUBNET_ID.
export SUBNET_ID="the_new_subnet_id_from_terminal"You can now start the miner helper script (as described in Optional: Helper scripts) by running the following from the bitcoin-ipc repo:
./scripts/miner.shAll monitors should have printed the subnet create message to the console.
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
It might be easier to leave those files open in an editor, so we can modify them later when we create a second subnet.
A subnet configuration looks as follows. For ease of use, each config.toml file already contains the entry — you only have to replace /b4/t410fyi77izvsakigfjnocb7f3hm52bjdeb76jayo4ti with your SubnetID.
Step 3: Join the subnet
Let's have four validators join the subnet with some initial collateral.
Let's include the join transactions in the blockchain by mining a block (not needed if you are running the miner.sh script).
We should see the monitors print the join messages to the console, and also reporting that the subnet has been bootstrapped, like so:
Step 4: Fund the validators
All validators need to have some balance in the subnet, as they use it to pay transaction fees. Let's fund their accounts with wBTC.
Make sure you mine a block (not needed if you are running the miner.sh script).
You should see the logs being printed, like so:
Step 5A: Spin-up docker containers using script
We have provided a script that automates spinning up the subnets. The script assumes that you have used the ports, wallet names, and authentication tokens as described in these docs, and that you have already created and joined a subnet with four validators, and that the monitor and provider binaries for those validators are running.
Make sure docker is running on your machine.
The only input to the script is the subnet id. From the bitcoin-ipc repo, run
Verify on docker that the containers are up and running — for each validator there should be three containers: validatorX-fendermint , validatorX-cometbft , and validatorX-ethapi .
You can now use the the scripts provided in Optional: Helper scripts to check the status of the subnet.
In particular, you can verify that the subnet is producing blocks:
and check the balances in the subnet
Step 5B (Optional): Deploy the infrastructure using cargo make
Instead of using the spin_up_subnet_a.sh script, you can manually start the validator.
Let's start with the first validator, which the rest of the validators will bootstrap from. Make sure you have docker running before running this command.
Once the first validator is up and running, it will print out the relative information for this validator.
This is shown in this video guide.
You'll need the final component of the IPLD Resolver Multiaddress (the peer ID) and the CometBFT node ID for the next nodes to start.
BOOTSTRAPS: <CometBFT node ID for validator1>@validator-1-cometbft:26656
RESOLVER_BOOTSTRAPS: /dns/validator-1-fendermint/tcp/26655/p2p/<Peer ID in IPLD Resolver Multiaddress>, where <PeerID> is the last part of the IPLD Resolver Multiaddress
Now, let's start the rest of the validators:
Last updated