In this page we outline all helper scripts that will be used throughout this demo. You do not need to run them all at once -- the documentation will guide you on when to run each script.
The following scripts assume that you have created the necessary config files and started the bitcoin monitor and provider binaries (see Installation). We recommend that you start each of the following scripts in a separate terminal.
Watch log files
When the bitcoin-ipc container is started, it automatically runs the a Bitcoin Monitor and a Bitcoin Provider for each of the four validators. Moreover, the scripts spin_up_subnet_a_from_container.sh and spin_up_subnet_b_from_container.sh , that deploy the subnet validators, start a Relayer for each validator. The log files live inside the container at /root/logs/. To see them:
# From your host machinedockerexecbitcoin-ipctail-f/root/logs/monitor-validator1.log
# From your host machinedockerexecbitcoin-ipctail-f/root/logs/provider-validator1.log
# From your host machinedockerexecbitcoin-ipctail-f/root/logs/relayer-subnet-a-validator1.log
# From your host machinedockerexecbitcoin-ipctail-f/root/logs/relayer-subnet-b-validator1.log
And accordingly for validator2 , validator3 , validator4 , validator5 , user1 , user2 .
Mine blocks on bitcoin
The script mines a regtest block every 10 seconds.
If you are using the default Docker-based deployment, the script is automatically started upon creation of the bitcoin-ipc container. You can start it manually running in the bitcoin-ipc container:
/workspace/bitcoin-ipc/scripts/miner.sh
If you are using the alternative method, running bitcoin core on your host machine, you can run the script from the root of the bitcoin-ipc repo:
Get regtest block height
The script queries and returns the block height on the local regtest network every 10 seconds.
If you are using the default Docker-based deployment, the script must be run from inside the bitcoin-ipc container:
If you are using the alternative method, running bitcoin core on your host machine, you can run from the root of the bitcoin-ipc repo:
Get status of a subnet, as seen from bitcoin
In this following script, make sure that you
update the bitcoin provider port (default in our setup: 3030) and the corresponding auth token (default in our setup: validator1_auth_token), if you have changed them
use the ID of a subnet already created.
Run the following command on your host machine:
The command returns, among others, the current committee number (the validator set can change, as we will see in Validator Operations within subnet), the current validator set and the collateral staked by each validator, information on pending committee updates, and information on whether the subnet has been or will be killed.
Get submitted kill requests, as seen from bitcoin
It returns the kill requests, if there are any, for a subnet. We will use it in Kill subnet to keep track of active kill requests and the validators that have voted for each of them. As before, please make sure you
are using the correct port and auth token, if you have changed them
use the subnet id of an already created subnet
Run the following command on your host machine:
L2 Subnet tools
The following scripts operate on a specific L2 subnet. They can be run only after the docker containers for the subnet have been started (in page Deploy the validators). The scripts are run from the root of the bitcoin-ipc repo.
Get subnet block height
It queries and prints the current block height of a subnet every 1 second. You will need the $ETH_API_PORT of one of the validators of the subnet you want to query — by default in this demo:
Subnet A
8545 for validator 1
8645 for validator 2
8745 for validator 3
8845 for validator 4
8945 for validator 5
Subnet B:
9545 for validator 1
9645 for validator 2
9745 for validator 3
9845 for validator 4
9945 for validator 5
Get validator status
It shows information for a validator by querying its CometBFT container. You will need the $COMETBFT_PORT of one of the validators of the subnet you want to query — by default in this demo:
Subnet A
26657 for validator 1
26757 for validator 2
26857 for validator 3
26957 for validator 4
27057 for validator 5
Subnet B:
27657 for validator 1
27757 for validator 2
27857 for validator 3
27957 for validator 4
28057 for validator 5
Get validator set
It shows all current validators and their voting power for a subnet. As with the previous command, you need the $COMETBFT_PORT of one of the validators of the subnet you want to query.
In the returned information notice the field voting_power of each validator.
How the voting power is computed:
The voting power of each validator corresponds to the amount it stakes in the subnet, expressed as an integer between 1 and 10,000.
For example, if four validators stake 2, 1.1, 1.5, and 1.8 bitcoin each, their voting power will be 2000, 1100, 1500, and 1800, respectively.
Get balances in subnet
It shows the balance in subnet $SUBNET_ID of every wallet of type btc created with ipc-cli .
If you are using the default Docker-based deployment, run this script from inside the container:
If you are using the alternative method, running ipc-cli on your host machine, from the root of the bitcoin-ipc repo on your machine:
Spin up subnet A and subnet B
The following tools can be used to start the docker containers for four validators for two subnets. We will use them in Deploy the validators.