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

docs: BTC eligibility Document - Staking TX #577

Open
wants to merge 2 commits into
base: feat/btc-eligibility-doc
Choose a base branch
from

Conversation

samricotta
Copy link
Contributor

@samricotta samricotta commented Feb 26, 2025

Two questions on this:

  • is it detailed enough
  • Should we still include serialisation format for OP_RETURN data?

@samricotta samricotta mentioned this pull request Feb 26, 2025
7 tasks
- **Merkle Root**: Inside `Q`, commits to spending rules (timelock,
unbonding, slashing)
- **Internal Public Key**: Used to derive `Q`
3. **`OP_RETURN` Output**: Contains Babylon metadata (tag, `staker_pk`,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder wheter we need to focus on op_return at all here. It was only necessary in phase-1 and it won't used in phase-2 at all.


### Sending a TX
A staking transaction is different to the other transactions. It creates a UTXO
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the critical piece of infromation there here is that staking transactions must contain exactly one UTXO which commits to Babylon designed scripts.

All other UTXOs are ignored by Babylon

1. **Inputs**: References previous UTXOs, provides BTC
2. **Taproot Output (`staking_output`)**: The vault that locks BTC. Commits
to a script tree composed of the three scripts (timelock, unbondng and slashing.)
- **Taproot Public Key**: Created in the Taproot output, commits to `m`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Imo it would be clearer if this whole info:

Taproot Public Key: Created in the Taproot output, commits to m (Merkle root)
Merkle Root: Inside Q, commits to spending rules (timelock, unbonding, slashing)
Internal Public Key: Used to derive Q

was presented in separate sub-section similiarty to what is done in current impl doc:

Taproot outputs are outputs whose locking script is an elliptic curve point Q created as follows:

Q = P + hash(P||m)G
where:

P is the internal public key
m is the root of a Merkle tree whose leaves consist of a version number and a script
For Bitcoin Staking transactions, the internal public key is chosen as:

P = lift_x(0x50929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0)

```

<!-- should we still include serialisation format for OP_RETURN data? -->
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I would leave out the op_return at all from this docs as it is inteneded for phase-2 and onwards.


### Sending a TX
The following are **not yet** needed.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I would delete this list. We do not know what inputs are used to create the staking transaction. It is possible the input to the staking transaction is previous staking output, then user would need to have those 😅


```go
func BuildV0IdentifiableStakingOutputsAndTx(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would use functions without the op_return i.e

func BuildStakingInfo(
	stakerKey *btcec.PublicKey,
	fpKeys []*btcec.PublicKey,
	covenantKeys []*btcec.PublicKey,
	covenantQuorum uint32,
	stakingTime uint16,
	stakingAmount btcutil.Amount,
	net *chaincfg.Params,
) (*StakingInfo, error) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants