Skip to content
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

BTC Staker Improvements #107

Open
KonradStaniec opened this issue Dec 18, 2024 · 0 comments
Open

BTC Staker Improvements #107

KonradStaniec opened this issue Dec 18, 2024 · 0 comments
Labels
EPIC Big task or collections of task that must be split into smaller pieces

Comments

@KonradStaniec
Copy link
Collaborator

This epic describes possible improvements to BTC staker based on most recent developments.

Delete watch-staking endpoint

The exsiting endpoint watch-staking endpoint was only introduced as hack for the past testnet. It can be deleted. It should simplify database and logic in stakerapp as there are different code paths to handle this request (example: https://github.com/babylonlabs-io/btc-staker/blob/v0.13.0/staker/stakerapp.go#L1502)

Remove post-approval flow

In the past the only way to stake was:

  1. first send staking transaction to BTC and wait for it to be confirmed
  2. then send delegation to BTC

This flow is currently discouraged.

Currently staker supports both flows: pre-approval and post-approval, due to the fact that it was easier and quicker to add additional flow rather than do fully fledged refactoring. Difference in handling both flows can be tracked from handling staking cmd.

Removal of post-approval flow, should result in simplifications in btc-staker logic. It should also result in possibility of dropping most of the state from btc-staker database.

Reduce amount of state held in Database

Currently btc-staker, holds a lot of state in its database which leads to complex logic when restarting the program.

After removing post-approval flow and watch-staking endpoint it should be possible to remove most of the state from btc-staker database and relay mostly only Babylon blockchain as some sort of storage for all the data related to staking. In theory, the only thing that btc-staker could store in its local db are staking transactions hashes for initiated staked requests.

Track status of each sent staking transaction with each new BTC block

Currently btc-staker tracks the state changes of the sent staking transactions based on the operations initiated from btc-staker. i.e if user would unbond his staker from other place (lets say front end ui) the btc staker would be left with invalid db state. This is less than ideal.

The most comprehensive solution would be:

  • create descriptors of Babylon staking scripts
  • with each staking request import descriptor describing used staking/unbonding scripts through https://developer.bitcoin.org/reference/rpc/importdescriptors.html bitocoind endpoint
  • this way funds locked in staking scripts would be treated as internal to bitcoind wallet i.e they would treated similarity as native p2wpkh addresses.
@KonradStaniec KonradStaniec added the EPIC Big task or collections of task that must be split into smaller pieces label Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
EPIC Big task or collections of task that must be split into smaller pieces
Projects
None yet
Development

No branches or pull requests

1 participant