octagon-exclamationKill subnet

An L2 subnet can be discontinued, or simply killed.

circle-check

Step 1: Propose a kill

Let's have validator 1 propose a kill for a subnet — make sure you have set $SUBNET_ID to the subnet you want to be killed.

ipc-cli --config-path ~/.ipc/validator1/config.toml subnet kill --subnet $SUBNET_ID btc

Observe the result:

Mine a new block, wait until the bitcoin-provider binary processes the block, and you should see bitcoin monitor showing a message like the following:

Kill request added for subnet /b4/t410fafkd6bwax3vxeqan6dwqnhja3iw666wlngjey4a but majority not reached: 15000/64000 power (threshold: 42667)

You can use the getkillrequests helper script, as presented in Helper scripts. This will show one active kill request for the subnet. You can also use the getsubnet helper script, also presented in Helper scripts. In the output observe the field "killed", which still shows the subnet as "not_killed".

Check the balances on bitcoin:

Let's check the balance of the validators on the bitcoin network at this point:

Step 2: Vote for the kill

Let's have validators 2 and 3 vote for that kill request.

Observe the result:

Now the bitcoin monitor should show a message like the following:

The script getkillrequests, as presented in Helper scripts will now show three entries, as three validators have proposed and accepted the termination of the subnet. The script getsubnet now shows in the field "killed" the subnet as "to_be_killed".

circle-check
triangle-exclamation

Step 3: Release user funds

circle-exclamation

At this point, user 1 still has 0.5 wBTC in the subnet. Let's release it, using the following command.

To check the balance of the user on the subnet, you can observe the output of the balancer helper script, or use:

Step 4: Wait for the subnet to be killed

circle-exclamation

The subnet will be be killed after five bottom-up checkpoints are created by the subnet. Then you can verify that the bitcoin balance of the validators has been updated using the same commands as before:

The balance of each validator has increased by its collateral, and the funds that were not withdrawn were divided among the validators.

The script getsubnet, as presented in Helper scripts, now shows the subnet as "killed". The subnet is not anchored on bitcoin anymore, it cannot create checkpoint messages, and it cannot perform cross-subnet transfers. The docker containers can now be stopped.

Last updated