Optional: Helper scripts
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 machine
docker exec bitcoin-ipc tail -f /root/logs/monitor-validator1.log# From your host machine
docker exec bitcoin-ipc tail -f /root/logs/provider-validator1.log# From your host machine
docker exec bitcoin-ipc tail -f /root/logs/relayer-subnet-a-validator1.log# From your host machine
docker exec bitcoin-ipc tail -f /root/logs/relayer-subnet-b-validator1.logAnd 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:
# Inside the `bitcoin-ipc` container
/workspace/bitcoin-ipc/scripts/miner.shIf 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 is run as follows:
If you are using the alternative method, running bitcoin core on your host machine:
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 themuse 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 Optional: Manual subnet creation and deployment). 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
8545for validator 18645for validator 28745for validator 38845for validator 48945for validator 5
Subnet B:
9545for validator 19645for validator 29745for validator 39845for validator 49945for 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
26657for validator 126757for validator 226857for validator 326957for validator 427057for validator 5
Subnet B:
27657for validator 127757for validator 227857for validator 327957for validator 428057for 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.
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 Optional: Manual subnet creation and deployment.
Last updated