-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: register stake to Babylon chain #105
base: main
Are you sure you want to change the base?
Changes from all commits
3750005
907fa36
fa8073a
6d25cf1
d2ec9da
284e1a0
e231416
e63314a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,154 @@ | ||||||||
# Register your Phase-1 stake to Phase-2 through CLI | ||||||||
|
||||||||
## Understanding the registration process | ||||||||
|
||||||||
To register your Bitcoin stake on the Babylon chain, you must have a confirmed | ||||||||
Bitcoin staking transaction. Before proceeding, please review the | ||||||||
[Registration of Existing Stakes to the Babylon Chain](https://github.com/babylonlabs-io/babylon/blob/main/docs/stake-registration.md) | ||||||||
documentation to check your eligibility and understand the registration | ||||||||
requirements and process. | ||||||||
|
||||||||
## Table of Contents | ||||||||
- [Prerequisites](#prerequisites) | ||||||||
- [Setup and configuration](#setup-and-configuration) | ||||||||
- [Register your stake](#register-your-stake) | ||||||||
- [Verify your registration](#verify-your-registration) | ||||||||
- [Receiving rewards](#receiving-rewards) | ||||||||
|
||||||||
## Prerequisites | ||||||||
|
||||||||
To register your stake to the Babylon blockchain, the following are required: | ||||||||
- Access to the Bitcoin wallet you have used to create your stake on Bitcoin | ||||||||
(needed to sign transactions). | ||||||||
- The Bitcoin block height in which your staking transaction was included, which | ||||||||
will be used in the registration command. | ||||||||
- A funded Babylon address, which will be used to receive the rewards from the | ||||||||
registration. | ||||||||
- Global parameter file as seen here https://github.com/babylonlabs-io/networks/blob/main/bbn-test-5/parameters/global-params.json | ||||||||
that were used when you created your Bitcoin stake. This will be used in the | ||||||||
registration command later on. | ||||||||
- A running instance of the `stakerd` daemon. Please follow the `stakerd` | ||||||||
[setup guide](../README.md#3-btc-staker-installation) to complete the setup. | ||||||||
This is also inclusive of creating a Babylon keyring with funds step as the | ||||||||
`stakerd` daemon requires a funded keyring to pay for the transactions. | ||||||||
|
||||||||
## Setup and configuration | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't need this section I think. I explained everything in my above recommendation on the pre-requisites. If we need it, I think it's a bit confusing. We ask the staker as a pre-requisite to set up the stakerd daemon, but then we tell them "You need to create a new config file" and connect it to a different wallet and then start again. Doesn't make sense for me. We can just tell them (as I did in the pre-requisites edit) "set up your stakercli daemon to connect to the wallet you used". They can figure it out |
||||||||
|
||||||||
> **⚡ Note**: While the `stakerd` daemon is already running, it needs access to | ||||||||
> the Bitcoin wallet containing your staking transaction's private key. This | ||||||||
> setup ensures the daemon can interact with the correct Bitcoin wallet. | ||||||||
To get started, you will need to create a configuration file. You can do this | ||||||||
by running the `dump-config` command. This will create a `config.json` file | ||||||||
in your current working directory that you'll customize with your specific | ||||||||
values: | ||||||||
|
||||||||
```bash | ||||||||
stakercli admin dump-config | ||||||||
``` | ||||||||
|
||||||||
The configuration file below contains default settings and placeholders | ||||||||
for your Bitcoin and Babylon values. Please replace the placeholders with | ||||||||
your specific information: | ||||||||
|
||||||||
```toml | ||||||||
[walletconfig] | ||||||||
WalletName = "btc-staker" # Replace with your Bitcoin wallet name | ||||||||
WalletPass = "your-wallet-password" # Replace with your wallet password | ||||||||
|
||||||||
[walletrpcconfig] | ||||||||
Host = "127.0.0.1:19001" # Bitcoin Wallet RPC endpoint | ||||||||
User = "your-rpc-user" # Replace with your Bitcoin RPC username | ||||||||
Pass = "your-rpc-pass" # Replace with 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. | ||||||||
Add the location for the above created `config.json` file to the command: | ||||||||
|
||||||||
```shell | ||||||||
stakerd --configfile <config-file-path> admin start | ||||||||
``` | ||||||||
|
||||||||
## Register your stake | ||||||||
|
||||||||
After configuring and starting the `btcstaker` daemon, you'll need the | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
`global_parameters.json` file (created during prerequisites) for the next steps. | ||||||||
|
||||||||
A few notes about the `global-parameters.json` file: | ||||||||
1. It is used to retrieve covenant keys and quorum from the parameters version | ||||||||
you staked in. | ||||||||
2. It can also be used to parse your Bitcoin staking transaction to extract | ||||||||
important information from the `OP_RETURN` data, which contains: | ||||||||
- The staking period you chose | ||||||||
- The finality provider you chose | ||||||||
|
||||||||
> **⚡ Note**: While these parameters can be provided manually, the global | ||||||||
> parameters file provides an easier user experience. This guide is only for | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
> valid, confirmed Bitcoin staking transactions with valid `OP_RETURN` data. If | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
> your transaction has malformed `OP_RETURN` data or isn't a confirmed staking | ||||||||
> transaction, to check your eligibility please refer to the | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
> [registration eligibility guide](registration-eligibility.md). | ||||||||
Now that you have the `global-parameters.json` file, you can register your | ||||||||
Bitcoin stake by running the following command: | ||||||||
|
||||||||
```shell | ||||||||
stakercli daemon stake-from-phase1 <global-parameters-file> \ | ||||||||
--staking-transaction-hash <your-phase1-tx-hash> \ | ||||||||
--staker-address <your-btc-address> \ | ||||||||
--tx-inclusion-height <block-height> | ||||||||
``` | ||||||||
|
||||||||
Parameters: | ||||||||
- `global-parameters-file`: The path to the global parameters file. | ||||||||
samricotta marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||
- `your-phase1-tx-hash`: The original hash of your Bitcoin staking transaction. | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
- `your-btc-address`: BTC address of the staker in hex. | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hex? This is weird. Shouldn't it be the normal address? |
||||||||
- `block-height`: The BTC block height at which your staking transaction was | ||||||||
included. | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What happens afterwards? How does the staker view that their registration has been successful? What can they do next to monitor their stakes and withdraw rewards? This guide feels incomplete. |
||||||||
|
||||||||
The above command will output a transaction hash similar to below | ||||||||
that you can use to verify the registration on the Babylon blockchain, which | ||||||||
you will see in the next section. | ||||||||
|
||||||||
```json | ||||||||
{ | ||||||||
"babylon_btc_delegation_tx_hash": "<btc-delegation-tx-hash>" | ||||||||
} | ||||||||
``` | ||||||||
|
||||||||
## Verify your registration | ||||||||
|
||||||||
Following the registration of your Bitcoin stake, you can verify your | ||||||||
registration by checking your balance on the [Babylon Explorer](https://babylon-testnet.l2scan.co) | ||||||||
by searching for the `<babylon_btc_delegation_tx_hash>` value. | ||||||||
|
||||||||
This will then give you details on your transaction, which includes the state | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The below states relate to the statuses maintained by |
||||||||
of the transaction, which can be one of the following: | ||||||||
|
||||||||
- `SENT_TO_BTC` - Initial state | ||||||||
- `CONFIRMED_ON_BTC` - Bitcoin confirmation | ||||||||
- `SENT_TO_BABYLON` - Registration submitted to Babylon | ||||||||
- `VERIFIED` - Registration verified | ||||||||
- `DELEGATION_ACTIVE` - Stake active and has voting power | ||||||||
- `UNBONDING_CONFIRMED_ON_BTC` - Unbonding in progress | ||||||||
- `SPENT_ON_BTC` - Stake withdrawn | ||||||||
|
||||||||
Depending on the state of the transaction, you can see the progress of the | ||||||||
registration on the Babylon blockchain, as it will take a few minutes for the | ||||||||
transaction to be verified and the stake to be active. | ||||||||
|
||||||||
## Receiving rewards | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't need this section. Let's remove it |
||||||||
|
||||||||
Following registration, rewards will be accrued to your Babylon address | ||||||||
(configured in `stakerd`). | ||||||||
|
||||||||
> **⚠️ Important**: While rewards are accumulating to your Babylon address, | ||||||||
> withdrawals are not yet available. You will be able to access your rewards | ||||||||
> once the claiming feature is implemented. | ||||||||
To monitor your rewards, you can use the [Babylon Explorer](https://babylon-testnet.l2scan.co) | ||||||||
to check your balance on the Babylon blockchain using your Babylon address. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.