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

Add a best-effort method for estimating liquidity fees #107

Merged
merged 1 commit into from
Aug 28, 2024
Merged

Conversation

pm47
Copy link
Member

@pm47 pm47 commented Aug 28, 2024

Returns a best-effort estimate of liquidity fees for a given amount.

Note that:

  • it depends on the current mining feerate, which is volatile
  • this estimate is the full cost, it doesn't take into account the fee credit (which will be deducted)
  • if you receive A sat with a setting of --auto-liquidity B, then the actual liquidity amount will be A+B sat.
./phoenix-cli estimateliquidityfees --amountSat 2000000
{
    "miningFeeSat": 1219,
    "serviceFeeSat": 20000
}

See #88,#104.

Returns a best-effort *estimate* of liquidity fees for a given amount.

Note that:
- it depends on the current mining feerate, which is volatile
- this estimate is the full cost, it doesn't take into account the
  `feeCredit` (which will be deduced)
- if you receive `A sat` with a setting of `--auto-liquidity B`, then
  the actual liquidity amount will be A+B.

```
./phoenix-cli estimateliquidityfees --amountSat 2000000
{
    "miningFeeSat": 1219,
    "serviceFeeSat": 20000
}

```

See #88,#104.
@pm47 pm47 requested a review from t-bast August 28, 2024 14:19
Copy link
Member

@t-bast t-bast left a comment

Choose a reason for hiding this comment

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

LGTM 👍

Maybe it could be useful to also optionally provide a feerate to override the one used by phoenixd? Since the feerate that phoenixd uses internally is not the feerate that will be used for pay-to-open (it will be a feerate decided by the LSP)? Or we don't care for now since this will get better with the new on-the-fly funding, at which point we will know the feerate that will be used?

@pm47
Copy link
Member Author

pm47 commented Aug 28, 2024

Since the feerate that phoenixd uses internally is not the feerate that will be used for pay-to-open (it will be a feerate decided by the LSP)? Or we don't care for now since this will get better with the new on-the-fly funding, at which point we will know the feerate that will be used?

It's not the same because of sampling frequency, but it's the same source (phoenix gets its feerate from mempool.space, not electrum). I'd keep things simple, waiting for the new on-the-fly.

@pm47 pm47 merged commit 6815e01 into master Aug 28, 2024
@pm47 pm47 deleted the liquidity-fee branch August 28, 2024 14:54
@danielcharrua

This comment was marked as off-topic.

vincenzopalazzo pushed a commit to vincenzopalazzo/phoenixd that referenced this pull request Nov 7, 2024
Returns a best-effort **estimate** of liquidity fees for a given amount.

Note that:
- it depends on the current mining feerate, which is volatile
- this estimate is the full cost, it doesn't take into account the `fee credit` (which will be deduced)
- if you receive `A` sat with a setting of `--auto-liquidity B`, then the actual liquidity amount will be `A+B` sat.

```
./phoenix-cli estimateliquidityfees --amountSat 2000000
{
    "miningFeeSat": 1219,
    "serviceFeeSat": 20000
}

```

See ACINQ#88,ACINQ#104.
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.

3 participants