Skip to content

Commit

Permalink
Update transition-phase-2.md
Browse files Browse the repository at this point in the history
  • Loading branch information
samricotta committed Dec 18, 2024
1 parent 3750005 commit 907fa36
Showing 1 changed file with 74 additions and 39 deletions.
113 changes: 74 additions & 39 deletions docs/transition-phase-2.md
Original file line number Diff line number Diff line change
@@ -1,59 +1,95 @@
# Transition your stake from phase-1 to phase-2 through CLI

<!-- TODO -->


> **⚡ Note:** This program is a separate implementation from the staker program
> used for Phase-1. All stakers are required to transition their stakes to this
> program to participate in Phase-2.
## Understanding the transition

The transition from phase-1 to phase-2 is a manual process that requires the
staker to transition their stake to phase-2 of the Babylon network.
This transition has the option of being executed through the `stakercli` binary
and this guide will show you how to do it through the `stakercli` binary. For
detailed information about stake eligibility
criteria, registration requirements, and how to gain voting power and earn
rewards in phase-2, please refer to the
[phase-2 transition guide](https://gist.github.com/vitsalis/9ebfd19bbde310e0bf4a70e7ab15a290).
<!-- TODO: Update link -->

## Table of Contents
- [Prerequisites](#prerequisites)
- [1. Setup](#1-setup)
- [2. Transition your stake](#2-transition-your-stake)
- [Setup](#setup)
- [Transition your stake](#transition-your-stake)
- [Verify the transition](#verify-the-transition)

## Prerequisites

To transition your stake from phase-1 to phase-2, you need to have the following:
- Global parameter file as seen here https://github.com/babylonlabs-io/networks/blob/main/bbn-5/parameters/global-params.json that were used in phase-1
- The Bitcoin block height in which your staking transaction was included
- Your `btc-staker` binary setup and running inclusive of the btc staker config
properly setup

## 1. Setup

First, you need to run the upgrade setup which configures the environment and
runs necessary upgrade procedures:

```bash
cd deployments/local
make bbn-upgrade-v1
```

Next, you need to dump the default configuration file. This creates a template
that you'll customize with your specific values (like your Bitcoin block height
that your staking transaction was included in, wallet credentials,
and network details):
To transition your stake from phase-1 to phase-2, you need to have the
following:
- Access to your existing Bitcoin wallet from phase-1 (needed to sign transactions
and prove ownership of staked funds).
- The Bitcoin block height in which your staking transaction was included, which
will be used in the transition command.
- A funded Babylon address, which will be used to receive the rewards from the
transition.
- Global parameter file as seen here https://github.com/babylonlabs-io/networks/blob/main/bbn-test-5/parameters/global-params.json
that were used in phase-1. This will be used in the transition command later
on.
- A running instance of the `stakercli` binary. Please follow the `stakercli`
[setup guide](../README.md#3-btc-staker-installation) to complete the setup of
the `stakercli` with your keys before proceeding.

## Setup

First, you will need to dump the default configuration file. This creates a
template configuration file that you'll customize with your specific values
(like your Bitcoin block height that your staking transaction was included in,
wallet credentials, and network details):

```bash
stakercli admin dump-config
```

This will create a `config.json` file in your current working directory.
You'll need to modify this file with your specific settings before proceeding.
You'll need to modify this file with your specific settings before proceeding.
Here are the key configurations:

### Bitcoin Configuration
```toml
[walletconfig]
WalletName = "btc-staker" # Your Bitcoin wallet name
WalletPass = "your-wallet-password" # Your wallet password

[walletrpcconfig]
Host = "127.0.0.1:19001" # Your Bitcoin node RPC endpoint
User = "your-rpc-user" # Your Bitcoin RPC username
Pass = "your-rpc-pass" # Your Bitcoin RPC password

[chain]
Network = "signet" # Bitcoin network (signet for testnet)
```

Finally, start the `btcstaker` daemon which will manage your connections to both
Babylon and Bitcoin nodes, monitor transactions, and handle the staking process:
### Babylon Configuration
```toml
[babylon]
Key = "btc-staker" # Your Babylon key name
ChainID = "bbn-test-5" # Babylon chain ID
RPCAddr = "http://localhost:26657" # Babylon RPC endpoint
GRPCAddr = "https://localhost:9090" # Babylon gRPC endpoint
AccountPrefix = "bbn" # Babylon address prefix
KeyringBackend = "test" # Keyring backend type
GasPrices = "0.01ubbn" # Minimum gas price
```

Finally, start the `btcstaker` daemon, which will manage your connections to both
Babylon and Bitcoin nodes, monitor transactions, and handle the staking process.
Add the location for the above created `config.json` file to the command:

```bash
stakercli admin start
stakerd --configfile <config-file-path> admin start
```

## 2. Transition your stake
## Transition your stake

After setting up the configuration file and starting the `btcstaker` daemon,
you can proceed to transition your stake from Phase-1 to Phase-2 using the
following command. We use the `global_parameters.json` file that you should
Following the setup of the configuration file and starting the `btcstaker`
daemon, you can proceed to transition your stake from Phase-1 to Phase-2 using
the following command. We use the `global_parameters.json` file that you should
already have created as stated in the prerequisites.

```shell
Expand All @@ -66,7 +102,6 @@ stakercli daemon stake-from-phase1 <global-parameters-file> \
parameters:
- `global-parameters-file`: The path to the global parameters file.
- `your-phase1-tx-hash`: The original hash of your phase-1 staking transaction.
- `your-btc-address`: BTC address of the staker in hex
- `your-btc-address`: BTC address of the staker in hex.
- `block-height`: The block height at which your staking transaction was
included.

included.

0 comments on commit 907fa36

Please sign in to comment.