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 MINT_MAX_BALANCE_ISSUED setting #646

Closed
minibits-cash opened this issue Oct 25, 2024 · 9 comments
Closed

Add MINT_MAX_BALANCE_ISSUED setting #646

minibits-cash opened this issue Oct 25, 2024 · 9 comments

Comments

@minibits-cash
Copy link

minibits-cash commented Oct 25, 2024

MINT_MAX_BALANCE_ISSUED would serve the purposes, when the mint operator wants to make sure the mint can not issue more units of ecash than the configured value.

This can serve multiple purposes - as a security limit as well as an imposed limit in case the unit issued is backed by a derivative position at the exchange that is pre-funded - i.e. fully hedged against exchange rate changes to bitcoin upfront it is available to be issued as ecash.

@lollerfirst
Copy link
Contributor

I wonder if this is information we should display in a GET /v1/info request.
If so, we should probably do a NUT about it.

@minibits-cash
Copy link
Author

Agree, but I think it's not a prerequisite for implementation. From user pov max one time mint / melt limits that are already there are more important then a total.

@lollerfirst
Copy link
Contributor

lollerfirst commented Oct 26, 2024

@minibits-cash There's two ways I would do this:

  1. When generating a mint quote, sneak in a balance request to the LN backend right before requesting the invoice.
    If balance >= MINT_MAX_BALANCE_ISSUED then abort
  2. Add a table to the DB that keeps track of the amounts worth of issued ecash for each unit, then for every mint quote
    request check that the balance for the particular unit is not exceeded.

What do you think?

@minibits-cash
Copy link
Author

minibits-cash commented Oct 26, 2024

I think it's fully upon mint to enforce it and just fail the first mint request hitting the limit.

@lollerfirst
Copy link
Contributor

Yes. I was referring to how I would implement this here in Nutshell.

bff30d4#diff-563ab1fc2a5b2676a9794be3b08bb863afc36b495cbe4653ced3fdeb430bf530R252-R256

Looks like there already is a check of the first type I mentioned. Although it doesn't seem to account for different units.

@minibits-cash
Copy link
Author

minibits-cash commented Oct 26, 2024

Yes. I was referring to how I would implement this here in Nutshell.

bff30d4#diff-563ab1fc2a5b2676a9794be3b08bb863afc36b495cbe4653ced3fdeb430bf530R252-R256

Looks like there already is a check of the first type I mentioned. Although it doesn't seem to account for different units.

Ah sorry, I misunderstood that.

Ad balance check: I believe nutshell already uses database views to calculate overall minted and melted amounts as well as issued balance.

Not sure how it handles the units tho.
I remind calle mentioning that max mint and melt configs do not handle units currently.

@minibits-cash
Copy link
Author

I now found that there already is MINT_MAX_BALANCE existing setting doing the same, so I close this one.

@minibits-cash
Copy link
Author

minibits-cash commented Oct 29, 2024

Related PR #652 could then focus to extend existing limits so they support multiple units (as they would likely be incorrectly applied as of now):

Limits
Max mint balance in satoshis
MINT_MAX_BALANCE=1000000
Max peg-in amount in satoshis
MINT_MAX_PEG_IN=100000
Max peg-out amount in satoshis
MINT_MAX_PEG_OUT=100000

@minibits-cash
Copy link
Author

There is now separate issue for this extended scope: #650

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

No branches or pull requests

2 participants